I need some changes/additions to the attached Martingale-based EA. It opens a series of trades, each trade has a lot size larger than previous (defined by Booster var.) with TP moved to the TP of the newest trade in series.
1. Right now EA is opening trades in one direction, defined by user at start and closes after the last trade is closed (one series of trades only). I want EA to open trades continuously, according to major trend defined by EMA line: if a current price is above EMA line, open only BUY and vice versa. Once the last trade in series is closed, start new series with the initial lot size.
EMA line should be defined by variable EMAperiod, the timeframe is the same as on chart
2. I need the following protection options:
- close all losing trades when price crosses the EMA line with variable EMAcrossTolerance - number of pips above/below the line that will be tolerated, basically I want EA to change direction of the trades when price crosses the EMA line and starts from trade No.1
- ProtectionPriceRange (optional) - close all losing trades when the range of the current candlestick (timeframe of the candlestick defined by PriceRangeMinutes) gets more than set number of pips (PriceRangePips)
for example: if price range of the 1min candlestick becomes more than 20 pips, close all losing trades immediately (if any)
- ProtectionATR (optional) - allow trading only if ATR is between set number of pips - with variables ATRtimeframe, ATRperiod, ATRmin, ATRmax
3. Indicators to be added:
- EMA line (orange, thicker than default)
- PriceRange in pips - if ProtectionPriceRange is on (sky blue, bottom left)
- Current ATR