1) does it create problems using too many "if" in an EA?
No
2) if I put a "return" after any of the following "if", that "if" if executed will finish the whole EA (i.e the E.A ends there)?
Yes, unless the return is in a function.
Rewriting the above:
if(Symbol() == "USDJPY") factor = MarketInfo(Symbol(),MODE_BID);
if(Symbol() == "USDCHF") factor = MarketInfo(Symbol(),MODE_BID);
...and so on.
Or simply
factor = MarketInfo(Symbol(), MODE_BID);

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
Hi guys,
I need to write the coding for the following task. I would be very thankful if you can rewrite it in some clear way. By the way, I have 2 questions related:
1) does it create problems using too many "if" in an EA?
2) if I put a "return" after any of the following "if", that "if" if executed will finish the whole EA (i.e the E.A ends there)?
Here is the code:
int type1 = StringFind(Symbol(),"USD",0);
int type2 = StringFind(Symbol(),"JPY",0);
int type3 = StringFind(Symbol(),"CHF",0);
int type4 = StringFind(Symbol(),"CAD",0);
int type5 = StringFind(Symbol(),"GBP",0);
int type6 = StringFind(Symbol(),"AUD",0);
int type7 = StringFind(Symbol(),"NZD",0);
if(type2==3)
{
factor=MarketInfo("USDJPY",MODE_BID);
}
if(type3==3)
{
factor=MarketInfo("USDCHF",MODE_BID);
}
if(type4==3)
{
factor=MarketInfo("USDCAD",MODE_BID);
}
if(type5==3)
{
factor=MarketInfo("GBPUSD",MODE_BID);
}
if(type6==3)
{
factor=MarketInfo("AUDUSD",MODE_BID);
}
if(type7==3)
{
factor=MarketInfo("NZDUSD",MODE_BID);
}
I would use this "factor" number in a Script to calculate order size and launch orders automatically for every pairs. So following the above sentences will be the script to define trade conditions and trade launch.
Again, thank you very much!