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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    38 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    287 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    289 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    134 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    95 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X