The MA Distance Expert Advisor is designed to open positions when the current price moves away from a pre-selected Moving Average and to close them when the price touches the same or another pre-selected MA.
To facilitate the following examples, we use the STS MA Distance Indicator which visualizes the distance from the current price to the selected MA by drawing a horizontal line at the current price level of the MA. The indicator also continuously calculates and shows this distance in pips.
Example 1:
Trade direction: Short
Type of Trade: Single
Number of Trades: 1
The example is from GBP/JPY currency pair on H4 timeframe. The current price is at a distance of 80 pips from the 10-period Exponential Moving Average on H4 timeframe. The Trading Robot opens a short position and closes it when the price touches the same 10-period Moving Average.
Type of Trade: Single means that the Expert Advisor trades a single situation and stops. The Trading Bot must then be restarted for the next trade.
Example 2:
Trade direction: Long
Type of Trade: Single
Number of Trades: 1
The example is from EUR/USD currency pair on H4 timeframe. The current price is at a distance of 60 pips from the 20-period Exponential Moving Average on H4 timeframe. The Trading Robot opens a long position and closes it when the price touches the 100-period Moving Average.
Type of Trade: Single means that the Expert Advisor trades a single situation and stops. The Trading Bot must then be restarted for the next trade.
Example 3:
Trade direction: Short
Type of Trade: Single
Number of Trades: 10
The example is from US500 index (S&P 500) on H4 timeframe. We can choose to set the distance to the MA in Points, as this is much more convenient when trading in the Indices markets.
The current price is at a distance of 180 points from the 500-period Exponential Moving Average on H4 timeframe. The Trading Robot opens 10 short positions because Number of Trades is set to 10 and there are 10 H4 candles that meet the conditions.
The Number of Trades mode means that the Expert Advisor will open one position in each candle on the trading timeframe, which meets the predefined conditions for distance to MA. The Trading Bot closes all positions when the price touches the 500-period Moving Average.
Example 4:
Trade direction: Long
Type of Trade: Single
Number of Trades: 10
The example is from BTC/USD cryptocurrency pair on a M30 timeframe. We can choose to set the distance to the MA in USD (the Quote currency), as this is much more convenient when trading in the Crypto markets.
The current price is at a distance of 2000 USD from the 200-period Exponential Moving Average on M30 timeframe. The Trading Robot opens 10 long positions because Number of Trades is set to 10 and there are 10 M30 candles that meet the conditions.
This Number of Trades mode means that the Expert Advisor will open one position in each candle on the trading timeframe, which meets the predefined conditions for distance to MA (the open trades can be anything between 1 and 10). The Trading Bot closes all positions when the price touches the 200-period Exponential Moving Average.
This EA can be used to open multiple trades in markets which are in range.
Example 5:
Trade direction: Long & Short
Type of Trade: Multiple
Number of Trades: 1
The example is from EUR/JPY currency pair on a H4 timeframe. The Trading Robot works in a predefined trading zone - upper and lower limit of the expected range. Trade direction mode: Long&Short means that the Expert Advisor will open trades in both directions.
When Type of trade is set to Multiple the Trading Bot will continue opening positions for as long as the price is within the trading zone. Number of trades mode: 1 defines that the Robot will place only one trade for every trading situation. The EA will close the opened positions when the price touches the pre-defined Moving Average for take profit. If the price breaks out of this zone, the bot will close all current trades and will not open new ones.
Example 6:
Trade direction: Long & Short
Type of Trade: Multiple
Number of Trades: 10
The example is the same as the previous EUR/JPY pair on a H4 timeframe. The difference is in the Number of trades mode (10), which multiplies the effect of the strategy. The Trading Robot works in a predefined trading zone - upper and lower limit of the expected range. Trade direction: Long&Short means that the Expert Advisor will open trades in both directions.
When Type of trade is set to Multiple the Trading Bot will continue opening positions for as long as the price is within the trading zone. Number of trades: 10 defines that the Robot will place up to 10 trades for a single situation if the conditions for opening a position are still met on every new candle on the timeframe.
The EA will close the opened positions when the price touches the pre-defined Moving Average for take profit. If the price breaks out of the price zone, the bot will close all current trades and will not open new ones.
Example 7:
Trade direction: Long
Type of Trade: Single
Number of Trades: 1
Use Smart Stop: True
The example is from EUR/JPY currency pair on a H4 timeframe. The current price is at a distance of 30 pips from the 10-period Exponential Moving Average on H4 timeframe and the Trading Robot opens a long position. The distance between the opening level and the current 10-EMA level holds the profit of the position. If 10 EMA starts going down (led by the down movement of the current price), this distance narrows, together with the potential profit. If it reaches the opening price, the position has no more potential for profit and is already losing (as the current price is below the opening price).
If Use Smart Stop is set to True, the Trading Bot will end the position at this point, limiting the loss. Without this option, the position may generate bigger loss.
Settings
STS_MA_Distance_Bot has 5 sections in Settings. Trading Zone is where you define the Up and Down levels for trading. Entry Rules are the settings of the Moving Average, which will be used for opening positions. Take Profit holds the settings of the MA used for TP. In Orders you choose the type of positions you will open and Common holds some additional settings for you trades.
✓ You choose the trading zone (levels) in which the robot to work. If the robot breaks out of the preset trading zone, it will close all open trades and will not open new ones;
✓ You pick the timeframe of the Moving Average;
✓ You select the period of the Moving Average;
✓ You decide the distance to the Moving Average;
✓ You choose the timeframe and period of the take-profit Moving Average;
✓ You set the direction of the trades - long, short or both;
✓ You decide whether to trade one or multiple situations;
✓ The EA can open one or more than one trades for every situation;
✓ You decide the volume of the trade.