Ticaret fırsatlarını kaçırıyorsunuz:
- Ücretsiz ticaret uygulamaları
- İşlem kopyalama için 8.000'den fazla sinyal
- Finansal piyasaları keşfetmek için ekonomik haberler
Kayıt
Giriş yap
Gizlilik ve Veri Koruma Politikasını ve MQL5.com Kullanım Şartlarını kabul edersiniz
Hesabınız yoksa, lütfen kaydolun
... bariz olanı belirterek, yukarıdakileri bir komut dosyası yerine bir EA'da yapmak istiyorsanız [...]
Basitçe #define COMPILE_AS_EA yorumunu kaldırarak bir komut dosyası yerine bir EA oluşturmak için kullanılabilecek revize edilmiş sürüm. Bu durumda kodda OnStart yerine OnTimer (ve OnTick) bulunur.
Diğer tek değişiklik, kodun artık soketleri engellemeyen moda geçirmesidir. Hala select() kullanarak yeni soket olaylarının kullanılabilirliğini yoklar, ancak artık select() bir şekilde hatalıysa engelleme durumuna girme tehlikesini ortadan kaldırır.
Gözden geçirilmiş versiyon [...]
Eminim herkes bu konuda bir güncelleme için can atıyor...
Artık kodda varsayılan olan bir EA bağlamında, soket etkinliğinin olaya dayalı işlenmesini yapmak için WSAAsyncSelect() kullanmanın mümkün olduğu ortaya çıktı. Bu genellikle mesaj gönderme ve mesaj alma arasındaki gecikmeyi milisaniye seviyesinin altına itebilir. Kesin hız, MT4'ün başka ne yaptığına bağlı olarak değişir, ancak ortalama olarak, yalnızca zamanlayıcıyı kullanmaktan çok daha hızlı ve asla daha kötü değildir.
EA'da WSAAsyncSelect()'in OnTimer() veya OnTick()'i tetiklemesini sağlamak mümkün değildir. Örneğin, WSAAsyncSelect()'e WM_TIMER mesajlarını başlatması söylenebilir, ancak MT4 bunları yok sayar çünkü WSAAsyncSelect()'ten gelen wparam zamanlayıcı kimliği EventSetMillisecondTimer()'dan beklediği zamanlayıcı kimliğiyle eşleşmez.
Ancak, WSAAsyncSelect()'e WM_KEYDOWN göndermesini söylemek, EA'da OnChartEvent()'i başarıyla tetikler. Bu eklemenin nasıl çalıştığına dair tüm ayrıntılar için koddaki yorumlara bakın.
Biraz eğlenmek için...
Yüksek sesle gülmek. Harika. Tebrikler. Bu işlevleri MQL'de kodlamanın mümkün olabileceğini düşünmemiştim.
Yüksek sesle gülmek. Harika. Tebrikler. Bu işlevleri MQL'de kodlamanın mümkün olabileceğini düşünmemiştim.
Benim içgüdüm her zaman çoklu iş parçacığı kullanarak sunucu soketleri yapmaktır, ancak bu kodun gerçek hayatta kullanım için neden geçerli ve güvenli olmayacağına dair bir neden düşünemiyorum.
Yukarıdaki en son sürümde ideal olmayan bir şey var. Başka bir büyük kod bloğu göndermek yerine, onu tarif edeceğim:
Bu kodda küçük bir değişiklik, ancak sadece siz ilgilenirken bu foruma büyük bir blok daha eklemek istemiyorum.
Başka bir büyük kod bloğu göndermek yerine [...]
Tekrar düşününce...
Aşağıdaki değişikliklerle birlikte başka bir sürüm:
Bu kadar uzun SRC katkıları göndermek yerine, dosyanın kendisini eklemeyi düşünün. Daha uzun gönderilerinizi DÜZENLEMENİZİ, SRC bölümlerini silmenizi ve sadece kaynak dosyayı eklemenizi öneririm.
Bu kadar uzun SRC katkıları göndermek yerine, dosyanın kendisini eklemeyi düşünün. Daha uzun gönderilerinizi DÜZENLEMENİZİ, SRC bölümlerini silmenizi ve bunun yerine sadece kaynak dosyayı eklemenizi öneririm.
Katkılarınız için çok teşekkür ederim.
Ancak bunu yapmamamın birçok nedeni arasında yukarıdaki kodun hem MT4 hem de MT5'te çalışması var. Ek olarak yükleseydim, yanıltıcı bir şekilde .mq4 veya .mq5 olarak işaretlenmesi gerekirken aslında her ikisi olarak da çalışır.
Ancak, birçok neden arasında [...]
Önemli nedenlerden bir diğeri, OP'ye uygulanabilecek aşağıdaki senaryodur:
Bildiğim kadarıyla ne arama motorları ne de bu sitedeki arama eklerin içine bakamıyor. Bu nedenle, kodu ek olarak göndermek, "mql4 bind listen htons" gibi bir arama için kodu görünmez hale getirecektir.
İnsanlara düzenli olarak bir arama yapmaları veya belgelere bakmaları gerektiğini söylüyorsunuz; Tam olarak bu konuda yardımcı olmaya çalışıyorum.
(Olduğu gibi, "mql4 bağlama dinleme htons" bu konuyu bulamıyor çünkü Google sayfayı 14 Eylül'den beri taramadı. Ancak yakında Google'da görünmeye başlayacak.)
Katkılarınız için çok teşekkür ederim.
Ancak bunu yapmamamın birçok nedeni arasında yukarıdaki kodun hem MT4 hem de MT5'te çalışması var. Ek olarak yükleseydim, yanıltıcı bir şekilde .mq4 veya .mq5 olarak işaretlenmesi gerekirken aslında her ikisi olarak da çalışır.
Tekrar düşününce...
Aşağıdaki değişikliklerle birlikte başka bir sürüm:
tekrar TEŞEKKÜRLER jjc,
Şu anda acelem var ve test etmek için zamanım yok ama önümüzdeki hafta yapacağım ve size anlatacağım. Çalıştırırken sorun yaşamayacağımı düşünüyorum ama belki size bazı şüpheler sorabilirim. BTW: Lütfen herhangi bir gönderiyi düzenlemeyin; hepsi oldukları gibi mükemmeller (StackOverflow =) gibi hissediyorum).