Hello all, my question is if this function is stated correctly?
It's made to be able to adapt the SL, TP and Slippage values according to the amount of digits on the broker and it supports 4 or 5 digits broker.
My doubt is on the return(-1); part as I have to return something on the last path to avoid getting "not all control paths returns a value" error. It's technically imposible to get that return but I want to make sure by having another opinion:)
Thanks guys!
double Pips(string pSymbol = NULL) { double iPoint = SymbolInfoDouble(pSymbol == NULL ? Symbol() : pSymbol, SYMBOL_POINT); return Digits == 3 || Digits == 5 ? (iPoint * 10) : iPoint; }
return Digits == 3 || Digits == 5 ? (iPoint * 10) : iPoint;Digits is the current symbol. Code breaks for any other.
How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum
Hello all, my question is if this function is stated correctly?
It's made to be able to adapt the SL, TP and Slippage values according to the amount of digits on the broker and it supports 4 or 5 digits broker.
My doubt is on the return(-1); part as I have to return something on the last path to avoid getting "not all control paths returns a value" error. It's technically imposible to get that return but I want to make sure by having another opinion:)
Thanks guys!
I am tired to move your topic to the right section.
mql4 question in mql4 section, is that hard to understand ?
Digits is the current symbol. Code breaks for any other.
How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum
Hi whroeder1
you are right,I was wrong.....
double Pips(string pSymbol = NULL) { double iPoint = SymbolInfoDouble(pSymbol == NULL ? Symbol() : pSymbol, SYMBOL_POINT); int iDigits = SymbolInfoInteger(pSymbol == NULL ? Symbol() : pSymbol, SYMBOL_DIGITS); return iDigits == 3 || iDigits == 5 ? (iPoint * 10) : iPoint; }
in this mode is possible to use function for other symbol
double Pips(void){ return Pips(_Symbol); } double Pips(string pSymbol){ double iPoint = SymbolInfoDouble(pSymbol, SYMBOL_POINT); if(SymbolInfoInteger(pSymbol, SYMBOL_DIGITS) % 2 != 0) iPoint *= 10.; return iPoint; }or
double Pips(string pSymbol = NULL){ if(pSymbol == NULL) pSymbol = _Symbol; double iPoint = SymbolInfoDouble(pSymbol, SYMBOL_POINT); if(SymbolInfoInteger(pSymbol, SYMBOL_DIGITS) % 2 != 0) iPoint *= 10.; return iPoint; }
- 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 all, my question is if this function is stated correctly?
It's made to be able to adapt the SL, TP and Slippage values according to the amount of digits on the broker and it supports 4 or 5 digits broker.
My doubt is on the return(-1); part as I have to return something on the last path to avoid getting "not all control paths returns a value" error. It's technically imposible to get that return but I want to make sure by having another opinion:)
Thanks guys!