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

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 rhyminkevin, Today, 04:58 PM
    1 response
    38 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    49 views
    0 likes
    Last Post futtrader  
    Working...
    X