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

NT8 indicator data calculations

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

    NT8 indicator data calculations

    I have a question about indicators and the data used to calculate them.

    The data being analyzed:

    Chart:
    Time period: 15 min.
    Days to load: 30
    Calculate: On bar close


    Strategy enabled (Live):
    Time periods: 03 min. (primary) and 15 min.
    Days to load: 30
    Calculate: On each tick


    Specific indicator data is written to a CSV file at the instance of a trade ENTRY during the live trading day. After the trading day ends, the indicator data on the chart DOES NOT match the indicator data that was generated at the exact moment of the trade ENTRY at a specific timestamp.

    Both the chart and the indicator have the same amount of “Days to load”.

    All data written to the CSV file are from bars that are fully formed historical bars.

    Example:
    RSI(BarsArray[1], 14, 1)[1]

    Does the fact that the data used to build the “30 Days to load” chart bars are changing in real time make a difference how the indicators are calculated at the instance of a trade ENTRY compared to the end of a “completed day”? (New bars are being added during the live trading day. Are the oldest bars being removed from the “days to load” calculation?)

    Why don’t both versions of the indicator data match?

    What can I alter so the “at the instance of a trade ENTRY” and “completed day” chart versions of indicator data match exactly?
    Last edited by ArmKnuckle; 10-01-2019, 03:23 PM.

    #2
    Hello ArmKnuckle, thanks for your post.

    It seems like the data your reading is being read at different times (OnEachTick vs OnBarUpdate). You must make sure that you are writing this data to your document at the same tick. Its also possible that the file writing is taking a long time and values change within that time (it could be milliseconds that make the difference).

    You could also override OnExecutionUpdate and add your file writing code there. This will ensure that you get the most recent values when the execution occurs.

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I have more thoughts, but could you first answer the following specific "chart-related" questions?
      1. Could the indicator amount change on a chart during live trading on a locked/completed historical bar?
        1. Chart Calculate: On bar close
      2. As "New bars" are being added to a chart during the live trading day, are the oldest bars being removed from the “days to load” calculation?

      Thanks.
      Last edited by ArmKnuckle; 10-01-2019, 05:26 PM.

      Comment


        #4
        Hi, thanks for your reply.

        1. It will depend on the calculation happening on each bar. It can change if the calculation is different or the input is different. If you could provide an example I would be able to help further with this.

        2. No the old bars do not get removed. If you have 3 days on your chart and a day passes, you will then have 4 days on the chart and your script's price series can look back all the way to the first bar.

        Best regards.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        382 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        1 view
        0 likes
        Last Post oviejo
        by oviejo
         
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        125 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Yesterday, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Working...
        X