Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss and SetTrailStop simulate together

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

    SetStopLoss and SetTrailStop simulate together

    I have visited the Advanced Order Handling section and I understand that SetStopLoss and SetTrailStop cannot be used concurrently for the same position, however I was wondering if there is workaround.



    This is what I am looking to do:

    /***** Pseudocode below ***
    double profitTarget = 8; // Ticks
    double stopLoss = 8 // Ticks

    Lets say I buy S&P Eminis for a 1000

    I would like to immediately put out a stopOrder for 1000 - 8 ticks = 998

    I believe I can do this in OnExecution( )
    SetStopLoss

    However when my PNL = 1000 + (profitTarget )8 ticks = 1002, I would want to cancel the StopLoss Order and generate a Trailing Stop Loss (trailing stop loss order by 8 ticks)

    I do not want to start trailing right away because, the i want to allow 8 ticks of downside in the beginning and only after the simulated profit target is reached, I want to start trailing.

    Given the fact that there are no references returned for stoploss orders, how do i cancel the stop loss order and send a trailing

    #2
    ariliveitup, welcome to our forums - I would suggest you check into this sample below, as it deals with setting a static initial stop loss and then adjusting the set stop to provided the trailing functionality, all with using SetStopLoss only -

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X