Техническое задание
EMA Threshold
Using an Exponen-al Moving Average (Length and Source user defined), create an EA with the following
specifica-ons:
a. Entry Points:
The user can define a THRESHOLD (in $) – let’s say 11$ on US30.
- Long Entry: Open a long trade and close all short trades when the price crosses over the EMA value + THRESHOLD which is 11 USD (user defined). For example, EMA = 33200 and the price crosses over that value (EMA), as soon as the price crosses over 33211 a long posi-on is opened, and all short posi-ons are automa-cally closed.
- Short Entry: Open a short trade and close all long trades when the price crosses under the EMA value - THRESHOLD which is 11 USD (user defined). For example, EMA = 33200 and the price crosses under that value (EMA), as soon as the price crosses under 33189 (33200-11) a short posi-on is opened, and all long posi-ons are automa-cally closed.
b. Trades, Lots, Stop Loss, and Take Profit:
- The EA should allow up to 3 parallel trades with the ability of disabling trade #2 and / or trade #3. These trades should be executed in the order of priority: Trade 1 (highest), Trade 2 (second), Trade 3 (third).
- For each trade, users should be able to define specific LOTS.
- For each trade, users should be able to define specific take-profit points. If the take-profit is set to zero, no take-profit point will be set.
- Users should be able to enable a trailing stop (pips based) on each trade individually. This should be ac-vated when the price moves in the trade direc-on with a certain pips value and then follow the price using a user defined trailing step.
- Stop loss should be automa-cally calculated and entered using EMA and the user defined THRESOLD. Example: for the long posi-on described above (opened at 33211) should have a Stop loss at EMA – THRESHOLD (33200-11=33189). Example for the short posi-on described above, opened at 33189 (33200-11) this posi-on should have a stop loss set at EMA + THRESHOLD (33200+11=33211)
c. Trade Closure:
When a short condi-on is met, all open long posi-ons should be closed immediately before opening short posi-ons, irrespec-ve of their profit or loss posi-on. The same applies when a long condi-on is met, where all short trades are closed before opening long trades.
d. Control Measures:
The maximum number of trades that can be opened at any given -me is three (user defined input).
The EA should also have a user defined trading interval (i.e. ability to define the trading interval in such a way that the EA trades only Mon-Fri between 09:00 CET to 22:00 CET)
As a last request I would like to add the following:
I want the EA to count the trades made and distinguish them into winning and losing trades. This can be done (in my opinion) in two ways:
Variant 1: to keep track of the trades that reached the TP
Variant 2: to remember the trades that were closed at TP or manually on profit.
*in my opinion the best option is to calculate/remember the trades that were closed on profit (any value greater than 0)
Here we want to have a function where we define a number (greater than 0).
example: if we select 1 it means that the EA will work until we have a trade closed on profit (taking into account lost trades).
concrete example: we have 3 consecutive trades with SL, followed by 4 consecutive trades with TP/closed on profit. This is the case where the function we discussed above is activated, i.e. selecting variable 1.
if we have 3 consecutive trades closed on SL followed by 5 consecutive trades closed on TP then the result is 2.
And so on...
This is the functionality of this variable.
I gave the example of consecutive trades, but they may not be consecutive, in which case this rule works until it is fulfilled.
This means that the EA in some cases may work for 1 hour or 2 hours or 30 min or even the whole day. The EA will work until it fulfils this condition: the essential condition is that the number of trades closed at TP/manual on profit is higher than the number of trades closed at SL.
When the rule has been fulfilled the whole EA must stop executing any trades, then restart the second/third day (in case of weekends) under the same conditions.
Thanks,