Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StopLossOrder

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

    StopLossOrder

    Hi,

    I'm putting an EnterLongStop at each bar within OnBarUpdate().
    Same for a stop loss. (Backtest)

    EnterLongStop(1, buystop2,"entry long");
    SetStopLoss("entry long",CalculationMode.Ticks, Range()[0]*0.5/TickSize, false);

    Whenever the order is filled, the stop loss occures at Open of the entry bar.
    Exit woud normally take place at the following Open.

    Why is that? Are there any pending stop loss orders due to orer submission at every bar that cause that behaviour. Do I have to use OnExecution() and OnOrderupdate() for proper working SLs?

    #2
    Hello Stephan,

    Thank you for your post.

    When the entry is filled the StopLoss is placed at the same bar of the entry.
    Since the backtest is working off of CalculateOnBarClose and if the same bar goes through the StopLoss price it will get filled on the same bar.

    You may want to add a condition to wait a couple bars before placing the StopLoss or increase the StopLoss amount.

    BarsSinceEntry() would help accomplish this -
    http://www.ninjatrader.com/support/h...sinceentry.htm
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    57 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X