İlginç bir ticaret fikri var. Koddaki hataları bulmama yardım et (mql4). - sayfa 15

 
Alexander Zakharov :

Lütfen bana tanımlanamayan bir değişkenin çökmesine ilişkin bir hata söyleyin, nasıl düzeltilir, MQL4 ile pek arkadaşça değilim


//lot hesaplama

if(MarketInfo(Symbol(),MODE_LOTSTEP)==0.01) int rakam=2;

if(MarketInfo(Symbol(),MODE_LOTSTEP)==0.10) int rakam=1;

if(MarketInfo(Symbol(),MODE_LOTSTEP)==1.00) int digit=0;

double _lot =NormalizeDouble(lot* MathPow(koef,toplamO(-1,anahtar)), basamak ) ; Burada bu değişkenin girdisini daha önce görmez (

double min=MarketInfo(Symbol(),MODE_MINLOT);

if(_lot<min)_lot=min;

işte parti normalleştirme fonksiyonu

 double volume_n( string symbol, double lot)
  {
   double MinLot= SymbolInfoDouble (symbol, SYMBOL_VOLUME_MIN );
   double MaxLot= SymbolInfoDouble (symbol, SYMBOL_VOLUME_MAX );
   double LotStep= SymbolInfoDouble (symbol, SYMBOL_VOLUME_STEP );

   if (lot<MinLot)lot=MinLot;
   if (lot>MaxLot)lot=MaxLot;

   if (LotStep== 0.001 ) return ( NormalizeDouble (lot, 3 ));
   if (LotStep== 0.01 )   return ( NormalizeDouble (lot, 2 ));
   if (LotStep== 0.1 )   return ( NormalizeDouble (lot, 1 ));

   return ( NormalizeDouble (lot, 0 ));
  }

başvuru

 double _lot=volume_n( _Symbol ,lot* MathPow (koef,totalO(- 1 ,key))
 
Sergey Gritsay :

işte parti normalleştirme fonksiyonu

Uygulama Teşekkürler

 
Sergey Gritsay :
Bar modu düzeltildi. MT5 versiyonunda THV4 trend göstergesi eklendi
Bu test cihazını her yönden büktüm - birleşiyor ... yalnızca Satın Al için bir sinyal bırakırsanız ... aşağı yukarı sürer ve trol çok uzun çalışır ... arkasında sıfır bırakır ...
 
Сергей Криушин :
Bu test cihazını her yönden büktüm - birleşiyor ... yalnızca Satın Al için bir sinyal bırakırsanız ... aşağı yukarı sürer ve trol çok uzun çalışır ... arkasında sıfır bırakır ...
d anlamında uzun süre çalışıyor, hangi sıfırları bırakıyor?
 
Sergey Gritsay :

işte parti normalleştirme fonksiyonu

başvuru

Daha zarif bir çözüm var:

 double volume_step= SymbolInfoDouble ( _Symbol , SYMBOL_VOLUME_STEP );
int volume_digits=( int )( MathLog ( 1.0 /volume_step)/ MathLog ( 10.0 ));
 
Sergey Gritsay :
d anlamında uzun süre çalışıyor, hangi sıfırları bırakıyor?

Kar = 0.0

 2016.03 . 14 12 : 35 : 31      64321035         USDCHF  sell     in        0.05      0.98764 78568040          0.00      0.00      0.00      63 366.94        
2016.03 . 14 13 : 00 : 34      64323324         GBPUSD  buy     in        0.01      1.43567 78570253          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 00 : 55      64323378         USDJPY  buy     in        0.01      113.688 78570307          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 00 : 56      64323380         NZDUSD  sell     in        0.01      0.67134 78570308          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 01 : 14      64323403         CHFJPY  buy     in        0.01      115.162 78570331          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 01 : 15      64323406         EURGBP  buy     in        0.01      0.77432 78570334          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 01 : 16      64323408         EURJPY  buy     in        0.01      126.363 78570336          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 01 : 17      64323409         EURUSD  buy     in        0.01      1.11148 78570337          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 01 : 18      64323410         GBPJPY  buy     in        0.01      163.208 78570338          0.00      0.00      0.00      63 366.94        exp_cci
2016.03 . 14 13 : 01 : 18      64323412         EURJPY  sell     out      0.01      126.356 78570340          0.00      0.00     - 0.06    63 366.88        
2016.03 . 14 13 : 01 : 21      64323417         USDSEK  sell     in        0.01      8.35246 78570345          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 13 : 01 : 21      64323418         USDZAR  sell     in        0.01      15.35749          78570346          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 13 : 07 : 25      64323874         GBPUSD  sell     out      0.01      1.43567 78570786          0.00      0.00      0.00      63 366.88        [sl 1.43567 ]
2016.03 . 14 13 : 09 : 06      64323946         USDCHF  buy     out      0.05      0.98764 78570855          0.00      0.00      0.00      63 366.88        [sl 0.98764 ]
2016.03 . 14 13 : 23 : 54      64324855         USDCHF  sell     in        0.01      0.98745 78571736          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 14 : 00 : 00      64328785         AUDUSD  buy     in        0.01      0.75339 78575571          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 14 : 00 : 05      64328795         GBPUSD  buy     in        0.01      1.43463 78575585          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 14 : 00 : 05      64328797         AUDCAD  buy     in        0.01      0.99889 78575587          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 14 : 00 : 07      64328802         EURJPY  buy     in        0.01      126.311 78575592          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 14 : 00 : 07      64328805         USDMXN  sell     in        0.01      17.76137          78575595          0.00      0.00      0.00      63 366.88        exp_cci
2016.03 . 14 14 : 00 : 08      64328807         USDZAR  buy     out      0.01      15.42380          78575597          0.00      0.00     - 4.30    63 362.58        
2016.03 . 14 14 : 00 : 08      64328808         EURJPY  sell     out      0.01      126.301 78575598          0.00      0.00     - 0.09    63 362.49        
2016.03 . 14 14 : 00 : 11      64328812         USDHKD  sell     in        0.09      7.75715 78575601          0.00      0.00      0.00      63 362.49        exp_cci
2016.03 . 14 14 : 00 : 12      64328813         USDZAR  buy     in        0.01      15.42351          78575602          0.00      0.00      0.00      63 362.49        exp_cci
2016.03 . 14 14 : 04 : 12      64329157         GBPUSD  sell     out      0.01      1.43463 78575943          0.00      0.00      0.00      63 362.49        [sl 1.43463 ]
2016.03 . 14 14 : 04 : 50      64329180         GBPUSD  buy     in        0.01      1.43462 78575964          0.00      0.00      0.00      63 362.49        exp_cci
2016.03 . 14 14 : 05 : 43      64329266         EURJPY  buy     in        0.01      126.360 78576048          0.00      0.00      0.00      63 362.49        exp_cci
2016.03 . 14 14 : 15 : 01      64330159         USDCAD  buy     in        0.01      1.32450 78576911          0.00      0.00      0.00      63 362.49        exp_cci
2016.03 . 14 14 : 15 : 02      64330160         EURJPY  sell     out      0.01      126.429 78576913          0.00      0.00      0.61      63 363.10        
2016.03 . 14 14 : 15 : 04      64330169         USDSEK  buy     out      0.01      8.35081 78576922          0.00      0.00      0.20      63 363.30        
2016.03 . 14 14 : 15 : 26      64330196         USDMXN  buy     out      0.01      17.76283          78576946          0.00      0.00     - 0.08    63 363.22        
2016.03 . 14 14 : 30 : 00      64331460         AUDCAD  sell     out      0.01      0.99792 78578213          0.00      0.00     - 0.73    63 362.49        
2016.03 . 14 14 : 30 : 02      64331464         GBPCAD  sell     in        0.01      1.89854 78578217          0.00      0.00      0.00      63 362.49        exp_cci
2016.03 . 14 14 : 30 : 04      64331472         AUDUSD  sell     out      0.01      0.75491 78578225          0.00      0.00      1.52      63 364.01        
        
 
Сергей Криушин :

Kar = 0.0

Belki giriş parametrelerini yanlış ayarlıyorsunuz, benim için her şey yolunda

 
Sergey Gritsay :

Belki giriş parametrelerini yanlış ayarlıyorsunuz, benim için her şey yolunda

Değişiklikler şunlardır:

  
input ENUM_TYPE_BALANS Type_Balanse=Balance;
input double Risk= 0.5 ;
input double _Lot= 0.04 ;
input double Loading_deposit= 20.0 ;
input double Ksl= 8.0 ;
input double Ktp= 2.0 ;
input int TotalLossSeries= 16 ;
input bool TrailingStop= true ;
input bool CloseSignal= true ;
input ENUM_TYPE_INDICATOR IndicatorTrend=CCI;
input int period_CCI_S= 90 ;
input int period_CCI_F= 13 ;
input int Period_ATR= 35 ;
input ENUM_TIMEFRAMES TF_ATR= PERIOD_CURRENT ;
input bool signal_01= true ;
input bool signal_02= true ;
input bool signal_03= true ;
input bool signal_04= true ;
input bool signal_05= true ;
input string CommentOrder= "exp_cci" ;
input color ColorText= clrBlack ;
input string symbol_tester= "EURUSD,AUDUSD,USDJPY,USDCAD" ;

//Уменьшил уровень до 90 - чтоб надежней срабатывал 
if (trend[index]== ORDER_TYPE_BUY )
     {
       if (signal_01 && cci_f[ 1 ]<- 90.0 ) return ( ORDER_TYPE_BUY );
       if (signal_02 && cci_f[ 1 ]<- 90.0 && cci_f[ 0 ]>- 90.0 ) return ( ORDER_TYPE_BUY );
       if (signal_03 && cci_f[ 1 ]>- 90.0 && cci_f[ 0 ]<- 90.0 ) return ( ORDER_TYPE_BUY );
       if (signal_04 && cci_f[ 1 ]> 90.0 && cci_f[ 0 ]< 90.0 ) return ( ORDER_TYPE_BUY );
       if (signal_05 && cci_f[ 1 ]> 90.0 ) return ( ORDER_TYPE_BUY );
     }
   if (trend[index]== ORDER_TYPE_SELL )
     {
       if (signal_01 && cci_f[ 1 ]> 90 ) return ( ORDER_TYPE_SELL );
       if (signal_02 && cci_f[ 1 ]> 90 && cci_f[ 0 ]< 90 ) return ( ORDER_TYPE_SELL );
       if (signal_03 && cci_f[ 1 ]< 90 && cci_f[ 0 ]> 90 ) return ( ORDER_TYPE_SELL );
       if (signal_04 && cci_f[ 1 ]<- 90 && cci_f[ 0 ]>- 90 ) return ( ORDER_TYPE_SELL );
       if (signal_05 && cci_f[ 1 ]<- 90 ) return ( ORDER_TYPE_SELL );
     }
 
Сергей Криушин :

Değişiklikler şunlardır:

Bu ayarlarla

 input double Ksl= 8.0 ;
input double Ktp= 2.0 ;

Özel bir anlamı olmadığı için takip tamamen devre dışı bırakılabilir

 
MT5 sürümündeki sabit hatalar
Dosyalar: