Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Singleton Example - expert for MetaTrader 5

Views:
5827
Rating:
(10)
Published:
2019.01.05 19:42
The Singleton.mq5 (13.48 KB) view
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

I was working on an EA and identified that an object should never have more than one copy. Most EA's never get large enough for it to actually matter that a singleton is used, but I like the clarity in the code for the object's type.  This is just an update to a years earlier post of this for MQ4; it may be getting to be time to convert everything to MQ5.
The code follows closely the tutorial at http://www.yolinux.com/TUTORIALS/C++Singleton.html

The display of the event count is just to show that the singleton object is working.
Averages crosses Averages crosses

Averages crosses

Heiken ashi - histogram Heiken ashi - histogram

Heiken ashi - histogram

Nonlinear Kalman filter - floating levels Nonlinear Kalman filter - floating levels

Nonlinear Kalman filter - floating levels

Zero mean normalized nonlinear Kalman filter Zero mean normalized nonlinear Kalman filter

Zero mean normalized nonlinear Kalman filter