hi, no need to delete and redraw, just change the parameters.
OpenPrice is simply IOpen(Symbol(),Period_D1,0);
OpenTime should be somethink like Time[iBarsShift(Symbol(),Period(),iTime(Symbol(),Period_D1,0),false];
//z
edit: when using such draw operations a simple iTime(Symbol(),Period_D1,0) should also work.
The parameters are in the start section but the rectangle is not updated when a new hourly candle appears.
Any ideas?
ObjectCreate("Rectangle",OBJ_RECTANGLE,0,Time[24],RectangleLow,Time[0],RectangleHigh);
Time[24] is 24 bars back, possibly not 24 hrs (on H1).
datetime Day0000 = TimeCurrent() - TimeCurrent()%86400; // 24&60&60
ObjectCreate fails if the object already exists. Use this form:
/**/ if (ObjectMove(BORect, 0, T0, H1)) ObjectMove(BORect, 1, T1, L1); else if (!ObjectCreate( BORect, OBJ_RECTANGLE, WINDOW_MAIN , T0, H1, T1, L1)) Alert( "ObjectCreate(", BORect,",Rectangle) failed: ", GetLastError()); else if (!ObjectSet( BORect, OBJPROP_COLOR, Color.BO )) Alert( "ObjectSet(", BORect,",Color) [2] failed: ", GetLastError()); else if (!ObjectSet( BORect, OBJPROP_BACK, True )) Alert( "ObjectSet(", BORect,",back) failed: ", GetLastError());
I am trying to display a rectangle from the start of the day 0000 to the current candle.
How can I get start of the day into the Time[] section?
ObjectCreate("Rectangle",OBJ_RECTANGLE,0,Time[24],RectangleLow,Time[0],RectangleHigh);
ObjectSet("Rectangle",OBJPROP_SCALE,1.0);
ObjectSet("Rectangle",OBJPROP_COLOR,MistyRose);
Also, to repaint the rectangle every hour or evey tick, do I need to delete the rectangle and redraw it?
Hello SanMiguel:
This is an alternative: ObjectCreate("Rectangle", OBJ_RECTANGLE, 0,iTime(Symbol(),PERIOD_D1,1), priceH,iTime(Symbol(),PERIOD_D1,2), priceL);
Best Regards.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to display a rectangle from the start of the day 0000 to the current candle.
How can I get start of the day into the Time[] section?
ObjectCreate("Rectangle",OBJ_RECTANGLE,0,Time[24],RectangleLow,Time[0],RectangleHigh);
ObjectSet("Rectangle",OBJPROP_SCALE,1.0);
ObjectSet("Rectangle",OBJPROP_COLOR,MistyRose);
Also, to repaint the rectangle every hour or evey tick, do I need to delete the rectangle and redraw it?