Function for waiting for next candle to close?

 

I'm writing 2 bool functions that check if certain conditions are met before executing a trade.

The first function checks the previous candle.

The 2nd function is meant to check conditions of the next 2 candles that form after the 1st confirmation candle. Only when both functions return True, the trade will execute. Otherwise, the second function will return False and set the 1st function to False again

When the first function returns True I want it to signal the next function to monitor the next 2 candles. How can I do this? 

Problem is that it seems like we can only get data on previous candles. Help pls

 

Of course the close price of the last candle (candle 0 ) will be ever moving until the candle closes.

Then it becomes the close price of candle 1 and a new candle 0 will start forming.

So if you shift all of your bars +1 to the left you should have fixed close price only.

Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Calculations of technical indicators require price values and/or values of volumes, on which calculations will be performed. There are 7 predefined identifiers from the ENUM_APPLIED_PRICE enumeration, used to specify the desired price base for calculations. If a technical indicator uses for calculations price data, type of which is set by...
 
RJ Adams:

I'm writing 2 bool functions that check if certain conditions are met before executing a trade.

The first function checks the previous candle.

The 2nd function is meant to check conditions of the next 2 candles that form after the 1st confirmation candle. Only when both functions return True, the trade will execute. Otherwise, the second function will return False and set the 1st function to False again

When the first function returns True I want it to signal the next function to monitor the next 2 candles. How can I do this? 

Problem is that it seems like we can only get data on previous candles. Help pls

In that case your first function just have to check candle 3, and the second function checks candles 2 and 1... every start of a new bar 0, if both functions return true, you have your trade execution condition.

Reason: