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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X