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 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 PhillT, 04-19-2024, 02:16 PM
4 responses
31 views
0 likes
Last Post PhillT
by PhillT
 
Started by ageeholdings, 05-01-2024, 05:22 AM
5 responses
36 views
0 likes
Last Post ageeholdings  
Started by reynoldsn, Today, 02:34 PM
0 responses
10 views
0 likes
Last Post reynoldsn  
Started by nightstalker, Today, 02:05 PM
0 responses
17 views
0 likes
Last Post nightstalker  
Started by llanqui, Yesterday, 09:59 AM
8 responses
30 views
0 likes
Last Post llanqui
by llanqui
 
Working...
X