工作已完成
指定
I hope someone will agree to program a not very complicated EA for me (deliver source code). The text below is the requirements specification.
--------
I will give you the source code (.mq4) of a freely available ribbon indicator. The indicator draws a ribbon from a fast and slow MA and colors the inside of it according to slow MA direction. When I will be using the EA, I will load the EA on the chart already having this indicator. The EA will take the timeframe, price, etc, from the indicator. I will control these settings from the indicator input.
The EA will recognize the indicator on the chart automatically by file name. The inputs should have a space to write down the file name. If the EA canot find the indicator, the EA will remove itself from the chart (so I will know there was a problem).
The EA will open one trade at a time. The trading signal will be a cross of the two MAs (fast over slow for up, slow over fast for down, as usual) on or before candle close. The EA shall confirm a cross only at the close of each candle, to avoid issues with repainting. When the cross is confirmed, the trade will be opened at the next open. The EA will only trade in the direction of the trend (buy if up, sell if down).
When the cross in the opposite direction is detected, the EA will close the active trade and will place one in the opposite direction. There should always be one active trade in the direction of the trend as determined by the indicator until the EA either exits by itself or is manually removed from the chart. Close of previous/open of next trade will happen immediately one after the other at the open.
The user will input the trade size in lots. All trades will be the same size.
The EA will have an internal counter of how many trades have been closed since the EA as loaded on chart. The user will specify maximum number of trade pairs (one buy and one sell, no matter which one comes first). When the EA reaches this number of pairs closed, it should cease operation and remove itself itself from chart. If for this a magic number is needed, you can add it, but if not, I do not require it.
There needs to be an input for a maximum drawdown value. The EA will record internally the total of profit/loss of all closed trades since it was loaded on chart. This number will be updated after each close. To that number, the P/L of the open trade will be added (updated in real time). When the sum of these two becomes negative and its absolute value >= maximal drawdown, the EA should close the open trade, cease to operate and remove itself from the chart. That's an account level SL. No TP or SL for individual trades needed.