Grid, MartinGale including MetaTrader 5 documentation library - MT4/MT5 resources




This include file provides programmers with a seamless solution to easily create Martin Gale trading strategies. The GridStrategy and MartinGaleStrategy classes are derived from the Strategy class and contain various properties such as Startprice, Lots (volume available for the strategy), TakeProfit, Stoploss (expressed in currency), etc. Although grid and martingale strategies have their own unique characteristics, they still share these basic properties.
The Strategy class has an onTick function that should be called within the Expert Advisor's OnTick() function. This function handles various aspects of the strategy, including generating buy and sell signals, opening trades based on these signals, and closing trades when take-profit or stop-loss levels are reached. The buy and sell signals are virtual functions in the Strategy class, specifically implemented and customized in the Grid and Martin Gale Strategy classes.
Creating and initializing a policy is a simple process. After using the new keyword to create a policy object, you need to perform an initialization step. After initialization, just call the onTick function, which makes the creation of these strategies very simple and user-friendly.
By using this include file, programmers can easily exploit the power of Martin Gale strategies in their trading systems. The simplified approach and comprehensive functionality of the Strategy class allow efficient development and implementation of grid and Martin Gale trading strategies.
If you want, you can start a strategy based on various signals, for example, if you see high/low volatility, you can start a Martin Gale/Grid strategy so that it only runs until the position is closed at a profit.
Check out the Youtube video I made about it:
Attachment download
📎 grid.mq5 (2.72 KB)
📎 martingale.mq5 (2.83 KB)
📎 strategies.mqh (37.19 KB)
📎 trade.mqh (67.84 KB)
📎 functions.mqh (22.78 KB)
Source: MQL5 #44807
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •