Good afternoon. Question about OBJPROP_TIMEFRAMES property identifier of graphical objects... I wrote this script to create a Horizontal Line graphical object (see below).
Question: Why, although the ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) function explicitly states that the object should display ONLY on timeframe H1, the created object also displays on timeframes (at least) H4, M30, M15.
Yes, thank you it helped... But I'd like to understand why ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) option doesn't work (as it should)? Is it glitches in the language itself?
Yes, thanks helped... But I want to understand why ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) doesn't work (like it should)? Is it glitches in the language itself?
De facto both PERIOD_H1 and OBJ_PERIOD_H1 are just an alpha substitution of some numeric value.
OBJ_PERIOD_H1 = 0x0010 (for current build) = 0001 0000 (binary)
PERIOD_H1 = 60 (for this build) = 0011 1100 (binary)
As it is easy to replace, you accidentally put 4 timeframes instead of one - H4, H1, M30 and M15
And instead of calling ObjectSet(object_name,OBJPROP_TIMEFRAMES,0x0010) (which you wanted to do) you have called
datetime last_time; // глобальная переменнаяint xBost_b;
int xBost_s;
double hi=High[1];
double op=Open[1];
double cl=Close[1];
double lo=Low[1];
int Sum_xb;
int Sum_xs;
if (last_time != Time[0])
{
// Ура, новый бар!
last_time = Time[0]; // запоминаем новый барif(Close[1]>Open[1])
xBost_b=(hi-cl)*10000;
Sum_xb=Sum_xb+xBost_b;<---------не плюсует,выдает такое же число как и xBostif(Close[1]<Open[1])
xBost_s=(cl-lo)*10000;
Sum_xs=Sum_xs+xBost_s;
Comment("\n kolvo_b=",xBost_b,"\n Sum_xb=",Sum_xb,"\n kolvo_s=",xBost_s,"\n Sum_xs=",Sum_xs);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Good afternoon. Question about OBJPROP_TIMEFRAMES property identifier of graphical objects... I wrote this script to create a Horizontal Line graphical object (see below).
Question: Why, although the ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) function explicitly states that the object should display ONLY on timeframe H1, the created object also displays on timeframes (at least) H4, M30, M15.
https://docs.mql4.com/ru/constants/objects/visible
Another constant is OBJ_PERIOD_H1
Yes, thank you it helped... But I'd like to understand why ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) option doesn't work (as it should)? Is it glitches in the language itself?
i.e. while the current bar[0] is being built the previous one is being defined
As an option:
Yes, thanks helped... But I want to understand why ObjectSet(object_name,OBJPROP_TIMEFRAMES,PERIOD_H1) doesn't work (like it should)? Is it glitches in the language itself?
De facto both PERIOD_H1 and OBJ_PERIOD_H1 are just an alpha substitution of some numeric value.
OBJ_PERIOD_H1 = 0x0010 (for current build) = 0001 0000 (binary)
PERIOD_H1 = 60 (for this build) = 0011 1100 (binary)
As it is easy to replace, you accidentally put 4 timeframes instead of one - H4, H1, M30 and M15
And instead of calling ObjectSet(object_name,OBJPROP_TIMEFRAMES,0x0010) (which you wanted to do) you have called
ObjectSet(object_name,OBJPROP_TIMEFRAMES,0x3C).
what is Time[0] and how does it affect 1 time plus ?! just a little confused...
what is Time[0] and how does it affect 1 time plus ?! just a little confused...
Time[0] is the opening time of the most recent (current) bar. As soon as a new bar comes, it changes.
Type Time in MetaEditor and press F1 for details
Time[0] is the opening time of the most recent (current) bar. As soon as a new bar comes, it changes.
Type Time in MetaEditor and press F1 for details
I'll read it now! Thank you very much!
Then don't forget to look at iTime()
how do I make it add up every time???
how do I make it add every time???