Standard deviation channel
-
Hi everyone,
so I've managed to draw a trend line down the centre line of a std dev channel.
Any ideas how I can offset it to the outside lines.Someone with a similar problem mentioned he used a code block.
If so, can someone please help me with the code as I have no coding experience.
Thanks
Moof

-
-
I'm still stuck on this if anyone has any suggestions
Thanks -
@Moofty Oh hello
Didn't get that notification, just accidentally found this thread.I am working with these channels too - and its a pain. I decided to abandon the "regression channel" and "standard deviation channel" objects entirely, as you cant get those upper and lower values without some serious custom code.
Instead I calculate all those lines manually, with some loops and formulas.
I can make a tutorial if youre still interested in these. -
@roar Hi, super interesting. I am very interested. Please show me a tutorial on this.
-
@roar did you ever do a write up on channels?
-
@jsauter86 I didnt...
Drawing a regression line is all about finding the slope, or beta coefficient.
https://en.wikipedia.org/wiki/Simple_linear_regression

When beta is found, we can draw the line knowing that it passes through average x (time) and y (price) values.
Here's how the above equation is done in mql4:
https://fxdreema.com/shared/q3NtvMLMc -
I takes so much less blocks and probably time to build a reg line the code way.
Here is my regression channel in mql5 : https://fxdreema.com/shared/NWfNacSPc
Does yours work the same in mql5 ? My tester draws a vertical line :

-
@seb-0 Yeah I used to do this with blocks, but gradually learnt this more compressed method.
Mt5 works as well, but you have to reset the variables each time before calculation:

-
@roar
I see thank you.
I see a lot of simple linear regression channels on the market, however this way, with a calculation of a fixed number of bars, I don't think you can go anywhere.
It should be part of a bigger system which could find a relevant anchor point at least.
What way would you use this kind of tool ? -
@seb-0 I agree, fixed-length regression indicators are just glorified moving averages. In the example the array has a fixed size of 300, but surely you can change that according to some anchor point calculation. I often use the most recent volatility spike as a starting point.
I dont really know if regression channels are very useful. Maybe they can be used to find very stable and linear trends: compare the amount of close prices near the regline to the amount of close prices away from the regline...
-
dang, yall are on a whole different level above me. I wouldn't know where to begin with coding like that. I'll figure it out if I ever feel like I need to. haha