Bryan Djoufack Nguessong: So I was coding something and needed to use the OnChartEvent function to detect timeframe change,
Your ChartEvent shows you something on the chart changed. It does not ever give you timeframe changes.
The ChartEvent event is generated by the client terminal when a user is working with a chart:
- keystroke, when the chart window is in focus;
- graphical object created
- graphical object deleted
- mouse press on the graphical object of the chart
- move of the graphical object using the mouse
- end of text editing in LabelEdit.
When a timeframe change is requested, OnDeinit is called. Indicators are removed, the new chart is loaded, and your OnInit is called.

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
So I was coding something and needed to use the OnChartEvent function to detect timeframe change, so in the documentation they said to use the CHARTEVENT_CHART_CHANGE as id which i did now the code works just that i don't why it gets executed 2 times instead of once. Maybe I don't understand well the sequence of operation of that code.Here's how the code is. Thanks for any help or leads.