How can I execute code only when current candle has closed

 

if(high[i-1] > tmau[i-1] && close[i-1] > open[i-1] && close[i] < open[i]) {

                               //  EXECUTE CODE HERE

ReboundD[i] = high[i] + AtrMultiplier*atr/2;
if(tmac[i] - tmac[i-1] > TMAangle*_Point){Caution[i] = ReboundD[i] + 10*_Point;}
}
if(low[i-1] < tmad[i-1] && close[i-1] < open[i-1] && close[i] > open[i]) {

                                //  EXECUTE CODE HERE

ReboundU[i] = low[i] - AtrMultiplier*atr/2;
if(tmac[i-1] - tmac[i] > TMAangle*_Point) Caution[i] = ReboundU[i] - 10*_Point;
}


Can someone help me figure out how to execute the codes in the if statement only after the current candle has fully closed 

Reason: