object update or indi restart after each candle

 

hello guys

I'm having troubles with one of my indicators which draws rectangles based on higher timeframes candlestick pattern (for example H4 oder Daily) on my M30 opened chart platform for trading. I'm using that indicator for manual trading.

The problem is, if I have the M30 timeframe open, the indicator will not adjust the rectangle to the current candle like in this example below correctly:

but the rectangle will "stay" at the corrent x,y area and will not move to the right after a new m30 candle is opened, UNTIL a new h4 or daily candle is printed, since the indicator is based on them.

however, if i simply switch timeframes on my chart from m15 to m30, the rectangle will end vertically at the current candle.

so im wondering what can be done that after every new candle, for example, either the indicator will be reloaded or if there is some kind function that does the job.

ive tried clicking right click and refresh but that doesnt work, and i would like to have a layout i dont have to manually switch timeframes in order to have it all in line, so i guess there must be a way to do that.

 
relaxo: so im wondering what can be done
You change the code so it does what you want.
 
WHRoeder:
You change the code so it does what you want.

Very informative help, thanks!
Reason: