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

EMA RAtio

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

    EMA RAtio

    Hi,

    I am using two data series and calculate EMA on them. when I am calculating second data series it give me exception (index out of bound)
    ema2 = EMA(ChartControl.BarsArray[1],_ema2Length)[0];

    Can some one tell me about this issue.

    IRFAN

    #2
    IRFAN, in this MultiSeries study do you run a CurrentBars check at your OnBarUpdate() start before attempting to process anything?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks
      but it also give exception on that line which u suggest
      if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
      at currentbars[1] index out of bound exception

      Comment


        #4
        But would you have added the needed second series in in your Initialize(), correct?

        BertrandNinjaTrader Customer Service

        Comment


          #5
          I am adding these two data series from chart not in initialize(). Is this is correct way?

          Comment


            #6
            Unfortunately not, you would need to Add() via Initialize() as documented to be able to work with it programmatically.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks I will try.

              Comment


                #8
                Hi,
                can U plz tell me in what way I can get the period type of first instrument and its value

                Comment


                  #9
                  You can check it with BarsPeriod, however this would not be possible / supported in the Intialize() for dynamic adding - http://www.ninjatrader.com/support/h...sub=BarsPeriod
                  BertrandNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by RookieTrader, Today, 09:37 AM
                  2 responses
                  10 views
                  0 likes
                  Last Post RookieTrader  
                  Started by alifarahani, Today, 09:40 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by Gerik, Today, 09:40 AM
                  2 responses
                  6 views
                  0 likes
                  Last Post Gerik
                  by Gerik
                   
                  Started by KennyK, 05-29-2017, 02:02 AM
                  3 responses
                  1,285 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  11 responses
                  186 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X