Техническое задание
i will need a set of 2 EAs, based on EA codes I have (see at the end):
one will be used as a controller (ControlEA), the other one will be activated on multiple charts (ExecuteEA)
My principe is that I want to open all the trades on the ExecuteEAs at the same time, as well as closing them at the same time
to do so, the ControlEA will use a boolean global variable: TradeNow
the ExecuteEA should only have 1 trade at the same time, and only work with the ControlEA using the same magic number
if the global variable doesn't exist, it needs to be created and set to False by default
if the ExecuteEA sees TradeNow , then it need to open a trade, according to the direction defined by the ControlEA
the direction can be Forward Reverse None and change every hour
The actual direction will be set in a global variable called TradeDirection, so all ExecuteEA will trade according to this as choices
-Trading Directions-
Hour-0 Forward Reverse None
Hour-1 Forward Reverse None
Hour-2 Forward Reverse None
Hour-3 Forward Reverse None
...
the direction of the trade is then interpreted by the Indicator 3_level_zz_semafor in M5
if the last point (with reference 3) is higher than its previous, then a Buy should occur in Forward mode
a Sell in Reverse mode, and of course nothing in none
also before making a trade a call should be made by the ControlEA by a webrequest to a page (should exist as a parameter CheckAI )
if the page return OK then the trade should occur, otherwise a KO will be sent, and the trading should be ignored until next Tradenow instruction
per instance CheckAI parameter http://www.blah.com/checkai.php?pair=
the ControlEA should add the pair behind , EURUSD
if no parameter CheckAI is set, consider it OK or true by default, otherwise his timeout should be 30 sec
When the TradeNow is set to True, every ExecuteEA should open a trade, the ControlEA will then change the TradeNow status back to False after one minute.
Lot Size
the lot size should be set by the ControlEA, either by a fixed lot (i.e. 0.01) or by a percentage of the BALANCE expressed in decimal (by the ammount to have 1 lot, ex. 2500)
it will then again be set in a global variable to be used as such by all the ExecuteEA
-Closing Strategy- TODO by the ControlEA
the closing of all the trades will be done by the ControlEA, then it will close the trades with the same Magic.
when the ControlEA has no open trade anymore, wait a few minutes (should be set as parameter CoolDown
in minutes, 0 would mean immediate), then start the trading again.
the closing from the ControlEA should be set by
Manual (as a button in the chart, Close All)
% if positive expressed in decimal (ex. 1.2)
positive money ammount expressed in decimal (ex. 110.22)
% if negative expressed in decimal (ex. 1.5)
negative money ammount expressed in decimal (ex. 112.22)
a time expressed in seconds, if the trading exceed this time, all the positions should be closed (ex. 122secs)
if any of those is set to 0, then don't use it.
-----
the other parameters in the ControlEA are
StatCall parameter of a PHP page, which (if not blank) should be called every 5 minutes and adding ?PL= NumberOfTrades= Comment= Magic= StartTrade=
ex. http://www.stat.com/Log.php
StartTrade would be the time of the last TradeNow
Comment comment of the trades
FridayStop time time after which on friday, no new TradeNow should occur, if there is still a trade open, don't close it.
Running parameter true per default, if set to false, don't make any trade, otherwise operations should be made according to the process
a button with two states should be put on the chart, to control this
-----
in the charts, I'd like to display the following infos:
ControlEA
Active Trades : (active trades using the same magic number)
Combined P/L : (sum of active trades using the same magic number)
Magic : (Magic Number)
Active Direction : (Forward, Reverse, None)
Active Hour :
Targets
ExecuteEA
Magic : (Magic Number)
Active Direction : (Forward, Reverse, None)
Detected Direction : Buy Sell
-----
in the case of a backtesting, just for the ExecuteEA
I will need to be able to define a trading direction depending on the hour,
Hour-0 Forward Reverse None ...
Hour-1 Forward Reverse None ...
the TradeNow would occur every 15 minutes (and only one trade should open at once) 0 15 30 45
a parameter should be set to close the trade after x minutes
lot can be fixed to 0.1
---
Actually I've the source codes for
Close on Equity EA
Trend detection EA with the indicator embedded with the hours
Calls with WebRequests