Metatrader Indicator modification

I would like to add a simple channel width calculation to a Regression line indicator.

Indicator and simple picture attached.

Channel width calculation should be added as 4th buffer to the original indicator.

I tried the basic Pythagorean calculation below, but I was nor working correctly. Channel width must be calculated in correct point value (for example in Euro 40 pip channel buffer output is 0.00400)

double X,X2,D2,A2;

double angle =(fx[barStart]-fx[barStart+bars])/bars;

double distance =(sqh[barStart]-sql[barStart]);

D2 = MathPow(distance,2);

A2 = MathPow(angle,2);

X2 = D2/(A2+1);

X = MathSqrt(X2);

// X is supposed to be the channel width, but this formula doesn't give correct result

Skills: Metatrader

See more: regression, point modification, regression formula, angle indicator, value double, result double, metatrader pip value indicator, formula sql, sql formula, simple calculation, metatrader point, channel working, distance calculation, regression channel, add buffer indicator, pip, metatrader sql simple, metatrader buffer, d2, buffer metatrader, add formula, simple indicator, add metatrader, simple indicator metatrader, metatrader simple

About the Employer:
( 6 reviews ) Espoo, Finland

Project ID: #1105732

Awarded to:


Hello sir, I have already code this out, please check my PM.

$30 USD in 0 days
(27 Reviews)

2 freelancers are bidding on average $30 for this job


please check pmb

$30 USD in 1 day
(8 Reviews)