Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PLAYBACK AND REAL TIME differences

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

    PLAYBACK AND REAL TIME differences

    I created a script that based on some logic it enter long and short, I then decided to add a stoploss at the average price when my profit is 4 ticks so the position doesn't go into loss.
    If i play in the playback connection the strategy, the stop loss moves perfectly, but when i use it in real time it doesn't move. What could be the reason of that?
    the code is like this :
    i added a dataseries of 1 second and this is in the Barupdate=1, so for each seconds:


    if(Position.MarketPosition != MarketPosition.Flat)
    {
    if (Positions[0].GetUnrealizedProfitLoss(PerformanceUnit.Ticks) > 2)
    {
    SetStopLoss(CalculationMode.Ticks, 0);
    }



    }

    #2
    Hello AlessioCianini12,

    From the given details I wouldn't be able to say what may have happened, it would be best to use a Print here to compare how the condition is evaluating between the two tests. If you see that some part of the condition or processing is happening differently that would give clues on a solution.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X