How to store value before trade excute

I want store value when 15min candle green and next 15 min candel red. I want store value of higher high and take a trade when higher high breach on next 15 min candel OR next to next 15 min candel OR nth 15 min candel in inraday .
1.15 min green candle high is 43682 and next 15 red candle high is 43644. store value of 43682.
2.15 min green candle high 43523 and next 15 red candle high 43595 store value 43595.

Try this…
Check if -1 candle is red( open < close), the check if -2 candle is green( open > close)…if both conditions met, take a dummy trade to capture high of -2 candle in the runtime variable and exit the trade.

This will give you high of green candle…