MACD Strategy (v2) Denbert White, June 2020. Summary A fully automated robot, that will open and close trades based on the parameters set out below. Preferably only trade with the trend (buy in an uptrend and sell in a downtrend). The 200EMA will be used to identify the trend. Use the MACD signals to open trades. Preferably only buy when the MACD buy signal occurs below the zero line and only sell when the MACD sell signal occurs above the zero line. The Stop loss will be based on the trailing ATR Stop Loss indicator when the signal occurs. The Take Profit will be based on a coefficient of the Stop Loss. The coefficient will be decided based on the Risk to Reward ratio chosen by the user. A first version of the EA has been created and this is/can be based on that. All questions are intended to be aimed at the user. All ‘Select from the following options’ are intended to be options that the user can choose from. All ‘Explanations’ are intended to explain to the programmer the intention of whatever is being explained. ‘Default’ is intended to be the option automatically selected by the EA. Signal Settings MACD Standard Settings: 12, 26, 9. There should be an option to choose the numbers in the settings of the MACD. Based on the close of the candle. Question for the user: How far do you want to shift the candle the signal is taken from? (Mandatory.) Explanation of shift for programmer: This will be how many candles back the signal will be taken from. 0 for current, 1 for previous, 2 for one before that, and so on. Include free text box with number. (Default = 1.) Trend Trade with the trend? User will select from the following options from a dropdown box: Yes, No. Explanation of the options: No. Then remove this filter from the decision making process. Open positions regardless of the direction of the trend. Yes. Then follow the next steps. (Default) How do you want to identify the trend? User will select from the following options from a dropdown box: Moving Average. Period? Free Text Input Box: Numerical input only. (e.g. 50, 100, 200 etc). Default = 200. Type of Moving Average? Select from the following options: Simple, Exponential (default). (Others may be added at a later date.) Explanation of the Options: Simple/Exponential: Use the standard settings for these as default for now with no option to change them. Candles (or the points on the Moving Average) to compare to determine the trend: 2 separate numeric free text boxes. If [candle in box 1] < [candle in box 2], then the trend is down If [candle in box 1] > [candle in box 2], then the trend is up (Defaults: Box 1 = 1, Box 2 = 20.) Zero Line Filter Use a zero line filter? Select from the following options: Yes, No. (More options may be added later.) Explanation of the options: No. Signals will be accepted regardless of where they occur on the MACD Yes. Buy Signal will only be accepted if it occurs below the MACD zero line. Sell signals will only be accepted if they occur above the MACD zero line. (Default.) Positioning Position Sizing How do you want to choose your position size? Select from the following options (dropdown box): Lots, Percentage of Account Balance. Explanation of the options: Lots Use lots as written in free text box below by user Percentage Use percentage of account balance as written in the free text box below by user. (Default.) This should be calculated as [Balance x percentage chosen]. E.g. £1000 x 2% = £20. Free Text Boxes for the options above. Trade Limits Do you want to limit the number of positions the EA can open? Select from the following options: Yes, No. Explanation of the options: No. Do not limit the number of positions the EA can open Yes. Then follow the next steps. (Default) Free numeric text boxes next to the following options Max number of open buy positions at one time? (Default 5) Max number of open sell positions at one time? (Default 5) Max number of total open positions at one time? (This can be a combination of the two above.) (Default 5) Once the number has been reached do not allow any further respective positions to be opened. ‘Total positions’ will be the most important option. Direction of Positions Which direction you want to trade? Select from the following Options: Buy, Sell, Buy and Sell. Explanation: Buy. Open Buy Positions Only Sell Open Sell positions only Buy and Sell Open buy and sell positions (Default) Spread Management Do you want to limit trades based on the spread? User will select from the following options from a dropdown box: Yes, No. Explanation of the options: No. Allow positions to be opened regardless of the spread Yes. Then follow the next steps. (Default) Limit trades if the spread is <=: Free text box. (Default 1) Explanation: If the spread is greater than or equal to this number, then do not open new positions. Risk Management Stop Loss Do you want to use a stop loss? Select from the following options: Yes, No. Explanation of the options: No. Do not use a Stop Loss Yes. Then follow the next steps (Default) How do you want to calculate your Stop Loss? Select from the following options: Fixed amount of Pips, Recent High or Low. Explanation of the options: Fixed How many pips to set the stop loss at each time Recent Hi/Lo Check the last [to be chosen by user] number of candles, find the lowest/highest point. Set the Stop Loss there plus – (Default) Select from the following options: Nothing, Fixed number of pips, [0.5 or another number to be chosen by user] x Average True Range (of candle where the signal occurred). Explanation of options: Nothing Do not add anything to the initial Stop Loss. Fixed Fixed number of pips to be added/subtracted to/from the SL depending on the direction of the trade. Multiple of ATR. Multiply the ATR of the candle where the signal occurred by this number, then add/subtract to/from the Stop Loss, depending on the direction of the trade. (Default = 0.5) Individual Free Text Boxes for number of pips and coefficient of ATR to use Profit Management Take Profit Do you want to use a Take Profit? Select from the following options: Yes, No. Explanation of the options: No. Do not use or set a Take Profit Yes. Then follow the next steps (Default) How do you want to calculate the take profit Select from the following options: Fixed number of pips, Risk to Reward Ratio (Default), Trailing Stop Loss Explanation of the options: Fixed Set number of pips when profit should be taken Trailing Either don’t set a Take profit, or set the take profit so big it will not be triggered before hitting the trailing stop loss (e.g. multiply by 10). Then have the trailing stop turn into a trailing take profit Risk Reward Ratio chosen by the user. The number of pips the stop loss has been set to will be multiplied by this number to set the take profit. (Default = 1.5) Free text box for each option above for the user to choose. Break Even Do you want to use a break even stop? Select from the following options: Yes, No. Explanation of the options: No. Do not use break even Yes. Then follow the next steps (Default) How do you want the Breakeven to be triggered? Select from the following options: Fixed number of pips, Ratio (Co-efficient of Stop Loss). Fixed How many pips in profit the trade should be to trigger the break even Ratio This should be based on a coefficient of the Stop Loss. The number of pips from the open of the position to the stop loss will be multiplied by this number to get the point where the break-even should be triggered. (Default = 1:1) How do you want to calculate the where the stop loss is moved to? Select from the following options: Fixed number of pips, Ratio (Co-efficient of Stop Loss). Fixed Fixed number of pips to move the SL to. Ratio This should be based on a coefficient of the Stop Loss. The number of pips from the open of the position to the stop loss will be multiplied by this number to get the point where the SL should be moved to. (Default = 1:0.1) There should be a free text box for both of these. Free text box to enter where the Stop Loss should be moved to. Trailing Stop Do you want to use a trailing stop? Select from the following options: Yes, No. Explanation of the options: No. Do not use a Trailing Stop Loss (Default) Yes. Then follow the next steps When do you want your Trailing Stop to start? Select from the following options: Fixed number of pips, Ratio (coefficient) of Stop Loss Explanation of the options: Fixed. The trailing stop will start when the trade is this many pips in profit. Ratio. The trailing stop will start when the trade is in profit by a ratio/coefficient of the stop loss the user chooses here. Multiply the stop loss by this to calculate (Default) How do you want to choose the number of pips behind the price that you want the trailing stop to follow by? Choose from the following options: Fixed number of pips, Ratio of stop loss. Explanation of the options: Fixed. The trailing stop will trail behind by the number of pips the user chooses here Ratio. The trailing stop will trail behind by a ratio/coefficient of the stop loss the user chooses here. Multiply the stop loss by this to calculate (Default) Do you want to use steps? Select from the following options: Yes, No. Explanation of the options: No. Do not use a step trailing Yes. Then follow the next steps How many pips do you want to step each time? Free text box for the user to enter the number of steps to go up by each time. Other Settings Magic Number Free Text input box: If text input is possible then use Alpha/numerical input. If not, Numerical input only. The user should be able to edit this. Comment. Free text to appear on the trade comments section. When to Trade (this may not be needed). Choose the time and days you want to trade. Update the Following Options Time Hour Start: 0 – 24 Minute Start: 0 – 60 Hour End: 0 – 24 Minute End: 0 – 60 Days Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday. Select from the following options next to each day: Trade, Do Not Trade. 2