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

Different results single bar vs. multi-bar

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

    Different results single bar vs. multi-bar

    Hello,

    I'm trying to write a NT7 indicator that uses Gomi non-cumulative delta for multiple time frames. I'm getting a discrepancy in the results of the second time frame when it's added as a second bar series than when it's standalone as the primary time frame. e.g. in single time frame case, the data is ES 10-tick range bar, and in the multi-time frame the primary bar is ES 5-tick range bar and the second is ES 10-tick range bar. The discrepancy appears to be when the FirstTickOfBar event is issued. Here are some details from logging to illustrate:

    Single bar case
    - First GomOnBarUpdate::FirstTickOfBar before any GomOnMarketData
    - Second GomOnBarUpdate::FirstTickOfBar at 8/2/2017 3:26:18AM : cumulative delta -1393 after 27843 iterations of GomOnMarketData

    Multi bar case:
    - First GomOnBarUpdate::FirstTickOfBar for BarsInProgress=1 after 11 BarsInProgress=0
    - Timestamp is the same, 8/2/2017 3:26:18AM.
    - Cumulative delta is -1649 after 27481 iterations of GomOnMarketData. This is the same value as the single bar case at its iteration 27481, but it didn't trigger the update until after iteration 27843, by which the delta had become -1393.

    The delta is reset during FirstTickOfBar, so the -1649 would be considered the close of the previous bar. As a sanity test, by iteration 27843 of the multi-bar case, the delta was 256. So had it not reset, the delta at that point would have been -1649 + 256 = -1393. So the data accumulation is not the issue. It's the syncing of when the FirstTickOfBar are arriving. For the single bar case it's after 27843 iterations of onMarketData, for the multi-bar case it's after 27481 iterations, and yet both have the same timestamps.

    This behavior is the same regardless of the CalculateOnBarClose setting.

    Is there any way to force the FirstTickOfBar for the second bar series to behave the same as the standalone single bar case?

    Alternatively, is there a way to access indicator data from another chart?

    Thanks.

    #2
    Hello silverm3170,

    Thank you for your note and welcome to the NinjaTrader Support Forum!

    Please reach out to the developer of the system on the website that you downloaded the software. NinjaTrader support would not provide support for third party add ons.

    Please let me know if you have any questions.

    Comment


      #3
      Thanks Patrick,

      Is there a Ninjascript way to access an indicator value in one chart from another that's in the same workspace, e.g. if I had two charts, one ES 5-range and the other ES 10-range? Generically speaking for any indicator, not related to any vendor in particular.

      Thanks.

      Comment


        #4
        Hello silverm3170,

        Thank you for your response.

        There would not be a means to access an indicator from another chart or workspace. You would need to add the indicator or instrument to the code (as you have done).

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        3 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        6 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X