simple:
void doTheThing(string objn, color lineColor, int window, datetime time, double price, int idx) { if (ObjectFind(0, objn) < 0) { ObjectCreate(0, objn + IntegerToString(idx), OBJ_HLINE, window, time, price); } ObjectSetInteger(0, objn + IntegerToString(idx), OBJPROP_COLOR, lineColor); ObjectSetInteger(0, objn + IntegerToString(idx), OBJPROP_STYLE, STYLE_DASH); ObjectSetInteger(0, objn + IntegerToString(idx), OBJPROP_WIDTH, 1); }
in OnCalculate then if your MA is not set as series :
doTheThing("test", clrPurple, 0, 0, mabuffer[rates_total-1], 0);
or if your MA is set as series:
doTheThing("test", clrPurple, 0, 0, mabuffer[0], 0);

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
hi - so possibly an uber-noob question, but i would like the values of the MA's im using to show on the y-axes of my chart - similar like how the current bid/ask is shown in grey/red - but then in the colour of that particular MA.
Anybody have an idea on how to go about this?
Thanks!