Envelope-ATR consist of 3 WeightedAverages(21) and the AverageTrueRange(14).
In fact its very simple, take the WeightedAverage (21) of the Close, the high and the low. The WeightedAverage of the close count as the arbiter of the game.
The WeightedAverage of the High decide the upper band and the WeightedAverage of the Low decide the lower band.
The background of the channel is coloured with conditions based on the slope of the envelope.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
//Berekening van het gemiddelde en zijn banden once n=21 e=WeightedAverage[n](close) e1=Weightedaverage[n](high)+2.618*AverageTrueRange[14](close) e2=Weightedaverage[n](low)-2.618*AverageTrueRange[14](close) //Opwaartse koersen blauwe lijnen //Neerwaartse koersen rode lijnen //Gele rechthoeken zijwaartse koersen if e1>=e1[2] then DRAWSEGMENT(barindex, e1, barindex, e)coloured(0,125,175,255)//Stijgende koersen elsif e2<=e2[1] then DRAWSEGMENT(barindex, e2, barindex, e)coloured(204,0,255,255)//Dalende koersen else //We tekenen een rexhthoek als de koersen zijwaarts gaan DRAWRECTANGLE(barindex,e1, barindex[1], e2[1])coloured(255,255,0,255)//Zijwaartse koersen endif return e as"Middellijn", e1 as"Stijgende koersen", e2 as"Dalende koersen" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials