Move the call to Display_Vlines() from the OnChartEvent() to OnCalculate()
Or click on the chart whenever you want to refresh it :) As simple click on the chart will do the way your code is written. But you have more issues with that code (starting from the fact that your Current_Time is fixed to the time when indicator is attached or reloaded)
Move the call to Display_Vlines() from the OnChartEvent() to OnCalculate()
Or click on the chart whenever you want to refresh it :) As simple click on the chart will do the way your code is written. But you have more issues with that code (starting from the fact that your Current_Time is fixed to the time when indicator is attached or reloaded)
Hello mladen, Already tried, but didn't work. When a new bar comes (tested on M1), the Vlines stay in place et do not refresh and replace on their new bar. I have to change the time frame...
Hello mladen, Already tried, but didn't work. When a new bar comes (tested on M1), the Vlines stay in place et do not refresh and replace on their new bar. I have to change the time frame...
Any idea why ?
Adjust time for existing objects. ObjectCreate() does not adjust time component for objects already existing
These are globally declared variables, they are initialized once on load. They don't update unless you assign to them. 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.
Move the call to Display_Vlines() from the OnChartEvent() to OnCalculate()
Or click on the chart whenever you want to refresh it :) As simple click on the chart will do the way your code is written. But you have more issues with that code (starting from the fact that your Current_Time is fixed to the time when indicator is attached or reloaded)
Hello, I have tried again and it's ok now...maybe it was to late for me yesterday. thank you.
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.
Move the call to Display_Vlines() from the OnChartEvent() to OnCalculate()
Or click on the chart whenever you want to refresh it :) As simple click on the chart will do the way your code is written. But you have more issues with that code (starting from the fact that your Current_Time is fixed to the time when indicator is attached or reloaded)
Move the call to Display_Vlines() from the OnChartEvent() to OnCalculate()
Or click on the chart whenever you want to refresh it :) As simple click on the chart will do the way your code is written. But you have more issues with that code (starting from the fact that your Current_Time is fixed to the time when indicator is attached or reloaded)
Hello mladen,
Already tried, but didn't work.
When a new bar comes (tested on M1), the Vlines stay in place et do not refresh and replace on their new bar.
I have to change the time frame...
Any idea why ?
Hello mladen,
Already tried, but didn't work.
When a new bar comes (tested on M1), the Vlines stay in place et do not refresh and replace on their new bar.
I have to change the time frame...
Any idea why ?
Adjust time for existing objects. ObjectCreate() does not adjust time component for objects already existing
And what can adjust the time please ?
And what can adjust the time please ?
Move the call to Display_Vlines() from the OnChartEvent() to OnCalculate()
Or click on the chart whenever you want to refresh it :) As simple click on the chart will do the way your code is written. But you have more issues with that code (starting from the fact that your Current_Time is fixed to the time when indicator is attached or reloaded)
Hello,
I have tried again and it's ok now...maybe it was to late for me yesterday.
thank you.