Selective multi currency EA
-
Hello,
What i try to do is to trade on multiple currencies but only when there are no trades in similar pair.
For example if a trade occurs in EURUSD i will only make it if there are no other open trades on pairs that include the EUR or the USD like EURGBP or USDJPY.
Thank you -
@christarola this should work ,will only open one of the listed pairs 0_1580714756152_voorbeeld.mq4 the
-
@kop That would mean that you trade all the stated pairs within the EA. For simple strategy that might work well, but with more complex ones probably one have to be very certain what EA will do when.
@christarola The alternative would be, that if one prefers 1 EA instance per chart, to update global variables on each transaction such as trade open and trade close (pending orders would special to take into consideration). Assuming you create a global variable called EUR and one USD. In case of a EURUSD trade, you would set both variables to 1. If that trade is closed you would set it to 0.
Berfore opening a EUR or USD related trade you might check before opening if the global variable is < 1.
There are some pitfalls regarding trading actions such as close trade when EA casely or or not is not active.An easy way to extract the currencies involved is using the marketinfo data like this ...

-
@trader-philipps Thats a nice solution but im missing some parts of it.So lets say i create a global variable for every currency (EUR,USD,JPY,GBP,.....,) then how do i make the condition on open and close trade to check if the base or quote currency i want to trade equals to a variable in order to change its value to 0 or 1. Could you give me an example because im still a newbie.