daminda1989: but it show spread as whole number not as decimal. (ex: it show 0.2 spread as 2.0) how to correct this code?
DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)- Of course it does. Spread returns the number of points the spread is. It is ALWAYS a whole number. Perhaps you mean the spread in pips. Spread/pips2points
- Why are you using a function call? Why not just spread = (Ask-Bid)/pips2dbl?
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 add following code to display Spread in chart. but it show spread as whole number not as decimal. (ex: it show 0.2 spread as 2.0) how to correct this code?
{ ObjectCreate("Spread", OBJ_LABEL, 0, 0, 0); ObjectSet("Spread", OBJPROP_CORNER, 3); ObjectSet("Spread", OBJPROP_XDISTANCE, 10); ObjectSet("Spread", OBJPROP_YDISTANCE, 10); ObjectSetText("Spread", "Spread: "+ DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD),1), 16, "Tahoma", Yellow); WindowRedraw(); return(0); }