Do not use "OBJ_RECTANGLE_LABEL" for this.
Try to change the size of the chart and look at these objects.
Taras Slobodyanik:
Do not use "OBJ_RECTANGLE_LABEL" for this.
Try to change the size of the chart and look at these objects.
or use a smaller step)
#property strict #property script_show_inputs input int rows=100; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- string prefix="rectangle"; ObjectsDeleteAll(0,prefix); int ySize=(int)MathCeil((double)ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS, 0)/(double)rows); for (int i=0; i<rows; i++) { string name=prefix+(string)i; ObjectCreate(0, name, OBJ_RECTANGLE_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_RIGHT_UPPER); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, 1); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, i*ySize); ObjectSetInteger(0, name, OBJPROP_XSIZE, -i*3); ObjectSetInteger(0, name, OBJPROP_YSIZE, ySize); ObjectSetInteger(0, name, OBJPROP_BORDER_TYPE, BORDER_FLAT); ObjectSetInteger(0, name, OBJPROP_COLOR, clrSilver); ObjectSetInteger(0, name, OBJPROP_BGCOLOR, clrSilver); ObjectSetInteger(0, name, OBJPROP_BACK, true); ObjectSetInteger(0, name, OBJPROP_HIDDEN, false); } }
Taras Slobodyanik:
or use a smaller step)
This is brilliant!!! Thank you so much! Exactly what I wanted to see.
Obviously I am very bad at maths... :D
Thank you!!
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
Hey guys,
a picture says more than 1000 words. Please have a look at both charts. The script works when I use 30 rows but when I use 100 the height of the rows is wrong. But I don't see an error in the calculation.
Can someone help me with this issue?
This is the script: