I'd like to implement a WaveTrend indicator. The sample pinescript code as a base
I'm having difficulty with line 3. I need to get the absolute value in this line
ind3 = new EMA(bars.AveragePriceHLC - ind2, 10);
CODE:
ap = hlc3 esa = ema(ap, n1) d = ema(abs(ap - esa), n1) ci = (ap - esa) / (0.015 * d) tci = ema(ci, n2) wt1 = tci wt2 = sma(wt1,4)
I'm having difficulty with line 3. I need to get the absolute value in this line
ind3 = new EMA(bars.AveragePriceHLC - ind2, 10);
Rename
Is this close to what you're looking for? If so we can get this included into next build of the PowerPack:
CODE:
//create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { int n1 = 10, n2 = 21; var ap = bars.AveragePriceHLC; var esa = EMA.Series(ap, n1); var d = EMA.Series((ap - esa).Abs(), n1); var ci = (ap - esa) / (0.015 * d); var tci = EMA.Series(ci, n2); PlotIndicatorOscillator(tci, default, default, default, default, default, "wto"); PlotIndicatorOscillator(SMA.Series(tci, 4), default, default, default, default, default, "wto"); }
Exactly what is needed. Thank you!
Glad to help. Adding it to PowerPack B25.
Your Response
Post
Edit Post
Login is required