Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by helpwanted, Today, 03:06 AM
    0 responses
    3 views
    0 likes
    Last Post helpwanted  
    Started by Brevo, Today, 01:45 AM
    0 responses
    6 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X