detect previous 3 candles close price

 

I want to check for valid entrys on previous 2 candles and current f.ex.

--------
3 | 1.86
--------
2 | 1.87
--------
1 | 1.88  = new candle
--------

Buy if candle 3 < as candle 2 and new candle is higher as candle 2

1x blue 2x red = sell

the new bar is calculated by new bar open price which should be above the close price of candle 2 and the new bar direction is up

in PHP something like below ... but I need this with the last candle price varibables

if($candle[0]< $candle[1] AND $candle[2] > $candle[1]) 
{
 $buycheck = true;
}
 
fulltilt: I want
learn to code. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 
https://www.mql5.com/en/job
Reason: