This is a breakout indicator using Linear Regression (LR) and Standard Deviation (SD) adaptive channels. It finds a best fitting of linear regression and standard deviation channels on consecutive bars, then monitors prices on breaking out the channel, and if so - generates a signal.
The best fitting is performed by picking up the channels length which provides less difference between LR and SD channels width. On every bar the channels may have different - adaptive - length.
Indicator displays price line (green) as an offset from the channel center line on the current bar, smoothed price line (light blue) and red histogram with signals up or down on bars where breakout of the channel occurs. In addition, indicator can optionally display LR (blue) and SD (orange) channels widths and current channel angle (gray).
- CountPeriodMax - maximal period (channel length) to estimate for best fitting; default - 100;
- CountPeriodMin - minimal period (channel length) to estimate for best fitting; default - 5;
- MaxBars - number of bars to process; default - 1 000; do not set a large value, because calculations of channels for a bunch of periods on every bar may consume a lot of CPU resources; set to 1 when called from the Expert Advisor;
- Shift - index of the bar, at which LR and SD channels will be displayed on the main chart if Explain is true; default - 1;
- PriceType - price type to use; default - close;
- Factor - a threshold used for signal detection - when the price line (module) is Factor times larger than the channel width, a signal is activated; default - 1;
- MAPeriod - period of price line smoothing by EMA; default - 5;
- Explain - enable/disable output of additional buffers with SD and LR channels widths, and channel angle; default - false; also, if this parameter set to true, channels are shown on the main chart at the bar number Shift.
The following trading strategies are suggested:
- use up and down signals to open buy or sell orders;
- trade buy when smoothed price line crosses zero line up, trade sell when it crosses zero line down.