Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical vs Realtime Output

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

    Historical vs Realtime Output

    I am testing a Ninja strategy code to take some automated trades on ES on a 15-range chart. In my strategy, in OnBarUpdate(), I read/calculate these four values: current bar delta, previous bar delta, current bar delta percent and previous bar delta percent. Then, if (IsFirstTickeOfBar), based on the 4 above values and by comparing the price[0] and price [1], I make a trade decision to go long or short or nothing.

    When testing this code, both under sim and playback accounts, I noticed the following:

    Scenario 1: When this strategy is activated & set to calculate "on each tick": For the past/historical data, my code is returning the values correctly for current bar delta, previous bar delta, current bar delta percent and previous bar delta percent. However when running realtime, the same code is returning these four values for the previous respective bars instead (by shifting one bar to left, for example, takes the previous bar as the current bar etc).

    Scenario 2: When this strategy is activated & set to calculate "on bar close": For the past/historical data, my code is returning the values correctly for current bar delta, previous bar delta, current bar delta percent and previous bar delta percent. However when running realtime, the same code is returning current bar delta as 0, and current bar's delta as previous bar delta etc.

    In summary, I am getting the correct values returned when running this strategy on the historical data but not on realtime. Any idea what is causing this issue? Thanks!​

    #2
    Hello rsz16,

    Thanks for your post.

    What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.0.?.? or 8.1.?.?)

    Which instrument and interval are you using? (Ex: 1-Minute ES 06-23, 500-Tick NQ 06-23, etc.)

    Are you comparing backtest results in the Strategy Analyzer to the strategy running real time on a chart?

    Please provide me with a reduced exported copy of the strategy and the exact steps and settings used to reproduce this behavior so that I may look into this matter further.

    To export a strategy, go to Tools > Export > NinjaScript AddOn.

    Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

    To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.​

    I look forward to assisting further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thank you Brandon!

      I'm currently using version 8.1.1.6 64-bit and the the interval/instrument is 15 Range ES 06-23. I also do use the strategy analyzer, but I'm comparing the output from market replay (for dates 6-8-23 and 6-9-23) to real time trading. As suggested, I can export and send you the code. Could you please let me know your Ninja email ID or email me a test message so I can email you the code? Thank you!​

      Comment


        #4
        Hello rsz16,

        Thanks for your note.

        I have received ad replied to your email.

        Please forward any questions you have in regard to this topic to that email.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by michelz, Yesterday, 08:30 AM
        6 responses
        36 views
        0 likes
        Last Post MiCe1999  
        Started by ntbone, Yesterday, 01:50 AM
        13 responses
        52 views
        0 likes
        Last Post MiCe1999  
        Started by gyilaoliver, Today, 10:30 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Irukandji, Yesterday, 04:24 PM
        2 responses
        27 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by madankumars, 11-18-2019, 11:12 AM
        15 responses
        204 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X