- Russell_Neil_V: the opening bar of each opening,… where the opening bar is on each opening bar
Opening of an opening makes no sense. Rewrite your problem.
Until you can state your requirements in concrete terms, it can not be coded.
-
Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
ObjectCreate ("shape_1", OBJ_TEXT, 0, Time[0], iOpen(NULL,PERIOD_D1,0) +price_1);
Price plus price makes no sense. -
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)
-
Opening of an opening makes no sense. Rewrite your problem.
Until you can state your requirements in concrete terms, it can not be coded.
-
Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor - Price plus price makes no sense.
-
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)
double price_1 = 7; // for spacing ObjectCreate ("shape_1", OBJ_TEXT, 0, Time[0], iOpen(NULL,PERIOD_D1,0) +price_1); ObjectSetText ("shape_1", "q", 20, "Wingdings 3", Red); ObjectCreate (" shape_2 ", OBJ_TEXT, 0,Time[1], iOpen(NULL,PERIOD_D1,1) +price_1); ObjectSetText("shape_2", "q", 20, "Wingdings 3", Red);
Thank you for replying...
Time[0], [1] etc are variables of type datetime. Why don't you store the value in those bars that you wanna redraw in a new datetime variable, then redraw it on the new chart? Instead of trying to work with Time[0] work with its value, for example something like this...
double price_1 = 7; // for spacing datetime textTime[2]; textTime[0] = Time[0]; textTime[1] = Time[1]; ObjectCreate("shape_1", OBJ_TEXT, 0, textTime[0], iOpen(NULL,PERIOD_D1,0) +price_1); ObjectSetText("shape_1", "q", 20, "Wingdings 3", Red); ObjectCreate("shape_2 ", OBJ_TEXT, 0, textTime[1], iOpen(NULL,PERIOD_D1,1) +price_1); ObjectSetText("shape_2", "q", 20, "Wingdings 3", Red);
...and the datetime value, or in other words the value on the X-axis, is now stored in the array textTime[].

- 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'm trying to get a shape to appear above the opening bar of each opening, which I can do on a day period, but
when I switch between other periods --- I cannot figure out where the opening bar is on each opening bar
because of the way bars are number in reverse --- 0,1,2,3, etc.. except for the Day period..
This is my code:
ObjectCreate ("shape_1", OBJ_TEXT, 0, Time[0], iOpen(NULL,PERIOD_D1,0) +price_1);
ObjectSetText ("shape_1", "q", 20, "Wingdings 3", Red);
ObjectCreate (" shape_2 ", OBJ_TEXT, 0,Time[1], iOpen(NULL,PERIOD_D1,1) +price_1);
ObjectSetText("shape_2", "q", 20, "Wingdings 3", Red);
Note....
I know this has something to to do with Time[0] and Time[1]
and I tried switching PERIOD_D1 to PERIODCURRENT but this just gets me into the same problem
with bar numbers 0,1,2,3, etc.....