Thierry Ramaniraka: How can i draw a VLINE on the 50th (or Xth) bar in the future.
You can't, only on a specific datetime. This assumes every bar every exists. What if there are no ticks during a
specific candle period?
There can be minutes between ticks during the Asian session, think M1 chart.
Larger charts, think weekends and market holidays (country and
broker specific.)
requires knowledge of when your broker stops and starts (not necessary the same
as the market.)
"Free-of-Holes" Charts - MQL4 Articles
No candle if open = close ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Thierry Ramaniraka:
Hi there,
I come to you to ask you :
How can i draw a VLINE on the 50th (or Xth) bar in the future.
In my case, i want to put the Vline 50 bars after the current time/bar (what ever the timeframe, always the 50th bar in the future).
Hi there,
I come to you to ask you :
How can i draw a VLINE on the 50th (or Xth) bar in the future.
In my case, i want to put the Vline 50 bars after the current time/bar (what ever the timeframe, always the 50th bar in the future).
time=Time[0]+50*PeriodSeconds();
Hello to all.
the solutions by Taras Slobodyanik & Keith Watford are ok for me. Perfect !
Thank you very very much.
the solutions by Taras Slobodyanik & Keith Watford are ok for me. Perfect !
Thank you very very much.
If let the M1 timeframe going, the shifted VLINE does not refresh its place ; it's approaching...
How can I make it refresh itself please ?
Regards.
How can I make it refresh itself please ?
Regards.
Hello,
thank you.
I tried this, no error when compiling, but still not refreshing
if(ObjectFind("Current_Time2_Vline") < 0){ ObjectCreate("Current_Time2_Vline", OBJ_VLINE, 0, time2, 0); ObjectMove("Current_Time2_Vline", 0, time2, 0); } else { ObjectMove("Current_Time2_Vline", 0, time2, 0); }
Can you tel me the way to make it work please ?
Thierry Ramaniraka:
I tried this, no error when compiling, but still not refreshing
if(ObjectFind("Current_Time2_Vline") < 0){ ObjectCreate("Current_Time2_Vline", OBJ_VLINE, 0, time2, 0); ObjectMove("Current_Time2_Vline", 0, time2, 0); }else{ ObjectMove("Current_Time2_Vline", 0, time2, 0); }
Can you tel me the way to make it work please ?
- Equivalent code
/*void*/ ObjectCreate("Current_Time2_Vline", OBJ_VLINE, 0, time2, 0); ObjectMove( "Current_Time2_Vline", 0, time2, 0);
Or efficientif(! ObjectMove( "Current_Time2_Vline", 0, time2, 0) ) /*void*/ ObjectCreate("Current_Time2_Vline", OBJ_VLINE, 0, time2, 0);
- Post all the relevant code. The problem is elsewhere.
whroeder1:
- Equivalent codeOr efficient
- Post all the relevant code. The problem is elsewhere.
Your solution deosn't seems to work in my case.
Here below is the whole code.
Thank you very much for your help.
#property version "1.0" #property indicator_chart_window color Current_Time_Color = Red; datetime Current_Time = TimeCurrent(); extern int Datas_BarShift_Time = 35; extern int Datas_BarShift_Time2 = 60; int time2=Time[0]+(Datas_BarShift_Time-1)*PeriodSeconds(); int time3=Time[0]+(Datas_BarShift_Time2-1)*PeriodSeconds(); int init() { return(0); } //-------------------------------------------------------- int deinit() { DeleteObjects(); return(0); } //--------------------------------------------------------- int start() { ObjectCreate("Current_Time_Vline", OBJ_VLINE, 0, Current_Time, 0); ObjectSet("Current_Time_Vline",OBJPROP_COLOR,Current_Time_Color); ObjectSet("Current_Time_Vline",OBJPROP_BACK,true); ObjectSet("Current_Time_Vline",OBJPROP_SELECTABLE,false); if(! ObjectMove("Current_Time2_Vline", 0, time2, 0)) /*void*/ ObjectCreate("Current_Time2_Vline", OBJ_VLINE, 0, time2, 0); ObjectSet("Current_Time2_Vline",OBJPROP_COLOR,Current_Time_Color); ObjectSet("Current_Time2_Vline",OBJPROP_BACK,true); ObjectSet("Current_Time2_Vline",OBJPROP_SELECTABLE,false); /**/ ObjectCreate("Current_Time3_Vline", OBJ_VLINE, 0, time3, 0); ObjectSet("Current_Time3_Vline",OBJPROP_COLOR,Current_Time_Color); ObjectSet("Current_Time3_Vline",OBJPROP_BACK,true); ObjectSet("Current_Time3_Vline",OBJPROP_SELECTABLE,false); return(0); } //-------------------------------------------------------- //-------------------------------------------------------- void DeleteObjects() { ObjectDelete("Current_Time_Vline"); ObjectDelete("Current_Time2_Vline"); ObjectDelete("Current_Time3_Vline"); } //+------------------------------------------------------------------+

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
I come to you to ask you :
How can i draw a VLINE on the 50th (or Xth) bar in the future.
In my case, i want to put the Vline 50 bars after the current time/bar (what ever the timeframe, always the 50th bar in the future).
Thank you.
Regards.