Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FOREX strategy - Move Stop to Breakeven

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

    FOREX strategy - Move Stop to Breakeven

    I am using " EnterLong(1, "Long Entry");"

    and have the following for Stop Losses

    //Manage Stop Loss(Initial Stop Loss)
    SetStopLoss(780);

    //Move Stop to Breakeven(LONG Side)

    if (Position.MarketPosition == MarketPosition.Long)
    {
    if (Close[0] > Position.AvgPrice + 45 * TickSize)
    SetStopLoss(CalculationMode.Price, Position.AvgPrice);
    }

    //Move Stop to Breakeven(Short Side)
    if (Position.MarketPosition == MarketPosition.Short)
    {
    if (Close[0] < Position.AvgPrice - 45 * TickSize)
    SetStopLoss(CalculationMode.Price, Position.AvgPrice);
    }

    The Initial Stop Loss seems to be working but the Break Even Stop does not

    Once I am up 45 pips ($450 on 100,000 units) want to move my stop to breakeven

    Should be straight forward but I dont see the problem with the above code?

    #2
    Have looked around the forums and this is what other folks seem to be using,,,Have put this in the OnBarUpdate() section

    Comment


      #3
      mefTrader, you can review this sample here -



      You want to initialize the stop in your Initialize() methed and then work the dynamic parts in OnBarUpdate().

      Which connection and pip setting are you working with?

      Are you sure the 45 shoudn't be 450 (for example for MBT on tenthPip setting).

      Thanks

      Comment


        #4
        Can I label this StopLoss as a Breakeven Trade on the chart?

        Comment


          #5
          Hello meftrader,

          Stop loss orders used this way can only use the name stop loss for the exit orders. If you wanted to attach a unique name to this order, you would have to use a method such as ExitLongStop() or ExitShortStop(). You could also custom program it to draw text whenever there is a breakeven movement. This reference sample can help with using draw objects.
          Ryan M.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          669 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          378 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          111 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          581 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X