Flat Channel – EA MetaTrader 5

Idea byΒ JS_Sergey

mq5 code authorΒ –Β barabashkakvn

The Expert Advisor uses the Β Standard Deviation smoothingΒ custom indicator, which is a smoothed Standard Deviation. Determine trend existence based on the indicator values on bars #0, #1, #2, #3 and #4:Β 

(StdDev #0 > StdDev #1)Β  && (StdDev #1 > StdDev #2)Β  && (StdDev #2 > StdDev #3)Β  && (StdDev #3 > StdDev #4) -> there is a trend

It also determines flat within the “Minimum number of bars” bars. A flat zone is indicated by two lines:


If there is no flat zone currently in the market, the EA does not place pending orders. Also, if there is no flat, appropriate lines are deleted from the chart. When any of the pending orders triggers, other pending orders are deleted, and trailing stop is further applied to positions.

Stop Loss and Take Profit can be set both as constant or dynamic values. This depends on the Stop loss andTake Profit parameters. The lot value can also be either constant (“Enable the money management function” is set to “false”) or dynamic. This depends on the number of trades closed by Stop Loss and Take Profit.

Alternative:  Price_Momentum_Oscillator - indicator MetaTrader 5

EURUSD,M30:

Flat Channel


https://www.mql5.com/ru/code/23139

πŸ“ˆ ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks