It can be done - I've been doing that all the time, just that you cannot hard-code your input variables. Consider using global variables, named with the pair as prefix or suffix. Another option is to draw horizontal lines on the chart itself to indicate where you want the S/L and T/P to be.
Ask and Bid will give you pair-specific values, no issue there. However, your global StopLoss variable will be shared by the EA running on EURUSD and the EA running on GBPUSD. To differentiate the StopLoss value, you should consider having two global variables - each prefixed or suffixed with the pair's name.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey guys,
I'm new to trading and I'm still in the process of figuring out how MT4 & MQL4 work. I've wrote a little EA that, if tested on one pair, executes as intended but if I use the same EA across 2 or more pairs, the S/L and T/P get messed up big time. For example, if two sell orders happen back to back on two different pairs, the S/L is the same for both even though the prices are different. I'm using the same input variable values for both pairs so my question is, can the same EA be used across multiple pairs or is that a thing I shouldn't be doing?
I've attached a screenshot of the erroneous S/Ls.