Specifiche
FLOW OF OPERATIONS - brief
· Trader insert operation into Metatrader 4 MT4-masteraccount
· MT4-masteraccount run a script that call a webpage and insert the operation parameters into a Database
· MT4-slaveaccount replicate each operation inserted by the MT4-masteraccount
FLOW OF OPERATIONS – detailed
· Trader insert operation into a Metatrader4 instance, called MT4-masteraccount
· On MT4-masteraccount is running a script (MT4-master.ex4) that on every new operation inserted do:
o send operation’s parameters to a Webpage through a WebRequest
https://docs.mql4.com/common/webrequest
o Webpage record into the Database
§ Parameters of the operation in order to replicate them through OrderSend function later into MT4-slaveaccount
§ Account number from which the operation is coming
§ Flag operations as recorded
· For each MT4-slaveaccount is running a script (MT4-slave.ex4) that do:
o through a WebRequest pick up from the Database if there is a new operation for MT4-slaveaccount (recorded but not executed)
o extract operation’s parameters from the Database
o send the order into MT4-slaveaccount composing the order though OrderSend function
https://docs.mql4.com/trading/ordersend
o flag operation as done into the Database in order to replicate it only once
· Allow multiple MT4-slaveaccount in the Database so that the operation executed by only one MT4-masteraccount is replicated to multiple MT4-slaveaccount
TO DEVELOP
5 files to implement:
· MT4-master.mq4 (commented and editable)
· Webscript master (commented and editable)
· Webscript slave (commented and editable)
· MT4-slave.mq4 (commented and editable)
· Database
MT4-master.mq4
At every tick:
· Check in the Order History if there is an open order or a new operation inserted
· If there is a new operation, for each one send it to the Webpage through a WebRequest
Webscript master
· Check on the Database if the order received from MT4-master has already been recorded (check account number and flag recorded) - maybe
· If the order has been recorded, ignore it
· If the order has not been recorded
o Send a webrequest to Webpage so that Webpage record into the Database
§ Parameters of the operation
§ Account number from which the operation is coming
§ Flag operations as recorded
Webscript slave
· Check on the Database if there is an operation with the slave account number flagged as recorded but not executed
· Extract operation’s parameters from the Database
· Flag operation as executed into the Database in order to replicate it only once
· Send back operation parameters to MT4-slaveaccount through a WebRequest
MT4-slave.mq4
· Send a WebRequest to the Webpage to check if there is an operation with the slave account number flagged as recorded but not executed
· Send the order into MT4-slaveaccount composing the order though OrderSend function
https://docs.mql4.com/trading/ordersend
Database
What is necessary to fulfill the target of the programs descripted above.
Future implementation: multiple MT4-masteraccount, matrix Masters and Slaves in order to enable/disable copy (through web dashboard), risk settings in order to use risk multipliers/lot multiplier/fixed lots.