Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Retrieve Indicator Value n BarsAgo

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

    Retrieve Indicator Value n BarsAgo

    How do I retrieve the Value from any Indicator n BarsAgo? The following code leaves the Output Window empty and will not populate the study on the chart. I am using a 20 Period EMA 1 Bar Ago to keep things simple.

    double value = EMA(20)[1];
    Print("The previous EMA value is " + value.ToString());

    PreviousEMA.Set( EMA(eMAPeriod)[eMABarsBack] );


    Thanks

    #2
    If nothing (!) is printed in the Output then the Print statement in your code is not reached. Please always check the logs for error messages.

    Likely:
    double value = EMA(20)[1];
    causes the trouble.

    Please read more here: http://www.ninjatrader-support.com/v...ead.php?t=3170

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    22 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    12 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    8 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    10 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    16 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X