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

How does NINJATRADER Interpolate Indicator data on Bar #1 when BAR < Period ?

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

    How does NINJATRADER Interpolate Indicator data on Bar #1 when BAR < Period ?

    Hello,
    On Bar # 1 MACD(Closes[0], 12, 26, 9)[0] returns a value,
    this is fine but how do we interpolate this data for a smaller data set less than the required 26 bars?
    1.) Are we using a shorter ema and expanding as we approach ie, using an EMA of 1, 2, 3,?
    2.) Are we using a shorter ema of fixed value until we approach the minimum length 26?
    3.) Are we using a fixed ratio as the data becomes available? ie. 6, and 13?

    What's the process?
    if (CurrentBars[0] == 1)
    {
    Print ("INTERPOLATED MACD BAR #1: " + MACD (Closes[0], 12, 26, 9)[0]);
    }
    Prints: 0.221134568713751
    Thanks,​
    Last edited by Entwaze; 07-31-2023, 03:44 PM.

    #2
    okay nvm, ive had my petty outburst for the day, 9 decimal places is fine for me, but it you ever find out let me know please

    Comment


      #3
      Hello Entwaze,

      May I have you clarify your meaning of interpolate?

      (in·ter·po·late - insert (something of a different nature) into something else.)

      To confirm, you are trying to inject new values in to the bar data?

      Where you have inquired:
      Are we using a shorter ema and expanding as we approach ie, using an EMA of 1, 2, 3,?
      The MACD will use the bars available until CurrentBar is up to the period number of bars.

      For example if CurrentBar is 3, only 3 bars will be used for the calculation.

      The BarsRequiredToPlot property is meant to give indicators time to reach the period for more accurate calculations before it begins plotting.

      Any custom logic in a host script, should wait to perform actions until CurrentBar is equal to or greater than the period, if you want accurate values before performing an action.

      Are we using a shorter ema of fixed value until we approach the minimum length 26?
      The EMA would just be calculating with all of the bars available until the period is reached. This is coded in the logic of the script. You can view this logic in the NinjaScript Editor.

      Are we using a fixed ratio as the data becomes available? ie. 6, and 13?
      This wouldn't a ratio. Until CurrentBar is equal to the period, it would just be using the bars available.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Yes, im making a custom macd and i meant interpolate by what ever values MACD uses from 1 -> Period because 0 is 0 so i got confused, but yes you're totally, right i just needed to make sure my values initially matched up before i started adding Bollinger and stuff ! Thanks you though, i just changed it to only calculate after period

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Fitspressorest, Today, 01:38 PM
        0 responses
        2 views
        0 likes
        Last Post Fitspressorest  
        Started by Jonker, Today, 01:19 PM
        0 responses
        1 view
        0 likes
        Last Post Jonker
        by Jonker
         
        Started by futtrader, Today, 01:16 PM
        0 responses
        5 views
        0 likes
        Last Post futtrader  
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,791 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        844 views
        0 likes
        Last Post emuns
        by emuns
         
        Working...
        X