OBJ_VLINE - sayfa 3

 

Yardım için çok teşekkürler Marco, nedense işe yarıyor

Zamanı D' biçiminde yapılandırdım, ardından bu bilgiyi bir uyarı olarak görüntüledim, ancak ok zamanlarıyla eşleştiğini görebilirsiniz.

V-Line hala mevcut mum üzerinde yaratılıyor .. ekran görüntüsüne bakın


kullandığım kod bu

 ObjectDelete ( 0 , "v_line1" );
         ObjectDelete ( 0 , "v_line2" );
        
        
         datetime TimeExit_SymSymbol = ( datetime ) ObjectGetInteger ( 0 , Exit_SymSymbol, OBJPROP_TIME1);
         MqlDateTime str1;
         TimeToStruct (TimeExit_SymSymbol,str1);
         int Year = str1.year;
         int Month = str1.mon;
         int Day = str1.day;
         int Hour = str1.hour;
         int Minutes = str1.min;
         int Seconds = str1.sec;
        
         string V1DateString= "D'" +str1.year+ "." +str1.mon+ "." +str1.day+ " " + str1.hour+ ":" + str1.min+ "'" ; //+":"+str1.sec+"'";
         
         ObjectCreate ( 0 , "v_line1" , OBJ_VLINE , 0 , V1DateString, High[ 0 ]);
         ObjectCreate ( 0 , "v_line2" , OBJ_VLINE , 0 , StringToTime (V1DateString), High[ 0 ]);
         Alert (V1DateString);


 
İşte ilgili bir konu: https://www.mql5.com/en/forum/233876
Vline 50 bars after the current time/bar
Vline 50 bars after the current time/bar
  • 2018.03.31
  • www.mql5.com
Hi there, I come to you to ask you : How can i draw a VLINE on the 50th (or Xth) bar in the future...
 
Marco vd Heijden :
İşte ilgili bir konu: https://www.mql5.com/en/forum/233876

Kaymayı bildiğim için grafikte zaten v-çizgilerim var, bağlantıdaki konuda vardiyayı kullanarak v-çizgileri çizdiler

Daha önceki yazılarımda, VPS yeniden başladığında veya hafta sonları veya bazen MT4 yeniden başlatırken oluşturduğum v-line'ları kaybettiğimden bahsetmiştim, bu yüzden v-line'ların tarihlerini, kaybolurlarsa daha sonra yeniden oluşturmaya çalışmak için kaydediyorum. .

Görünüşe göre MT4 metin tarihlerinden v-satırları oluşturma yeteneğine sahip değil ya da nasıl yapıldığını henüz kimse çözemedi.

 
Alpha Beta :

Daha önceki yazılarımda, VPS yeniden başladığında veya hafta sonları veya bazen MT4 yeniden başlatırken oluşturduğum v-line'ları kaybettiğimden bahsetmiştim, bu yüzden v-line'ların tarihlerini, kaybolurlarsa daha sonra yeniden oluşturmaya çalışmak için kaydediyorum. .

Tarihleri şu şekilde kaydettiyseniz:

 datetime TimeExit_SymSymbol = ( datetime ) ObjectGetInteger ( 0 , Exit_SymSymbol, OBJPROP_TIME1);

Burada v-satırlarını yeniden oluşturmak için TimeExit_SymSymbol'dan saniye basamaklarını ayırmanız gerekmez..ObjectCreate() tarafından yapılır , çünkü saniyeler sürmez.

Kodlarınızı şu şekilde basitleştirebilirsiniz:

 ObjectDelete ( 0 , "v_line1" );
ObjectCreate ( 0 , "v_line1" , OBJ_VLINE , 0 , TimeExit_SymSymbol, 0 );
 

Hızlıca bir senaryo denedim ve bu kesinlikle çizgiyi geleceğe çekiyor.

 //+------------------------------------------------------------------+
//|                                                        Vline.mq4 |
//|        Copyright 2019, MarcovdHeijden, MetaQuotes Software Corp. |
//|                   https://www.mql5.com/en/users/thecreator1/news |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MarcovdHeijden, MetaQuotes Software Corp."
#property link        "https://www.mql5.com/en/users/thecreator1/news"
#property version    "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart ()
  {
//--- assemble time parameter
   datetime time=Time[ 0 ]+ 50 * PeriodSeconds ();
//--- create v line
   VLineCreate( 0 , "V-Line-" + TimeToString (time, TIME_DATE ), 0 ,time);
//---   
  }
//+------------------------------------------------------------------+ 
//| Create the vertical line                                         | 
//+------------------------------------------------------------------+ 
bool VLineCreate( const long             chart_ID= 0 , // chart's ID 
                 const string           name= "VLine" ,       // line name 
                 const int              sub_window= 0 ,       // subwindow index 
                 datetime               _time= 0 , // line time 
                 const color            clr= clrRed ,         // line color 
                 const ENUM_LINE_STYLE style= STYLE_SOLID , // line style 
                 const int              width= 1 ,           // line width 
                 const bool             back= false ,         // in the background 
                 const bool             selection= false , // highlight to move 
                 const bool             ray= true ,           // line's continuation down 
                 const bool             hidden= true ,       // hidden in the object list 
                 const long             z_order= 0 )         // priority for mouse click 
  {
//--- if the line time is not set, draw it via the last bar 
   if (!_time)
      _time= TimeCurrent ();
//--- reset the error value 
   ResetLastError ();
//--- create a vertical line 
   if (! ObjectCreate (chart_ID,name, OBJ_VLINE ,sub_window,_time, 0 ))
     {
       Print ( __FUNCTION__ ,
             ": failed to create a vertical line! Error code = " , GetLastError ());
       return ( false );
     }
//--- set line color 
   ObjectSetInteger (chart_ID,name, OBJPROP_COLOR ,clr);
//--- set line display style 
   ObjectSetInteger (chart_ID,name, OBJPROP_STYLE ,style);
//--- set line width 
   ObjectSetInteger (chart_ID,name, OBJPROP_WIDTH ,width);
//--- display in the foreground (false) or background (true) 
   ObjectSetInteger (chart_ID,name, OBJPROP_BACK ,back);
//--- enable (true) or disable (false) the mode of moving the line by mouse 
//--- when creating a graphical object using ObjectCreate function, the object cannot be 
//--- highlighted and moved by default. Inside this method, selection parameter 
//--- is true by default making it possible to highlight and move the object 
   ObjectSetInteger (chart_ID,name, OBJPROP_SELECTABLE ,selection);
   ObjectSetInteger (chart_ID,name, OBJPROP_SELECTED ,selection);
//--- enable (true) or disable (false) the mode of displaying the line in the chart subwindows 
   ObjectSetInteger (chart_ID,name, OBJPROP_RAY ,ray);
//--- hide (true) or display (false) graphical object name in the object list 
   ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN ,hidden);
//--- set the priority for receiving the event of a mouse click in the chart 
   ObjectSetInteger (chart_ID,name, OBJPROP_ZORDER ,z_order);
//--- successful execution 
   return ( true );
  }
//+------------------------------------------------------------------+ 
//| Move the vertical line                                           | 
//+------------------------------------------------------------------+ 
bool VLineMove( const long    chart_ID= 0 , // chart's ID 
               const string name= "VLine" , // line name 
               datetime      _time= 0 ) // line time 
  {
//--- if line time is not set, move the line to the last bar 
   if (!_time)
      _time= TimeCurrent ();
//--- reset the error value 
   ResetLastError ();
//--- move the vertical line 
   if (! ObjectMove (chart_ID,name, 0 ,_time, 0 ))
     {
       Print ( __FUNCTION__ ,
             ": failed to move the vertical line! Error code = " , GetLastError ());
       return ( false );
     }
//--- successful execution 
   return ( true );
  }
//+------------------------------------------------------------------+ 
//| Delete the vertical line                                         | 
//+------------------------------------------------------------------+ 
bool VLineDelete( const long    chart_ID= 0 , // chart's ID 
                 const string name= "VLine" ) // line name 
  {
//--- reset the error value 
   ResetLastError ();
//--- delete the vertical line 
   if (! ObjectDelete (chart_ID,name))
     {
       Print ( __FUNCTION__ ,
             ": failed to delete the vertical line! Error code = " , GetLastError ());
       return ( false );
     }
//--- successful execution 
   return ( true );
  }
//+------------------------------------------------------------------+ 
 
Marco vd Heijden :

Hızlıca bir senaryo denedim ve bu kesinlikle çizgiyi geleceğe çekiyor.

Sevgili Marco,

Mevcut çubukla ilgili kaydırmayı kullanıyorsunuz, bu, çizelgelerim için V-Çizgileri oluşturmak için kullandığım yöntemle aynı, ancak sorun, vardiyayı bilmeden ve mevcut zamana/çubuğa başvurmadan V-Çizgisini oluşturmaktır. , sorun SADECE saati/tarihi bilerek V-Lines oluşturmaktır.

