Moving Average is a useful indicator that provides feedback about the trend and its direction. A rising Moving Average implies a bullish trend, whereas a falling Moving Average implies a bearish trend. The Average True Range determines the strength of the trend and its movement. A gradually increasing Average True Range implies a strong trend (which can either be bullish or bearish), whereas a falling Average True Range implies exhaustion or sideways movement. By combining these two indicators the BuySell indicator identifies profitable trend-following opportunities.
In the first step, we calculate the Moving Average based upon the user input configuration – namely MA_METHOD,MA_PERIOD, and MA_PRICE. In the second step we calculate the Average True Range based on the ATR_PERIOD parameter.
As mentioned earlier, a rising Moving Average implies an uptrend and a falling Moving Average implies a downtrend. When the Moving Average is rising, the Average True Range is subtracted from the Moving Average to calculate the BULLISH trailing level (RED line). This level is used as a trailing stop for BUY trades.
Likewise, when the Moving Average is falling, the Average True Range is added to the Moving Average to calculate the BEARISH trailing level (BLUE line). This level is used as trailing stop for SELL trades.
This indicator has four components – blue circles, blue dots, red circles and red dots. It is primarily used in a stop-and-reverse (SAR) trading mechanism.