anybody help me, please?
I tried to change
chart template and then create a graphical object (horizontal line) in the chart by
The Template has
changed successfully, but the Object hasn’t created.
If I cut out the
first line ( ChartApplyTemplate(0,”TMP.tpl”); ), the Object will create
I would surmise that:
ChartApplyTemplate is being added to the chart message queue, but before it has been processed the ObjectCreate is run.
A short time later, the template gets applied (which doesn't have your new object) and so it appears that your object was never created.
i.e. it was created, but then it got wiped by the application of your template.
I think you’re
right because I have the same opinion ;-)
But I still
look for a solution. Inserting ChartRedraw
or WindowRedraw between ChartApplyTemplate and ObjectCreate doesn’t help.
Is there a
possibility to flush the chart message queue before object creating?
ChartApplyTemplate causes a reinitialisation of the indicators on the chart - so the code halts execution at that point.
You will perhaps need to store some flag in a global variable that gets checked upon initialisation if you want any behaviour to take place after the template is applied.
The same thing applies if it is a script/EA or whatever - everything gets re-initialised when the template on the current chart is changed as far as I am aware.
In the past, I have had to work around this by using a global variable flag as I mentioned.
ChartApplyTemplate doesn’t halt execution a code because
the object has created (but then it will delete by applying a new template).
behavior is like switching the two lines:
To add comments, please log in or register