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 cmoran13, Yesterday, 01:02 PM
    0 responses
    30 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    22 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    160 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    95 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    148 views
    2 likes
    Last Post CaptainJack  
    Working...
    X