METATRADER 5 EXPERT ADVISOR (.mq5 file) FOR TRADING IN HEDGE ACCOUNT SCOPE * The EA must be delivered in .mq5 file format to be compiled by the end user. * It may support only the following MT5 indicators: AMA, VIDYA, SMA, EMA. Up to three indicators on the same chart. * The main strategy to be used is: * MEAN REGRESSION - opening a position against the trend when a customized spread in pips is reached between MA indicator and last tick value. * It should allow only long positions OR only short positions OR both. * It must have different parameters for long and short positions. * It must be able to make incremental entries at loss as the deviation from MA or from the opening tick increases. * Besides a fixed amount of pips, a customized spread between MA and last tick must be used as a trailing stop, both a positive and a negative value should be supported. * It must have a “trade pausing” parameter (in seconds) after a trade loss or gain. * It must have time parameters for starting the trades, prohibiting new entries and closing all open positions. * It must be capable of inhibiting new entries previously to “red” or “yellow” economic data release in the MT5 calendar for a given country. Time before and after data release should be entered. Nevertheless, news should be ignored by default. * It must have the option to not open more than one position on the same candle. That is, once set, it should wait for a new candle opening before initiating a new position disregarding if trade conditions have already been met. * It must plot the line(s) for the indicator(s) in use on the chart. * It must show a dashboard displaying the following features: * magic number * setup name * position side, size and profit/loss on the current trade * if the EA is on hold and time until its release * the balance of all trades in the session * sum of all entries and exits of the current session * the spread between the last tick and the MA indicator in use * time in seconds until next candle opening * button for closing all open positions * button ON/OFF * if possible, add an incremental/decremental field for next position size * It must have the following parameters: * chart timeframe * inhibiting trades before red and yellow economic data release * select countries (only the three bellow) * Brazil * USA * EU * select relevance of data releases * only red data releases * both, red and yellow data releases * times * time before data release for prohibiting new entries * time before data release for closing all open positions * time after data release to start allowing new entries * allow more than one entry per candle * default: prohibit * trading times * starting * stopping * shut down * order type * at market * OR fixed price * order clearing * FOK * order expiration time in seconds * positions allowed * long * short * both * MA of choice * setup values for the supported MAs (AMA, VIDYA, SMA, EMA) and “reset to default values” option * should support up to three MAs at the same time * position settings (long and short apart) * position size * entry and exit signals * customized buying and selling signals by using variables and operators (described later) * Ex. (buy when:) ama1[0] - tl (tick last) >= pA( pips variable A) && (and) tl (tick last) < cl[1] (candle low from previous bar) || (or) tl < cB (currency variable B) * customized closing signal also by using variables and operators * Ex. (close when:) ama1[0] - tl (tick last) < pC (pips variable C) && (and) tl (tick last) > op (open position price) || (or) ama1[0] - tl (tick last) >= pB (pips variable B) * stop loss by using one of the currency or pips variables * target price by using one of the currency or pips variables * trailing stop * in pips or currency variables * starting point from position entry * spread in pips variable * OR spread between MA and last tick, in pips variable (should support negative value) * input pips variable * break even * in pips variable * trigger * stop * hold trades after a loss (in seconds) * hold trades after a gain (in seconds) * make new entries to current position at loss (up to six entries) * for each entry: * set volume * input pips variable for spread from entry tick * OR input pips variable for spread from MA[n] * variables inputs * in pips, ten of each * in currency, five of each * balance targets * Maximum balance loss for the day, in currency variable * Target balance gain for the day, in currency variable * backtest * account initial budget setting * option of withdrawing all gains that exceed initial budget * option of stop testing if account gets depleted VARIABLES * MT5 indicators (the four MAs up three of each): ama1[n], ama2[n], ama3[n], sma1[n], sma2[n]... * open position tick: op * tick last: tl * tick bid: tb * tick ask: ta * ten variables for pips: pA, pB…pJ * five variables for currency: cA, cB…cE * candle low: cl[n] * candle high: ch[n] * candle open: co[n] * candle close: cc[n] * candle length: clength[n] OPERATORS * percent: % * divide: / * multiply: * * add: + * subtract: - * major: > * minor: < * major or equal: >= * minor or equal: <= * equal: = * different: != * logical operator AND: && * logical operator OR: ||