Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnExecution and Backtest

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

    OnExecution and Backtest

    Hallo,

    I have many problems with strategies that should have StopLoss and TrailStop since the Set() methods cannot be used simultaneously. What I am trying to do is use the SetTrailStop() and exit with ExitLongStop orders but it doesn´t really work.
    Can anyone tell me what is wrong with my appoach? I use market orders to enter a long trade. I use OnExecution() to submit an ExitLongStop order, with LivetillCancelled set to true and using the execution.order.AvgFillprice minus some Stoploss. Traceorders is set to true, so I can see in the output window that the order is placed. No errors there.
    In backtest the order is never there. As soon as I change to SetStopLoss, everything works wonderfully.
    Can anyone give me any insight in how to deal with this situation? Shall I post the code?

    Thank you. Any help welcome.

    #2
    jriverac, unfortunately not exactly sure from you post, so please clarify - are you trying to use Set and Exit methods simultaneously? Then you would easily run into the internal order handling rules we have 'under the hood' -

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    60 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    148 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 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
    284 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X