Hello! I am wondering how I can allow my script to work on multiple pairs. I know that scripts are limited to the pair you start them on, but there must be a way to automatically get the Symbol of a pair when you know which pair you want.
E.G I know I want "EURUSD" but my graph is on "GBPUSD". I have the symbol index position of "EURUSD" via the following code:
However, I don't know how to get the symbol of that pair to make a MqlTradeRequest to open a position for it.
Alternatively, if there is a way to open a position on a pair without the use of said pair's symbol, that would be ideal.
Thanks in advance for the support.
Er... in your code, your 'pair' variable contains the symbol you want, so you can use that to make a MqlTradeRequest.
If you need the findPairIndex() function to verify that your 'pair' refers to a valid/existing symbol, then any return value other than -1 should be a good indication.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello! I am wondering how I can allow my script to work on multiple pairs. I know that scripts are limited to the pair you start them on, but there must be a way to automatically get the Symbol of a pair when you know which pair you want.
E.G I know I want "EURUSD" but my graph is on "GBPUSD". I have the symbol index position of "EURUSD" via the following code:
However, I don't know how to get the symbol of that pair to make a MqlTradeRequest to open a position for it.
Alternatively, if there is a way to open a position on a pair without the use of said pair's symbol, that would be ideal.
Thanks in advance for the support.