Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitShortStop

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

    ExitShortStop

    Dear Support

    i have strategy activating a ExitLongStopMarket.
    The order is put correctly however in the next bar update it gets cancelled.

    you can see in the screenshot attached

    this is my code below

    Code:
    if (StopLossSet == 0 && Position.GetUnrealizedProfitLoss(PerformanceUnit.P oints, Close[0]) > 0.25 && Close[0] >= EMA200[0])
    {
    Print("Position Hit EMA200, Set Exit Stop Market Order 0.25 above Average Price");
    ExitLongStopMarket((int)CalculationMode.Price, (Position.AveragePrice + 0.25));
    StopLossSet = 1;
    }
    Then When the market position is flat i reset the variable flag to 0 -> StopLossSet = 0;

    So this ExitLongStopMarket gets ran only one time, since what i want is to set it and let the price continue ging up or closing with 1 tick profit.
    but i dont know why is getting cancelled as soon as next bar is created.

    what am i doing wrong?

    Thanks
    Last edited by jimmy_NT; 05-19-2022, 11:38 PM.

    #2
    here is the screenshot

    Comment


      #3
      Hi jimmy_NT, thanks for posting. Use the advanced overload to keep resting orders alive:

      ExitLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)

      This overload lets you keep the order alive. Other resting orders will be canceled on the close of every bar unless they are resubmitted each bar.

      Kind regards,
      -ChrisL

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X