View Full Version : Using a formula or variable as an input to an Indicator
05-24-2007, 11:41 AM
I cannot seem to pass a variable as an input to an indicator. Can "IDataSeries" only be Open, High, Low or close ?
05-24-2007, 12:03 PM
Please be specific. What do you want to code?
05-24-2007, 12:09 PM
I want an an EMA of the average of O+H+L+C multiplied by a variable.
05-24-2007, 12:20 PM
I see. You would need to code your own indicator to achieve that. This indicator would stuff <variable> *(O+H+L+C) into a DataSeries which you then could stuff into EMA. Something like (in pseudo code):
bufferSeries = new DataSeries(this);
Value.Set(EMA(bufferSeries, 14)); // 14 period EMA on your series
Please check out e.g. ADX implementation for details (e.g. dmPlus series).
05-24-2007, 02:15 PM
protected override void Initialize()
Add(new Plot(Color.Orange, PlotStyle.Line, "Plot0"));
TInput = new DataSeries(this);
protected override void OnBarUpdate()
TInput.Set((Open+High+Low+Close) *.25) ;
The above is still giving the Errors:
The best overloaded method match for 'NinjaTrader.Data.DataSeries.Set(double)' has some invalid arguments
Argument '1': cannot convert from 'NinjaTrader.Indicator.EMA' to 'double'
05-24-2007, 03:58 PM