How do I display the current spread as a value in my custom indicator? I use the following code, but it doesn't display.
string displayStr = IntegerToString(spread);
ObjectCreate("ObjName", OBJ_LABEL, 0, 0, 0);
ObjectSetText("ObjName",displayStr,24, "Verdana", Red);
ObjectSet("ObjName", OBJPROP_CORNER, 0);
ObjectSet("ObjName", OBJPROP_XDISTANCE, 20);
ObjectSet("ObjName", OBJPROP_YDISTANCE, 20);
I am just starting to learn to make indicators for MT4. I noticed some values (like tick_volume) will display, and others like this
I am fairly experienced in coding C / C++ for microcontrollers, but MT4 is new to me.
If I remember correctly, when they introduced OnCalculate to MQL4, they seemed to copy across from 5 but I believe that
const long &volume,
const int &spread)
didn't return any value.
I haven't checked since.
For the spread I just use Ask-Bid in my calculations which of course gives you the decimal value.