MQL4 ve MQL5 ile ilgili herhangi bir acemi sorusu, algoritmalar ve kodlar hakkında yardım ve tartışma - sayfa 729

 
Igor Makanu :

kopyalamak yardımcı olmaz, okumanız gerekiyor, işte makale https://www.mql5.com/ru/articles/1456

Tamamen görsel ve bilgilendirme amaçlı kullanılacaktır.

 
Carcass77 :

Tamamen görsel ve bilgilendirme amaçlı kullanılacaktır.

 //+------------------------------------------------------------------+
//|                                                    atrValues.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict

extern int atrPeriod= 10 ;
extern int infoCorner= 0 ;
extern int shift= 0 ;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
//---
   
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  {
//---
   double atr1= iATR ( Symbol (), 1 ,atrPeriod,shift);
   double atr5= iATR ( Symbol (), 5 ,atrPeriod,shift);
   double atr15= iATR ( Symbol (), 15 ,atrPeriod,shift);
   double atr30= iATR ( Symbol (), 30 ,atrPeriod,shift);
   double atr60= iATR ( Symbol (), 60 ,atrPeriod,shift);
   double atr240= iATR ( Symbol (), 240 ,atrPeriod,shift);
   double atr1440= iATR ( Symbol (), 1440 ,atrPeriod,shift);
   double atr10080= iATR ( Symbol (), 10080 ,atrPeriod,shift);
   double atr43200= iATR ( Symbol (), 43200 ,atrPeriod,shift);
//---
   ObjectCreate ( "ObjName1" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName1" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M1=" + DoubleToStr (atr1, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName1" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName1" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName1" , OBJPROP_YDISTANCE , 25 );
//---
   ObjectCreate ( "ObjName2" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName2" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M5=" + DoubleToStr (atr5, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName2" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName2" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName2" , OBJPROP_YDISTANCE , 40 );
//---
   ObjectCreate ( "ObjName3" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName3" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M15=" + DoubleToStr (atr15, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName3" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName3" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName3" , OBJPROP_YDISTANCE , 55 );
//---
   ObjectCreate ( "ObjName4" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName4" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M30=" + DoubleToStr (atr30, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName4" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName4" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName4" , OBJPROP_YDISTANCE , 70 );
//---
   ObjectCreate ( "ObjName5" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName5" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M60=" + DoubleToStr (atr60, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName5" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName5" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName5" , OBJPROP_YDISTANCE , 85 );
//---
   ObjectCreate ( "ObjName6" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName6" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M240=" + DoubleToStr (atr240, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName6" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName6" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName6" , OBJPROP_YDISTANCE , 100 );
//---
   ObjectCreate ( "ObjName7" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName7" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M1440=" + DoubleToStr (atr1440, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName7" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName7" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName7" , OBJPROP_YDISTANCE , 115 );
//---
   ObjectCreate ( "ObjName8" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName8" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M10080=" + DoubleToStr (atr10080, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName8" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName8" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName8" , OBJPROP_YDISTANCE , 130 );
//---
   ObjectCreate ( "ObjName9" , OBJ_LABEL , 0 , 0 , 0 );
   ObjectSetText ( "ObjName9" , "ATR" + IntegerToString (atrPeriod, 0 )+ ": M43200=" + DoubleToStr (atr43200, 5 ), 8 , "Verdana" ,Red);
   ObjectSet ( "ObjName9" , OBJPROP_CORNER ,infoCorner);
   ObjectSet ( "ObjName9" , OBJPROP_XDISTANCE , 10 );
   ObjectSet ( "ObjName9" , OBJPROP_YDISTANCE , 145 );
//--- 
  }
//+------------------------------------------------------------------+
 
Alekseu Fedotov :

Bir sürü hata çıktı)

 
Carcass77 :

Bir sürü hata çıktı)

Benim için iyi derleniyor.

 
Alekseu Fedotov :

Benim için iyi derleniyor.

Hatamı buldum. Çok teşekkürler!

 
Açık olmayan türden nesneler içeren bir sınıf şablonu içindeki T1 nesnesinin yöntemlerinden herhangi birini nasıl çağırabilirim (yani nesnelerin türü açıkça ayarlanmaz, ancak şablon<tipadı T1> aracılığıyla belirlenir)? T1 türündeki tüm nesneler aynı yöntemlere sahiptir.
 
Igor Makanu :

açık, elde terminal yok, ancak kırmızı görünüyor, yalnızca meta düzenleyicideki hata günlükleri vurgulanıyor ve terminalde ve test cihazında yalnızca simge kırmızı ve metnin kendisi "kızarmış" görünmüyor

Peki, o yazıyor:
(siyah renkle vurgulanmıştır)

INIT_PARAMETERS_YANLIŞ

Programcının yanlış bir dizi giriş parametresini göstermesi amaçlanmıştır; genel optimizasyon tablosunda, böyle bir dönüş koduna sahip sonuç satırı kırmızı ile vurgulanacaktır.

Bu uzman parametre seti için test yapılmayacaktır.


Ve işte genel optimizasyon tablosu:




Kırmızı hiçbir şeyi vurgulamaz.

Sadece bu tür satırlarda optimizasyon sonucu sıfıra eşittir.


Kılavuz yanlış mı yoksa yanlış bir şey mi yapıyorum?

 
Anahtarları yeniden atamak için girişte bir şekilde görüntüleyebilir miyim?
 
Roman Sharanov :
Anahtarları yeniden atamak için girişte bir şekilde görüntüleyebilir miyim?

Yapabilir.

 #property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
#property indicator_chart_window
//--- input parameters

input string       key = "A" ;

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[])
  {
//---
   
//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+
void OnChartEvent ( const int id,
                   const long &lparam,
                   const double &dparam,
                   const string &sparam)
  {

   if (id== CHARTEVENT_KEYDOWN )
     {
       if (lparam==( StringGetChar (key, 0 )))
        {
         Alert ( "нажатая клавиша = " ,key);
         Alert ( "код нажатой клавиши = " , StringGetChar (key, 0 ));
        }
     }
  }
//+------------------------------------------------------------------+
 
multiplicator :

Peki, o yazıyor:
(siyah renkle vurgulanmıştır)

INIT_PARAMETERS_YANLIŞ

Programcının yanlış bir dizi giriş parametresini göstermesi amaçlanmıştır; genel optimizasyon tablosunda, böyle bir dönüş koduna sahip sonuç satırı kırmızı ile vurgulanacaktır.

Bu uzman parametre seti için test yapılmayacaktır.


Ve işte genel optimizasyon tablosu:




Kırmızı hiçbir şeyi vurgulamaz.

Sadece bu tür satırlarda optimizasyon sonucu sıfıra eşittir.


Kılavuz yanlış mı yoksa yanlış bir şey mi yapıyorum?

Şimdi hiçbir şeyin vurgulanmadığı ve bu konuda kılavuzla çelişmediği açıktır.