Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Breakeven Stop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Breakeven Stop

    This method is not working in 6.5.
    Trying to use with Forex.


    SetStopLoss(CalculationMode.Ticks, stoplossticks);

    #2
    This is an acknowledged bug. It will be resolved with next update. Thanks for reporting though.

    Comment


      #3
      Breakeven Stop

      Just want to confirm, not working in Futures strategy either.

      Comment


        #4
        Right, this is true for any instrument types

        Comment


          #5
          Breakeven Stop

          This feature is still not working in Version 6.5.3.
          Jm

          Comment


            #6
            Please be specific.

            Comment


              #7
              Breakeven Stop

              Upon entering a Forex position, not showing original stop loss, and not adjusting to breakeven once 15 pips have been obtained.


              Original stoplossticks set at 50.
              // Resets the stop loss to the original value when all positions are closed
              if (Position.MarketPosition == MarketPosition.Flat)
              {
              SetStopLoss(CalculationMode.Ticks, stoplossticks);
              }

              // If a long position is open, allow for stop loss modification to breakeven
              elseif (Position.MarketPosition == MarketPosition.Long)
              {
              // Once the price is greater than entry price+15 ticks, set stop loss to breakeven
              if (Close[0] > Position.AvgPrice + 15 * TickSize)
              {
              SetStopLoss(CalculationMode.Price, Position.AvgPrice);
              }
              }
              elseif (Position.MarketPosition == MarketPosition.Short)
              {
              // Once the price is greater than entry price+15 ticks, set stop loss to breakeven
              if (Close[0] < Position.AvgPrice + -15 * TickSize)
              {
              SetStopLoss(CalculationMode.Price, Position.AvgPrice);
              }

              Comment


                #8
                [email protected],

                The code you posted works fine on my end. Please test the attached sample and see if it still doesn't work for you on the Simulated Data Feed. Pull the feed to an uptrend and then watch the orders on the Control Center. After you enter long you will see that a stop loss order is also submitted for 50 ticks below entry price. After your 15 ticks over entry price is obtained you will notice the original stop loss is no longer 50 ticks below but actually breakeven.

                To import go to File->Utilities->Import NinjaScript
                Attached Files
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  I have similar quastion

                  How can I tell Ninjatrader when it moves up by 12 ticks that it should breakeven with/ +2 ticks so that I can at least pay off commission's.

                  Comment


                    #10
                    You would use the Position.AvgPrice here + 2 * TickSize as new stop price then in your SetStopLoss call.
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by jclose, Today, 09:37 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post jclose
                    by jclose
                     
                    Started by WeyldFalcon, 08-07-2020, 06:13 AM
                    10 responses
                    1,413 views
                    0 likes
                    Last Post Traderontheroad  
                    Started by firefoxforum12, Today, 08:53 PM
                    0 responses
                    11 views
                    0 likes
                    Last Post firefoxforum12  
                    Started by stafe, Today, 08:34 PM
                    0 responses
                    11 views
                    0 likes
                    Last Post stafe
                    by stafe
                     
                    Started by sastrades, 01-31-2024, 10:19 PM
                    11 responses
                    169 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Working...
                    X