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 Leeroy_Jenkins, Today, 06:35 AM
    0 responses
    6 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by moneyexe, Today, 01:38 AM
    3 responses
    21 views
    0 likes
    Last Post bltdavid  
    Started by EmmaaPerkin, Today, 12:29 AM
    0 responses
    9 views
    0 likes
    Last Post EmmaaPerkin  
    Started by appleacv, Today, 12:17 AM
    0 responses
    8 views
    0 likes
    Last Post appleacv  
    Started by ReingerJamir, Yesterday, 10:51 PM
    0 responses
    14 views
    0 likes
    Last Post ReingerJamir  
    Working...
    X