Announcement

Collapse
No announcement yet.

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?

    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?

        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.

            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

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sjsj2732, Yesterday, 04:31 AM
                  0 responses
                  32 views
                  0 likes
                  Last Post sjsj2732  
                  Started by NullPointStrategies, 03-13-2026, 05:17 AM
                  0 responses
                  286 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  283 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  133 views
                  1 like
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  91 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Working...
                  X