ww58
- ago
I'd like to implement a WaveTrend indicator. The sample pinescript code as a base

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);
0
226
Solved
3 Replies

Reply

Bookmark

Sort
- ago
#1
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"); }
2
Best Answer
ww58
- ago
#2
Exactly what is needed. Thank you!
0
- ago
#3
Glad to help. Adding it to PowerPack B25.
1

Reply

Bookmark

Sort