Ticaret robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Telegram üzerinde bulun!
Fan sayfamıza katılın
Komut dosyasını ilginç mi buldunuz?
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Komut dosyasını beğendiniz mi? MetaTrader 5 terminalinde deneyin
Uzman Danışmanlar

Singleton Example - MetaTrader 4 için Uzman Danışman

Görüntülemeler:
8311
Derecelendirme:
(17)
Yayınlandı:
2015.11.18 10:20
Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

This is a working singleton code example. The sole purpose of this post is to provide a working code sample of a singleton object. A singleton object is created when there 'can be only one' of the object. This is accomplished by making an object's constructor private, and ensuring assignment and copy operations are also private.

I was working on an EA and identified that an object should never have more than one copy. I don't expect the EA to ever 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. Some programmers argue against the use of singletons, but I think the technical reasons for not using them are mostly resolved with newer compiler technology. It didn't seem like anyone had provided an example of this functionality in this environment — I found only an old reference in the Code Base from before private static variable initialization was supported by the compiler — as you can see in this example, this functionality works well today.

Comments or contributions for improving the code are always welcome.

Running Singleton Example

Simple Copier Simple Copier

Copying utility with minimal functionality.

Simple Levels Simple Levels

EA opens trades from support and resistance levels which were set by a trader.

Millenium Code Millenium Code

This program is a basic version of the original code of relatively simple system Millenium.

Cidomo_v.1 Cidomo_v.1

The strategy of this EA is daily breakout which is compare previous high or low previous day candle then place a pending order for breakout.