I am very new to MetatTrade programming.
I have the following problem: I want to create an indicator that when counts 5 candles in a row with close > close t-1 print a 5 over the max of the candle and a 6, 7 etc for each subsequent candle (if it is the case).
It is just an simplified example but it gives you an idea of what I need :-)
The problem I have found is that it seems relatively easy to print an arrow or a symbol from Wingsdings, but difficult to print a number or a string.
The only way I found is using ObjectCreate which does the job but on the other hand it leaves the problem of deleting all those numbers (objects) when I remove indicator from a chart (numbers got stuck in the chart forever)
Is there any simple way to do that? Is there a way to add numbers to the Wingsdings table maybe?
Sorry if the question is trivial but I have been stuck for long now...
Have you tried searching with google?
Is there any simple way to do that?
long chart_id, // chart ID
const string prefix, // prefix in object name
int sub_window=-1, // window index
int object_type=-1 // object type
Just name everything with the same prefix and Bob's your uncle.
I tried that solution too. But not sure where should I put that piece of code in order to be triggered when I delete an indicator from a chart (I manage to get it right when I modify time-frame for instance, but when i delete indicator all text objects remain on the chart).
So my problem stands
yes of course. this was the solution I found. BUT all those objects remains in the chart when I remove indicator from the chart itself.
So my problem remains :-(
i tried to put it there. but it was not working when I was deleting the indicator from a chart.
I read in documentation that OnDeinit() is called in specific cases but apparently not when you remove an indicator from a chart...
I think I understood what I was doing wrong. It was not working in debugging (because of course it was killing the debug process) but it is working in production.
So thank you very much and sorry for the 'silly' question
Don't be sorry for asking after trying to resolve it by yourself. Often we get blinded by trying to solve the issue and fail considering a broader POV