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
... in this part of code is a problem with new compilation (error ---> 'MarketInfo' - illegal switch expression type) perhaps it was all OK until the update to MT4 build 600+ ... but since then it doesn't work any longer.
So, could you please post some newer version ... if of course you're still around.
I think if you change
switch ( MarketInfo( strSymbol, MODE_DIGITS ) )
to
It will compile ok
... in this part of code is a problem with new compilation (error ---> 'MarketInfo' - illegal switch expression type) perhaps it was all OK until the update to MT4 build 600+ ... but since then it doesn't work any longer.
So, could you please post some newer version ... if of course you're still around.
https://book.mql4.com/operators/switch
"The values of Expression and of Parameters can only be the values of int type. The Expression can be a constant, a variable, a function call, or an expression. Each variation 'case' can be marked by an integer constant, a character constant, or a constant expression. A constant expression cannot include variables or function calls."
Once again, you come up with a simpler and better solution.
In my different EA, it's write like this :
extern double Risk_Percent = 3;
extern int StopLoss = 50;
//+------------------------------------------------------------------+
{
double lot = MathCeil(AccountFreeMargin() * Risk_Percent / 1000) / 100;
if(lot<MarketInfo(Symbol(),MODE_MINLOT))lot=MarketInfo(Symbol(),MODE_MINLOT);
if(lot>MarketInfo(Symbol(),MODE_MAXLOT))lot=MarketInfo(Symbol(),MODE_MAXLOT);
return (MathMin(NormalizeDouble(lot,PipMultiplier),MaxLotSize));
}
//+------------------------------------------------------------------+
if(_Digits==5 || _Digits==3)PipMultiplier=10;
else PipMultiplier=1;
slippage=Slippage*PipMultiplier;
if(_Digits<4)
{
point=0.01;
}
else
{
point=0.0001;
}
return(0);
//+------------------------------------------------------------------+
double lot = MathCeil(AccountFreeMargin() * Risk_Percent / 1000) /