need help on this indicator

 

Hello,

i found this mtf indicator not repainting the present and last bars as long as the MT4 is connected.

once MT4/chart reset, it recalculate/repaint the values.

can anybody help to make it NOT repaint the past at all?


for example:

i use typical parameter values: time frame=H4 (over m15 chart), with interpolate=false

when its not repainting it keeps the value for each m15 bar, after chart resets it only keep the value for the H4 bar and so on. 

my request is to keep the value of the smaller time frame bars (actual chart bars where its attached) forever and Not scale it to the higher time frame after chart resets.

thanks in advance...  

 
Try adding the middle line
Not tested, not compiled, just typed.
         int limit  = MathMin(Bars-counted_bars,Bars-1);
while(Time[limit] % timeFrame != 0 && limit < Bars-1) ++limit; // Repaint all bars of higher TF bar zero.
         if (returnBars) { buffer0[0] = limit+1; return(0); }
Not tested, not compiled, just typed.
 
William Roeder #:
Try adding the middle line
Not tested, not compiled, just typed.
Not tested, not compiled, just typed.

Hi Wiliam, thanks for your fast reply...

actually that makes the inverse for what i wanted, it goes directly to put the value of the higher time frame and completely neglecting the current chart bars (the smaller TF)........repainting the present from the start point.

aside note, it slows the MT4 and about to be crashed if i attached it to many charts at the same time.

(tested over live market of some crypto currencies that works today)

thanks

 
soulangel #: actually that makes the inverse for what i wanted, it goes directly to put the value of the higher time frame and completely neglecting the current chart bars (the smaller TF)..
Then stop using it as MTF indicator.  Run it on the current timeframe and increase the two lengths by H4/M15 (16)
 
William Roeder #:
Then stop using it as MTF indicator.  Run it on the current timeframe and increase the two lengths by H4/M15 (16)

conceptually you are right, but practically i tried this before it is not giving me what i need..

the values are not exactly the same i don't know why (specially when increasing in TF like Daily or Weekly). 

besides, it cancels the function of "interpolate" for the higher time frame....you may think of what i want like "lower time frame wave carried over a rectangular higher time frame wave"....to see both time frames waves over a single graph.  OR typically in my strategy  i look for the current value of the higher time frame in comparison to its previous values and the overall level. 

the indicator is already doing that by default, but eventually everything disappears after chart/MT4 resets.

it shall be something like the attached picture..