Unable to deinit Object Create
for(int j = 0; j < Bars; j++) { PatternText[j] = "pattern-" + j; }
Don't use bar indexes in object names. When a new bar forms, you will be trying to create a new object with an existing name. Use time (int)Time[j].- There is no purpose for PatternText[], drop it. If you have more than 5000 bars, you exceed the array. The contents are constant. Just create the name before you create the object.
if(prevtime == Time[0]) { return(0); } prevtime = Time[0];
Drop that. NewBar code is for EAs. Indicators should update only changed bars, and do your lookback properly.int counted = IndicatorCounted(); int lookback = 9; // AvgRange for(shift = Bars - 1 - MathMax(lookback, counted); shift > 0; shift--)
You probably don't want to process bar zero. It's not a shooting star until the candle is completely formed. Don't alert unless shift is 1.ObjectsDeleteAll(0, OBJ_TEXT);
This makes your indicator incompatible with any other objects on the chart. Do it right.int ObjectsDeleteAll(0, "pattern-", 0, OBJ_TEXT);
Hi Roeder, yes, it is working now. Thank you so much, mate!
Now I know that I have so much to work on and learn from.
The main issue is solved after I changed the lookback, as recommended by you.
You're a savior, have a good day mate!
Hi all,
I'm still new to MQL4, so I'm trying to complete someone's else indicator for shooting star Candlestick, but I can't seem to remove the object text that was created when I stop the indicator, and at the same time when I change the timeframe, the object from 5min will be carried over to other timeframes (15mins, 30mins and etc). Really appreciate if someone can help to identify the issue, which I have been puzzled for weeks.