• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to access price data more than 20 barsAgo

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

  • NinjaTrader_Dierk
    replied
    imported post

    There is no limitation on # of bars ago you can reference. You only need to make sure your CurrentBar index is greater than the lookback value, like

    Code:
    if (CurrentBar > 40)
      Print(EMA(200)[40].ToString());

    Leave a comment:


  • lewdfinger
    started a topic How to access price data more than 20 barsAgo

    How to access price data more than 20 barsAgo

    I want to compare the EMA(200)[0] to EMA(200)[40] or higher but when I assign the latter to a variable it comes up null - the most I can get is 20 bars ago.

    Is there a way to increase the maximum number of bars one can reference?

    Code:
    protected override void OnBarUpdate()
    
    {
    
    Print(EMA(200)[20].ToString());
    
    }
    KD

Latest Posts

Collapse

Topics Statistics Last Post
Started by Gregorian, Today, 02:05 PM
1 response
5 views
0 likes
Last Post NinjaTrader_PatrickG  
Started by smf2005, Today, 01:49 PM
2 responses
9 views
0 likes
Last Post smf2005
by smf2005
 
Started by punkiy2111, Today, 02:00 PM
2 responses
4 views
0 likes
Last Post punkiy2111  
Started by hunter7, Today, 12:44 PM
3 responses
16 views
0 likes
Last Post NinjaTrader_PatrickG  
Started by aaadetos, Today, 12:29 PM
2 responses
6 views
0 likes
Last Post aaadetos  
Working...
X