Техническое задание
Using the following EA:
https://www.mql5.com/en/code/319
Create the following entrance and exit scenario:
Remove (actually comment out) all "voting" code on long, short buy, sell close
Add the following:
Input int MaxTrades = 5 // default
input int OpenLongAt = 100; // default
input int OpenShortAt = -100; // default
ATRStopLossMultiple = 1; // default
input double CapitalPercent = 2.0;
always use 2% of available Margin - default interpretation: using ATR, calculate backwards how many lots can be bought or sold for 2% of available margin
Coding interpretation:
Use all of the existing code, comment out what is not needed. No deletions of Wizard generated code, please!
use int openTrades to count trades up to MaxTrades
Always only trade in one direction. Close all Trades before looking for the next Open Long or Open Short trade.
Long Trade Interpretation
CCI must pass from below 100 (OpenLongAt) to above 100 to generate a Long Trade.
It is possible that the CCI Index will oscillate up and down above and below 100. This is OK. Pick up additional trades to a maximum of MaxTrades every time the CCI Index passes from below, to above 100 (OpenLongAt).
To close a Long Trade, the CCI Index must pass below 100, then through 0. When the CCI Index finally passes below 0, close all open long trades.
Short Trade Interpretation
CCI must pass from above -100 (OpenShortAt) to below -100 to generate a Short Trade.
It is possible that the CCI Index will oscillate up and down below, then above -100 (OpenShortAt). This is OK. Pick up additional trades to a maximum of MaxTrades every time the CCI Index passes from above to below -100 (OpenShortAt).
To close a Short Trade, the CCI Index must pass above -100 then throug 0. When the CCI Index finally passes above 0, close all short trades.
Source code will be required upon payment of the final product.