MQ L5 Wizard - Candlestick Patterns Class
Info
The MQ L5 Wizard - Candlestick Patterns Class is a Library for MetaTrader 5 that the allows creating ready-made expert advisors based on the classes delivered together with the client terminal. It allows to check your trade ideas quickly, all you need is to create your own trading signals class.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Library works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Libraries folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use MQ L5 Wizard - Candlestick Patterns Class
1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.
2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.
3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.
4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.
Frequently Asked Questions
Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.
Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.
Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.
What this tool does
The allows creating ready-made Expert Advisors based on the classes delivered together with the client terminal.
Typical Use Case
This Library excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Library works on MetaTrader 5. Place the file in the MQL5/Libraries folder and restart the terminal.
Description & Settings
Related: MQ L 5 Wizard - Simpler Intraday Time Filter - another powerful library for MetaTrader 5 traders.
The allows creating ready-made Expert Advisors based on the classes delivered together with the client terminal. It allows to check your trade ideas quickly, all you need is to create your own trading signals class. The structure of this class and example can be found in the article .
Also recommended: MQ L5 Wizard - GA N N Hi Lo Signal - similar library with strong performance on MetaTrader 5.
The generic idea is the following: the class of trading signals is derived from , the next, it's necessary to override the and virtual methods with your own methods.There is a book " (in Russian), there are many trading strategies are considered there, we will focus on reversal candlestick patterns, confirmed by , , and oscillators.
The best way is to create the separate class, derived from for checking of formation of candlestick patterns. For confirmation of trade signals, generated by candlestick patterns, it's sufficient to write the class, derived from CCandlePattern and add the necessary features (for example, confirmation by oscillators) there.
Here we will consider the CCandlePattern class, it allows to simplify the creation of trade signal classes with candlestick patterns for MQL5 Wizard.
CCandlePattern class
The CCandlePattern class is derived from the class (base class of trading signals)
Using CCandlePattern in trade signal classes for MQL5 Wizard
The CCandlePattern class can be used a parent class for trade signal classes for MQL5 Wizard. It's necessary to derive the trade signal class from CCandlePattern class, also it's necessary to add methods for checking of long/short position opening/closing (in addition to indicators, etc...).
Formation of reversal candlestick pattern can be used as a trade signal, but it's better to check confirmation (for example, using the oscillators).
bool CheckOpenLong(double &price,double &sl,double &tp,datetime &expiration) - Checks conditions of long position opening;
bool CheckCloseLong(double &price) - Checks conditions of long position closing;
bool CheckOpenShort(double &price,double &sl,double &tp,datetime &expiration) - Checks conditions of short position opening;
bool CheckCloseShort(double &price) - Checks conditions of short position closing;
The details about the structure of trading signal classes, used in MQL5 Wizard, can be found in the article .
Take a look at the line:
in the wizard description section.
The MAPeriod method is used in the CCandlePattern parent class for calculation of average closing price and averaged values of the candle's body. By default, m_ma_period=12 is set in CCandlePattern() class constructor. However, it's better to set it using the input parameter, it will allow you to use it in of MetaTrader 5.
Don't forget to call ValidationSettings() and InitIndicators() of parent class
Note, that it's necessary to call the CCandlePattern::ValidationSettings and CCandlePattern::InitIndicators methods of parent class in the corresponding class methods.
It's better to call these methods first:
The same is for the InitIndicators() method:
Checking candlestick patterns
To check the formation of a certain candlestick pattern it's necessary to call the CheckCandlestickPattern(ENUM_CANDLE_PATTERNS CandlePattern) method with pattern, passed to the function.
Also you can check formation of one of the bullish/bearish candlestick patterns using the CheckPatternAllBullish() and CheckPatternAllBearish() methods.
To simplify the work of candlestick patterns, the ENUM_CANDLE_PATTERNS enumeration is used:
Checking bullish candlestick patterns:
Checking bearish candlestick patterns:
Here are examples of use of the methods:
1. Open long position
2. Close long position
3. Open short position
4. Close short position
Recommendations
To reduce false signals, the reversal candlestick patterns must be confirmed by other indicators, such as oscillators.
The following patterns are considered in the "Strategies of best traders" book:
3 Black Crows/3 White Soldiers
Dark Cloud Cover/Piercing Line
Morning Doji/Evening Doji
Bearish Engulfing/Bullish Engulfing
Evening Star/Morning Star
Hammer/Hanging Man
Bearish Harami/Bullish Harami
Bearish Meeting Lines/Bullish Meeting Lines
confirmed by , , and oscillators.
Later we will provide the classes of trade signals for use in MQL5 Wizard.
You may also like: Trade signal based on Pull Back and Candle (for MQ L5 Wizard) - excellent alternative for library users on MetaTrader 5.
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.