Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

CCheckNewCandle - MetaTrader 5 Library | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 2 reads | 0 comments |

MQL4 version is also available. In this MQL5 version, I added the "+" operator and the convenient use of the index "[]". "+" allows updating the sign on which the candlestick appears. The index allows checking the occurrence of candlesticks within a specified time range.

Many MQL5 programs explicitly execute part of their code only after a new candlestick appears on the chart. This class saves you from writing candlestick monitoring functions in every program.

To use this class, save the attachment to %TerminalPath%\MQL4\Include\

Include this file in the desired indicator or Expert Advisor:

Create an object:

CCheckNewCandle candle;

CCheckNewCandle Candle( "EUR/USD" );

At the beginning of the event handler, check for the occurrence of a new candlestick (the result of the check is stored in the instance).

 Check () //or OnCalculate(), or other functions... {
 +candle;
  ...
  }

Now, until the next check, the candle[ENUM_TIMEFRAMES timeframe] method returns the result of the previous check using +candle; method.


Attachment download

📎 cchecknewcandle.mqh (9.99 KB)

Source: MQL5 #18497

Verification code Refresh