Bazen VPS yeniden başladığında ve diğer zamanlarda hafta sonu boyunca v-çizgilerini kaybettiğim için, bulabildiğim tek seçenek, çizelgedeki çizgilerin saatini/tarihini kaydetmek ve sonra onları yeniden oluşturmaya çalışmak, kaydederek barlar ilerledikçe vardiya pek yardımcı olmaz ve ayrıca hafta sonu barları da vardır.

MT4'e göre ( https://www.mql5.com/en/docs/objects/objectcreate ) V-Line sadece saat/tarih kullanılarak oluşturulabilir .. Nasıl yapıldığını görmek istiyorum çünkü görmedim her yerde ve şanssız yoruldum

Documentation on MQL5: Object Functions / ObjectCreate
Documentation on MQL5: Object Functions / ObjectCreate
  • www.mql5.com
The function creates an object with the specified name, type, and the initial coordinates in the specified chart subwindow. During creation up to 30 coordinates can be specified. The function returns true if the command has been successfully added to the queue of the specified chart, or false otherwise. If an object has already been created, an...
 

Sonunda nasıl yapıldığını anladım

eğer birisi sadece saati/tarihi kullanarak V-Line çizmek isterse kod burada

         // InputDateTime= is the time you want to use to draw the VLine
       
         datetime TimeVLineFile = ( datetime ) ObjectGetInteger ( 0 , InputDateTime, OBJPROP_TIME1);
         MqlDateTime str1;
         TimeToStruct (TimeVLineFile ,str1);
         int Year = str1.year;
         int Month = str1.mon;
         int Day = str1.day;
         int Hour = str1.hour;
         int Minutes = str1.min;
         int Seconds = str1.sec;
        
      
   
         string VLineDateFormat= str1.year+ "." +str1.mon+ "." +str1.day+ " " + str1.hour+ ":" + str1.min; 
         
         
         ObjectCreate ( 0 , "L3" , OBJ_VLINE , 0 , StringToTime (VLineDateFormat), High[ 0 ]);
 
Alpha Beta :

Sonunda nasıl yapıldığını anladım

eğer birisi sadece saati/tarihi kullanarak V-Line çizmek isterse kod burada

  1. Bu böyle yapılmaz. tek yaptığın
    1. Bir tarih saat alın ve onu struct'a dönüştürün.
    2. Yapıyı alın ve bir dizgeye dönüştürün ( saniyeler olmadan.)
    3. Dizeyi alın ve orijinal tarih saatine geri dönüştürün (saniyeler olmadan).
     datetime TimeVLineFile = ( datetime ) ObjectGetInteger ( 0 , InputDateTime, OBJPROP_TIME1);
    MqlDateTime str1;
    TimeToStruct (TimeVLineFile ,str1);
    int Year = str1.year;
    int Month = str1.mon;
    int Day = str1.day;
    int Hour = str1.hour;
    int Minutes = str1.min;
    int Seconds = str1.sec;
    
    string VLineDateFormat= str1.year+ "." +str1.mon+ "." +str1.day+ " " + str1.hour+ ":" + str1.min ;   
    
    ObjectCreate ( 0 , "L3" , OBJ_VLINE , 0 , StringToTime ( VLineDateFormat ), High[ 0 ]);

  2. Tek istediğiniz saniyeleri kaldırmaksa , bu böyle yapılır:
     datetime TimeVLineFile = ( datetime ) ObjectGetInteger ( 0 , InputDateTime, OBJPROP_TIME1);
    datetime TimeVLineSansSeconds = TimeVlineFile - TimeVlineFile % 60 ;
    
    ObjectCreate ( 0 , "L3" , OBJ_VLINE , 0 , TimeVLineSansSeconds, High[ 0 ]);
 
William Roeder :
  1. Bu böyle yapılmaz. tek yaptığın
    1. Bir tarih saat alın ve onu struct'a dönüştürün.
    2. Yapıyı alın ve bir dizgeye dönüştürün ( saniyeler olmadan.)
    3. Dizeyi alın ve orijinal tarih saatine geri dönüştürün (saniyeler olmadan).

  2. Tek istediğiniz saniyeleri kaldırmaksa , bu böyle yapılır:

Önceki gönderilerime baktıysanız, saniyeleri kaldırmaktan yorulduğumu göreceksiniz, ancak işe yaramadı, ancak dönüştürmeden sonra kod çalıştı, neyin yanlış olduğundan emin değilim,

Kodun sürümünü beğendim, basit, zarif ve iyi çalışıyor, teşekkürler

 
Bu, bir işaretçide grafik makaleleri ilk kez kullanıyorum. Normalde "22:00" de dikey bir çizgi çizmem gerekecek, lütfen beni bir cevaba yönlendirebilir misiniz?
Neden: