Açık ticareti kontrol etme sorunları - sayfa 3

 
extern int      iOpenHour                = 6 ;

int start()
  {
                                                            
int b, scannedhour;
datetime bartime;
double dibsclose, dibsopen, prevdayrange[ 4 ];       //  prevdayrange Array Categorys ( 1  EURUSD, 2 GBPUSD, 3 USDCHF, 4 USDJPY )

//----------------------------------------------------------------------------------------------
//        EURUSD PREV DAY RANGE CALC

for (b= 0 ; b<= 24 ; b++)                               // scans the last 24 bars on eurusd
   {
      bartime = iTime ( "EURUSD" , 60 , b);               // checks the open time of each bar
      scannedhour = TimeHour (bartime);                 // extracts the hour of that bar
    
       if ( scannedhour == iOpenHour )                     // Check to see if scanned hour = Dibs hour
         {
            dibsclose    = iOpen ( "EURUSD" , 60 , b);     // Get the open value of that bar (Close of 6gmt day) 
            dibsopen     = iOpen ( "EURUSD" , 60 , b+ 24 ); // Get the value of the bar 24 bars before the Dibs bar (Open of 6gmt day)
            prevdayrange[ 1 ] = (dibsclose-dibsopen);   // Calculate the range of the Dibs day
         }                                                   // End of if statement
    }                                                       // End of for statement
    

//----------------------------------------------------------------------------------------------
//        GBPUSD PREV DAY RANGE CALC

for (b= 0 ; b<= 24 ; b++)                               // scans the last 24 bars on eurusd
   {
      bartime = iTime ( "GBPUSD" , 60 , b);               // checks the open time of each bar
      scannedhour = TimeHour (bartime);                 // extracts the hour of that bar
    
       if ( scannedhour == iOpenHour )                     // Check to see if scanned hour = Dibs hour
         {
            dibsclose    = iOpen ( "GBPUSD" , 60 , b);     // Get the open value of that bar (Close of 6gmt day) 
            dibsopen    = iOpen ( "GBPUSD" , 60 , b+ 24 ); // Get the value of the bar 24 bars before the Dibs bar (Open of 6gmt day)
            prevdayrange[ 2 ] = (dibsclose-dibsopen);   // Calculate the range of the Dibs day
         }                                                   // End of if statement
    }                                                       // End of for statement



//----------------------------------------------------------------------------------------------
//        USDCHF PREV DAY RANGE CALC

for (b= 0 ; b<= 24 ; b++)                               // scans the last 24 bars on eurusd
   {
      bartime = iTime ( "EURUSD" , 60 , b);               // checks the open time of each bar
      scannedhour = TimeHour (bartime);                 // extracts the hour of that bar
    
       if ( scannedhour == iOpenHour )                     // Check to see if scanned hour = Dibs hour
         {
            dibsclose    = iOpen ( "USDCHF" , 60 , b);     // Get the open value of that bar (Close of 6gmt day) 
            dibsopen     = iOpen ( "USDCHF" , 60 , b+ 24 ); // Get the value of the bar 24 bars before the Dibs bar (Open of 6gmt day)
            prevdayrange[ 3 ] = (dibsclose-dibsopen);   // Calculate the range of the Dibs day
         }                                                   // End of if statement
    }                                                       // End of for statement



//----------------------------------------------------------------------------------------------
//        USDJPY PREV DAY RANGE CALC

for (b= 0 ; b<= 24 ; b++)                               // scans the last 24 bars on eurusd
   {
      bartime = iTime ( "USDJPY" , 60 , b);               // checks the open time of each bar
      scannedhour = TimeHour (bartime);                 // extracts the hour of that bar
    
       if ( scannedhour == iOpenHour )                     // Check to see if scanned hour = Dibs hour
         {
            dibsclose    = iOpen ( "USDJPY" , 60 , b);     // Get the open value of that bar (Close of 6gmt day) 
            dibsopen     = iOpen ( "USDJPY" , 60 , b+ 24 ); // Get the value of the bar 24 bars before the Dibs bar (Open of 6gmt day)
            prevdayrange[ 4 ] = (dibsclose-dibsopen);   // Calculate the range of the Dibs day
         }                                                   // End of if statement
    }                                                       // End of for statement


//----------------------------------------------------------------------------------------------



Comment ( "EURUSD RANGE=" , prevdayrange[ 1 ],         //Display Ranges of each pair
         "GBPUSD RANGE=" , prevdayrange[ 2 ],
         "USDCHF RANGE=" , prevdayrange[ 3 ],
         "USDJPY RANGE=" , prevdayrange[ 4 ]);      


   return ( 0 );
  }

Tamam, düzelttim, böylece prevdayrange tek dizi. Şimdi nedense kodun USDJPY bölümü çalışmıyor. Bu, iopen'daki çifti ve doğru dizi değerini değiştirdiği diğer 4 ifadeyle aynıdır...

İşte yaptığı şey ---> http://clip2net.com/s/13WDY

Yorum işlevine nasıl boşluk koyarsınız ve bir sonraki satıra yazdırmasını sağlayabilir misiniz?

 
dazamate :

Tamam, düzelttim, böylece prevdayrange tek dizi. Şimdi nedense kodun USDJPY bölümü çalışmıyor. Bu, iopen'daki çifti ve doğru dizi değerini değiştirdiği diğer 4 ifadeyle aynıdır...

İşte yaptığı şey ---> http://clip2net.com/s/13WDY

Yorum işlevine nasıl boşluk koyarsınız ve bir sonraki satıra yazdırmasını sağlayabilir misiniz?


Bir dizideki ilk eleman 0'dır, bir dizinin 4 elemanı varsa sonuncusu 4 değil 3 olur ;-) https://docs.mql4.com/basis/variables

Yorum()

 Comment ( "This adds some spaces " , "   " , "this adds a carriage return" , "\n" );
 

Pekala, bu kod, yeni bir 6:00 mumunun açılması dışında, ne anlama geldiğini hemen hemen yapıyor. Bilgileri güncellemez. Mevcut mum 6:00 mum ise, çubukların açıldığını ve 24 çubuk geriye gittiğini taramasını ve çubukların açıldığını taramasını ve tüm hesaplamaları yapmasını istiyorum ve mevcut çubuk 6:00 çubuğu değilse, geri adım atmaya devam edin son 6:00 mumunu bulana kadar bar. Geri adım atıyor gibi görünüyor ama şu anki mumun 6:00 olması hoş değil. Çözemiyorum. Efsaneler sorunu tespit edebilir mi?


Kod buraya gönderilemeyecek kadar genişliyor, bu yüzden kaynak kodunu yüklemek zorunda kaldım.

Dosyalar:
hothand.mq4  11 kb
 
dazamate :

Geri adım atıyor gibi görünüyor ama şu anki mumun 6:00 olması hoş değil. Çözemiyorum. Efsaneler sorunu tespit edebilir mi?


Bu, Strateji Test Cihazı'nı mı kullanıyor? olsaydı. . .

WHRoeder 2011.07.18 18:30

Tester Sınırlaması : Diğer zaman dilimleri veya çiftler için test cihazında sıfır bar verisi alamazsınız. Denemek:

 

Hayır Raptor bu canlı bir grafikteydi. Değiştirmeli miyim


 for (b= 0 ; b<= 24 ; b++) to for (b= -1 ; b<= 24 ; b++)
Sadece yüksek sesle düşünmek, bunun bir şeyi düzeltip düzeltmeyeceğinden emin değilim.
 
dazamate :

Hayır Raptor bu canlı bir grafikteydi. Değiştirmeli miyim


Sadece yüksek sesle düşünmek, bunun bir şeyi düzeltip düzeltmeyeceğinden emin değilim.
Ah, tamam, kodunuza tekrar bakacağım. . .
 
Bir sonraki saat değişikliğinde kodunuzu test edeceğim çünkü bariz bir şey göremiyorum. . . Sunucu saatiyle sabah 6'da kontrol ettiğinizden emin misiniz? yerel PC saati mutlaka Sunucu saati ile aynı saat değildir, sunucu saati kodunuzda ve çizelgelerinizde kullanılan saattir.
 

Her şey yolunda görünüyor, ancak mantıklıysa, geçerli çubuğun gerisinde olmadığı sürece 6:00 çubuğunu almayacak.


Zaman ayırdığınız için teşekkürler Raptor

 
dazamate :

Her şey yolunda görünüyor, ancak mantıklıysa, geçerli çubuğun gerisinde olmadığı sürece 6:00 çubuğunu almayacak.


Zaman ayırdığınız için teşekkürler Raptor

Evet sanırım ne dediğini anladım, saat 05:59'dan 06:00'a değişince güncellenmiyor. . .

Test için MBT kullanıyorum ve mevcut H1 çubuğu için Sunucu zamanı 04:00, bu yüzden iOpenHour'u 5'e ayarladım, 20 dakika içinde ne olacağını görelim.

 

Tamam, aynı sorunu yaşıyorum, mevcut mum 05:00'da açıldığında güncelleme yok. . . . ilginç.