“Duquesa” EA brief Two MACDs an EMA and a Trailing Stop Loss System Components The system uses 4 indicators: MACD (slow) MACD (fast) EMA on price A trailing stop based on Supertrend How it looks on screen: The slow MACD is in the bottom window. Settings 34, 144, 1. It sets trend direction and is comparatively smooth. The fast MACD is in the window above the slow MACD. Settings 12, 26, 5. In the price window are the Supertrend indicator and an 34-period EMA on price All measures from the indicators are to be taken on the close of a bar, not during a bar's development (except for the stop loss, which should execute on a cross – see below). Signal trigger BUY TRADE: 1. Long term MACD histograms must be purple 2. Price at close of candle must be above the EMA, which must be rising 3. Price at close of candle must be above the Supertrend line 4. Open a BUY trade when the fast MACD closes above its signal line if the MACD histogram is rising (purple) SELL TRADE: 1. Long term MACD histograms must be red 2. Price at close of candle must be below the EMA which must be falling 3. Price at close of candle must be below the Supertrend line 4. Open a SELL trade when the fast MACD closes below its signal line if the MACD histogram is falling (red) The EA must have the option to open a trade when signal criteria are met OR to display Alerts on screen or via email so that the user can decide whether to execute the trade. If the user executes the trade manually, the EA must still manage the trade through to exit. Part Trades and trade sizing The EA will open one trade. However, that trade is in two parts. Part 1 is a scalp trade and will close at preset Take Profit level. Part 2 will be managed by the EA in accordance with the description above. The user will determine the total lot size and the individual lot sizes that each trade makes up. So, for example, the overall lot size might be 0.6 lots, then trade 1 might be 0.1 lots and trade 2 0.5 lots. If the total of the two trade lot sizes does not equal the total lot size, there should be some kind of error message so that the user can correct the lot sizes. Trade Management Once the trade is opened, an automated initial Stop Loss should be set. The stop loss will be the level of the fast Supertrend value +/- a value in pips – see below. The initial stop loss will apply to all trades opened. Trailing Stop Loss Supertrend acts as a trailing stop. The actual value of the stop is a user-defined number of pips +/- the actual fast Supertrend value. Details below. If the user manually changes the stop loss, that must over-rule the EA. Once the user changes the stop loss whilst in trade, the EA must not change the stop loss back again! Trade exit only happens when: The stop loss is hit The user closes the trade manually A reverse trade is opened Loading the EA onto mt4 Is it possible when loading the EA onto a chart, to have a “safety period” of some kind, so that it does not start operating until after the close of the next candle? In other words, if the situation on a chart at the moment the EA is loaded would meet the trade opening criteria, it should NOT open a trade immediately, but instead wait for the end of the current candle. So, in summary, at the end of each candle, if the EA settings are such that all indicators are used, the EA should ask itself (for a buy trade): 1. Is the slow MACD rising (purple)? If YES, 2. Is the fast MACD rising (purple)? If YES, 3. Is the fast MACD above its signal line? If YES, 4. Is the price above the Supertrend line? If YES, 5. Is the 34 EMA rising (green)? If YES, 6. Is the price above the 34 EMA? If YES. 7. Open a buy trade and close any sell trades. and vice versa for a sell trade. EA settings The EA should contain the following settings that can be changed by the user: Name Description Comment Default setting EMA 34 Use EMA to qualify signal? TRUE Supertrend settings Period 10 Multiplier 1.7 Timeframe current Fast MACD settings Use fast MACD? TRUE Fast EMA 12 Slow EMA 26 Signal 5 Slow MACD settings Use slow MACD? TRUE Fast EMA 34 Slow EMA 144 Signal 1 Lots and sizing and trailing stop loss Description of trailing stop loss As a trade is opened, a Stop Loss is set. The level of the stop loss will be the value of Supertrend plus/minus an additional distance in pips from the Supertrend value. The actual value of pip distance could be positive or negative. If it is positive, it is ABOVE the Supertrend value. If it is negative, it is BELOW the Supertrend value. (This allows flexibility in the settings of Supertrend). As the value of Supertrend moves, so too the trailing stop loss moves, always by the same distance away from the Supertrend. Exit on a cross of the stop loss value, not on a close at the end of a candle. Use Initial Stop Loss? TRUE Additional distance Pips +/- Supertrend value for BUY trades 5 Pips +/- Supertrend value for SELL trades 5 Total Lot size User set only, not automated 0.03 Trade 1 lot size If 0, trade 1 is ignored 0.02 Trade 1 TP pips Take Profit at... 7 Trade 2 lot size pips If 0, trade 2 is ignored 0.01 Trade 2 is managed by the EA as described in the text Signal ALERTS Show Alert on screen? True/False FALSE Send Alert by email? True/False TRUE TIMES Start time If 0, it trades 24/5 Allows the user to manage the times the EA will open a trade. For example, if the user only wants to use the EA to send email alerts during the European session, it is possible to do so from the EA settings. 0 Stop time Allows the user to manage the times the EA will stop looking for trades 0 Magic number (I suppose we need one?) Max. slippage In pips 3 Trade Examples: I have tried to show some marginal trade setups in the following charts.... Trade 1 is NOT a buy trade because the 34 EMA is falling. Trade 2 is a valid sell trade. If Trade 2 is stopped out, then Trade 3 is a sell trade. Trade 4 is a valid buy trade. Trade 1 is a valid buy trade. Trade 2 is a valid sell trade. Trade 3 is a valid buy trade. Trade 4 is a valid sell trade (just!) Trade 5 is a valid buy trade. Trade 6 is a valid sell trade. Trade 7 is NOT a valid buy trade because the slow MACD is red. It opens a few bars further on (under the sign on the chart) Trade 1 is valid Trade 2 is valid Trade 3 is valid Trade 4 is NOT a valid buy because the price is below the Supertrend Trade 5 is valid Trade 6 is valid (just!) Trade 7 is valid Trade 8 is valid Trade 1 is valid Trade 2 is valid Trade 3 is not valid as the 34 EMA is red (falling) Trade 4 is valid Trade 5 is not valid as the 34 EMA is red (falling) Trade 6 is valid Trade 7 is valid