Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Referencing Previous Indicator values

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

    Referencing Previous Indicator values

    Is there a way to reference a previous indicator value?

    For example,

    EMA(5)[0] - EMA(5)[20]

    This will not produce a result. Does anybody know a way to get around this or to do this?

    Thanks.

    #2
    JamesF, this should work - please make sure to take consideration of this tip at your OnBarUpdate start - http://www.ninjatrader-support2.com/...ead.php?t=3170

    Comment


      #3
      So say I was trying to achieve some thing like this....


      number = EMA(5)[0] - EMA(5)[lookbackperiod]

      plot0 = "number";


      would I just insert a snippit in the on bar update above it?

      {
      if (EMA[0] > EMA[Math.Min(CurrentBar, lookbackperiod)])
      // Do something
      }

      Comment


        #4
        I'm not sure what you're trying to achieve, if 'lookbarperiod' should be a user defined input parameter you can change on the fly to adjust, please take a look at this tip on how to create those in your scripts - http://www.ninjatrader-support2.com/...ead.php?t=5782

        Comment


          #5
          I have an indicator that adds up all the times the direction of an ma changes. I want it to only display the number of changes in the last 20 bars or so, the "lookbackperiod" variable. So, I am wondering how I can obtain the number of changes by subtracting the number of changes at [20] or [lookbackperiod] from the number at [0].

          Hence,

          localvaribale = Indicator(5)[0] - Indicator(5)[20];
          plot0= "localvariable";

          I need to be able to reference the number that the indicator displays at [20] to do this. Is this possible?

          Comment


            #6
            Then you would need to work with dataseries objects that hold the historical indicator values - http://www.ninjatrader-support.com/H...iesObject.html

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            169 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            328 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            252 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            353 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            181 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X