-
double spreadActual=(Ask-Bid)/Point/nn;
Equivalent to pip=point*nn; (Ask-Bid)/pip. -
Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a PIP is and use it, not points.
How to manage JPY pairs with parameters? - MQL4 programming forum (2017)
Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018)
Hello William, thank you for your reply and code,
From your code I have the code below, yet how to get the spread value to display?
ObjectSetText("spreadValue",""+spreadValue+"",20,"Arial Bold",spreadColor);
//======================= bool compute_pip(void){ // Requires MarketInfo, don't call in OnInit. double dvpl = DeltaValuePerLot(); // +Metals/exotics if(dvpl == 0) return false; double gTS = MarketInfo(_Symbol, MODE_TICKSIZE); double gPip = gTS; while(dvpl * gPip < 5) gPip *= 10; // USDMXN/USDZAR double gPipToPoint = (gPip / _Point); double gPipDigits = (MathLog10(gPipToPoint) ); return true; } double DeltaValuePerLot(string pair=""){ if (pair == "") pair = Symbol(); return( MarketInfo(pair, MODE_TICKVALUE) / MarketInfo(pair, MODE_TICKSIZE)); } //=======================
Ray Eagle #: yet how to get the spread value to display?
What part of (Ask-Bid)/pip was unclear?

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
On the common currency pairs this spread code gives a correct value,
Yet on some pairs USDZAR, USDSEK I get a high spread value = 186.0
How to correct this? all help appreciated.