|
Los Angeles, California Republic
Legendary R.I.P. 1965-2023
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,723
|
I'm new to NinjaScript and not the world's greatest programmer so if this is a stupid question please excuse me.
I would like to plot the value of the 21 period SMA of the logarithms of the close values of each bar.
However, the Math.Log function won't let me use a DataSeries value. And the SMA function won't let me use a double value. How can I get around this.
Plot0.Set(SMA(Math.Log(Close[0])), 21)); is a no go.
Here's some simple code I tried to get around it but it didn't work. It should help illustrate the problem though.
double cl = Close[0];
double Lcl = Math.Log(cl);
DSOne.Set(Lcl);
Plot0.Set(SMA(DSOne, 21));
Any help would be greatly appreciated!
|