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

Singleton Example - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 2 reads | 0 comments |

Singleton Example - expert for MetaTrader 5

I was developing an EA and discovered that there shouldn't be multiple copies of an object. Most EAs will never get big enough that using singletons doesn't really matter, but I like the clarity of object type code. This is just an update to an MQ4 post from a year ago; maybe it's time to convert everything to MQ5.
The code closely follows the tutorial at http://www.yolinux.com/TUTORIALS/C++Singleton.html

Singleton Example - expert for MetaTrader 5


Attachment download

📎 the_singleton.mq5 (13.48 KB)

Source: MQL5 #24015

Singleton Example - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resource Usage and Screening Suggestions

Singleton Example - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 resources are MT5 EA related resources. Before downloading or referencing, it is recommended to confirm the platform version, transaction type, time period, whether DLL is required, whether source code is included, parameter description and historical update records.

Both automated trading tools and foreign exchange indicators should first undergo backtesting, simulated account observation, and small capital verification. Pay special attention to spreads, slippages, maximum drawdowns, position opening frequency, stop loss methods, trading periods and broker rules, and avoid direct real-time execution based only on titles or short-term profit descriptions.

Verification code Refresh