PDA

View Full Version : Errors in implementing DataSeries


grd974
07-19-2007, 04:48 PM
Here is some code I borrowed from this forum :

private int AskTotCumulativeVolume;
AskTotCumulativeVolume = e.MarketDepth.Ask.TotalVolume(5);

this is the code I compiled and the error message I got :

private DataSeries averageAsk;
averageAsk = new DataSeries(this);
[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot0
{
get { return Values[6]; }
}
averageAsk.Set(SMA(AskTotCumulativeVolume, 10));
Argument '1': cannot convert from 'int' to 'NinjaTrader.Data.IDataSeries'
Plot0.Set(averageAsk);
Argument '1': cannot convert from 'NinjaTrader.Data.DataSeries' to 'double'

Please, let me know what I should do to have that SMA plotted ?

NinjaTrader_Ray
07-19-2007, 04:50 PM
Try:

averageAsk.Set(SMA(AskTotCumulativeVolume, 10)[0]);
Plot0.Set(averageAsk[0]);

grd974
07-19-2007, 05:08 PM
Hi Ray,

Sorry to let you know, I have one error left :

averageAsk.Set(SMA(AskTotCumulativeVolume, 10)[0]);
Argument '1': cannot convert from 'int' to 'NinjaTrader.Data.IDataSeries'

NinjaTrader_Ray
07-19-2007, 05:13 PM
AskToCummulativeVolume is of type 'int' and not of type 'IDataSeries'. You can not pass into the SMA() method the variable AskToCummulativeVolume. You need to store this data in a DataSeries object.

Additional information - http://www.ninjatrader-support.com/HelpGuideV6/DataSeriesObject.html

NinjaTrader_Josh
07-20-2007, 01:13 AM
Is it possible to create a DataSeries object that is not synced with historical data bars and use it like an array?

NinjaTrader_Dierk
07-20-2007, 01:51 AM
Nope. Just use e.g. an ArrayList.