How to avoid correlated pairs
-
If there is an open trade "EURUSD" how can you prevent it from being opened in other pairs that contain the same "quote" or "base"?
-
this will take a bit of work but before opening a trade you can loop through running trades, get the symbol with OrderSymbol(), strip it down to quote and base, do this with the trade symbol, then compare before placing the trade or not.
-
@jstap Just curious. Would there be any option to do that WITHOUT custom code?
-
Not that I know of, generally this type of code is what's in the light pink blocks, just not that, so a for each block, with OrderSymbol() in a modify variable block, will give you the symbol of the last loaded order. But then you would have to split it in 2, and if your symbol has extra letters it would fail. When I get a minute I will put something together.
-
This is quite hard to back test but this should do it: https://fxdreema.com/shared/I9PjwP3xd
-
@jstap Very interesting. Thank you.
-
Thank you very much, I'll try it.
-
@jstap It does not work
-
I haven't looked at this for a while, this should do it, works on backtest but is only 1 symbol: https://fxdreema.com/shared/P9WAmCK1d
-
@jstap I have checked it in demo and it does not work, does not open in any pair
-
It did for me
-
@jstap If it works if you have the same quote or base but it does not open operations in pairs that have different (quote or base)
-
Open operation in EURUSD, it does not open in correct USDCAD, but it does have to open, for example, CHFJPY.
-
In EURUSD EUR is the quote and in USDCAD USD is the quote, so I do not see how this makes a difference. All this is doing is checking if the current symbol is different to running trades regardless of the base/quote starting value.