The EA monitors the closing price of the recent candle and its distance towards Moving Average Line. If the price has been stretched too far from the MA. The EA will place a market order towards the direction of the MA.
For an instance, if a candle is closed above MA more than 80 pips, the EA will open a Sell Market position.
The EA will conclude its position in two ways;
1. The first position goes directly towards MA line and touches it, triggering an exit by the EA in profit.
2. The price goes again the direction of the first position, and the EA averages the existing trade at predetermined minimum pips; for example 100 pips.
The explanation of the setting
lot_start = 0.01; // first position lot size
lot_multiplier = 1.5; // the next lot size is 1.5x the previous lot size
magic = 2323; // ID to differentiate between chart
slippage_pips = 1; // leave as default
comment = "SpringX"; // leave as default
input string indicator_str = "=======FIRST POS SETTING=====";
ma_period = 19; // MA indicator setting
trigger_pips = 80; // The stretching distance to trigger first position
monday_allow = true; // set true to allow this day to monitor trigger for first position
tuesday_allow = true;
wednesday_allow = true;
thursday_allow = true;
friday_allow = false;
avg_str = "========AVERAGING S
input ENUM_TIMEFRAMES avg_tf = PERIOD_H1;
avg_step_pips = 100; // minimum distance to average position 2 and so on
avg_tp_pips = 10; // take profit distance from average price
input string mm_str = "=======MONEY MANAGEMENT======";
max_dd_percent = 30; // cut loss level if equity below 70%
max_positions = 10; // maximum averaging positions