string Max_EMA = MathMax(USD_EMA,JPY_EMA);It return a double value, not a string value, but you need a string (that is a name of currency pair) in this part, no?
double USD_EMA = GetEMA("EURUSD", 100); double JPY_EMA = GetEMA("USDJPY", 100);
Unless the chart is that specific pair/TF, you must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forumstring Max_EMA = MathMax(USD_EMA,JPY_EMA);
Naguisa Unada is correct. MathMax returns a double not a string. You could usestring Max_EMA = USD_EMA > JPY_EMA ? "EURUSD" : "USDJPY";
but what's the point? EURUSD is a pair ranging 1.1-1.5. USDJPY is a pair ranging 74-124. The comparison will always be JPY.total=OrdersTotal(); if(total<1)
Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forumticket=OrderSend(Max_EMA,OP_BUY,1,Ask,3,0,0,"ma sample",1234,0,Green);
This is why I recommendDo not trade multiple currencies in one EA- You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems, e.g. A problem with iBarShift - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 2
- Code it to trade the chart pair only. Look at the others if you must. (Don't assume that Time[i] == iTime(otherPair,tf, i) always use iBarShift.)
- Then put it on other charts to trade the other pairs. Done.
- You are not adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.
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
I find the highest value and find the name of the pair by comparing the EMA.
What's the problem with the code below?
There is a warning to ‘ implicit ’ from ‘ number ’ to ‘ string ’.
Is there any kind of a function that can be found out from any pair?