I trade multiple pairs with a automated signal provided from another platform.
Existing method: when mt4/mt5 receives the buy or sell signal it will execute the order automatically. But it doesn't close the previously running position in the same pair.
Requirement:Script should work @ each order is executed(buy/sell).
Only one trade will be there per symbol at any point of time. if mt4/mt5 receives a signal it will execute the orders. Now script will check for more than one order in any symbol. If there is more than one order in a symbol the script should close the older order.
For example: if mt4/mt5 receives a sell signal it will be executed automatically. now the script should check for the more than one order condition in that symbol if there is more than one trade (Sell executed now and a buy is running already and its a older order) the script should close older orders and the latest should be active and running.
NOTE: need this script in both mt4 and mt5