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 llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Working...
    X