Thierry Ramaniraka: Your solution deosn't seems to work in my case.
I didn't provide a solution. I provided equivalent but simpler code. Why do you expect my code to work any different?
datetime Current_Time = TimeCurrent();
int time2=Time[0]+(Datas_BarShift_Time-1)*PeriodSeconds();
int time3=Time[0]+(Datas_BarShift_Time2-1)*PeriodSeconds();
These are all global variables. They are initialize at load with possible garbage. They are never updated in start.
Don't try to use any price or server related functions in
OnInit (or on load,) as there may be no connection/chart yet:
Terminal starts.
Indicators/EAs are loaded. Static and globally declared variables are
initialized. (Do not depend on a specific order.)
OnInit is called.
For indicators OnCalculate is called with any existing history.
Human may have to enter password, connection to server begins.
New history is received, OnCalculate called again.
New tick is received, OnCalculate/OnTick is called.
Now TickValue, TimeCurrent and prices are valid.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
Program Properties (#property) - Preprocessor - Language Basics - MQL4 Reference
Thank you.
Thank you all for your help.
Finally I succeed by redefine the shift parameter on new candle.
Thank you all for your help
Here is a more reusable solution...
Here is a more reusable solution...
Thank you.
I keep it for later in case.
Regards.
Hello,
I am trying to work with
And i get this error.
Can you tell me what is wrong please ?
Don't double post!
General rules and best pratices of the Forum. - General - MQL5 programming forumDon't double post!
General rules and best pratices of the Forum. - General - MQL5 programming forumHello,
I didn't intended such bad things. It was just a corelation on both thread.
https://www.mql5.com/en/forum/233876/unread#unread
https://www.mql5.com/en/forum/235106/unread#unread
Regards
Messages Editor
Finally I succeed by redefine the shift parameter on new candle.
Thank you all for your help.
Hello I am learning the newest MT4 mql's language with "Oninit" and so on...
And my Vlines are not refreshing anymore. Any idea why ?
Nb : I have place it in "OnChartEvent" Because i planned to make them show/hide by a button.