PDA

View Full Version : Retrieve Indicator Value n BarsAgo


TAJTrades
12-27-2007, 03:39 AM
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

NinjaTrader_Dierk
12-27-2007, 04:27 AM
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/vb/showthread.php?t=3170