Yeni başlayanlardan sorular MQL5 MT5 MetaTrader 5 - sayfa 19

 

Merhaba.

lütfen bana bu sorunu nasıl çözeceğimi söyleyin: aşağıdaki parametreler için bir danışman oluşturmak için

  1. belirli bir zaman diliminde belirli bir mum çubuğunun analizi (yükseliş/düşüş),
  2. bu mumun belirli bir zaman diliminde açılış fiyatı seviyesinden işlem yapması.
örneğin: H1'de 12 saatlik bir mum düşüş eğiliminde, açılış fiyatı 1.2000. 16 ila 18 arasındaki dönemde anlamına gelir - satış .. vb.

teşekkür etmek.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы - Документация по MQL5
 

Beyler, şampiyonanın kodunu hazırlıyorum. Indica ile dost olan, bir göz atın, plz. İndica'ya takmak. 4-ke'de her şey yolunda gidiyor, ilk beşte - hiçbir şey çizmiyor. Bu, oranlarla çarpılan ve açık, yüksek, düşük, yakın değerlerle toplanan farklı çiftlerden MA farkının bir göstergesidir. İlk gönderiyi yazdım - tüm bilgiler bir tanesine dahil edilmedi - ekran uçtu ve hepsi bu.

iki tane yapacağım. Eurobucks grafiğine atıyorum ve orada burada, H1'de beşte hiç bir şey çekmiyor.

Yorum - aşağıdan sıfır geçiş - satın almak, ters geçiş - satmak - bu ilk seçenektir. İkincisi, bükülmelerdeki bir giriştir - ekstremum sıfırın altındaysa, o zaman satın al, eğer sıfırın üzerindeyse - sat. Çalışmalarım sonuna kadar yürütülüyor, piyasaya giriş koşulları henüz resmileşmedi.

4-ke'de - her şey yolunda! Gösterge kodunu beşe çevirirken, diğerlerinin yanı sıra bu makalenin materyallerini kullandım.

Bir yerde kodda bir hata yaptım.


Beşte sessizlik...


 

Römork gösterge kodları dahil değildir.

İşte solucandaki kod - her şey yolunda gidiyor:

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Green

extern int M= 56 ;
extern int F= 9 ;
extern double kUSD= 1 ;
extern double kGBP= 1 ;
extern double kJPY= 1 ;
extern double kEUR= 1 ;
  
double pair[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle( 0 , DRAW_SECTION ,Yellow);
   SetIndexBuffer ( 0 ,pair);
   IndicatorShortName( Symbol () + "(" + Period () + "): " );
   SetIndexLabel( 0 , Symbol ()); 
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
     
     int limit;
     int counted_bars=IndicatorCounted();
     double OPEN,HIGH,LOW,CLOSE;

     if (counted_bars< 0 ) return (- 1 );
   //---- последний посчитанный бар будет пересчитан
     if (counted_bars> 0 ) counted_bars--;
     limit= Bars -counted_bars;
   //---- основной цикл
     int Price= 6 ; 
     int Mode= 3 ;
     int per1,per2;
     per1=M;per2=F; 
     for ( int i= 0 ; i<limit; i++)
       {
         if ( Symbol () == "EURUSD" ){
               OPEN=EUR(Mode, PRICE_OPEN ,i,per1,per2)-USD(Mode, PRICE_OPEN ,i,per1,per2);
               HIGH=EUR(Mode, PRICE_HIGH ,i,per1,per2)-USD(Mode, PRICE_HIGH ,i,per1,per2);
               LOW=EUR(Mode, PRICE_LOW ,i,per1,per2)-USD(Mode, PRICE_LOW ,i,per1,per2);
               CLOSE=EUR(Mode, PRICE_CLOSE ,i,per1,per2)-USD(Mode, PRICE_CLOSE ,i,per1,per2);
         }
         if ( Symbol () == "EURGBP" ){
               OPEN=EUR(Mode, PRICE_OPEN ,i,per1,per2)-GBP(Mode, PRICE_OPEN ,i,per1,per2);
               HIGH=EUR(Mode, PRICE_HIGH ,i,per1,per2)-GBP(Mode, PRICE_HIGH ,i,per1,per2);
               LOW=EUR(Mode, PRICE_LOW ,i,per1,per2)-GBP(Mode, PRICE_LOW ,i,per1,per2);
               CLOSE=EUR(Mode, PRICE_CLOSE ,i,per1,per2)-GBP(Mode, PRICE_CLOSE ,i,per1,per2);
         }
        
         if ( Symbol () == "EURJPY" ){
               OPEN=EUR(Mode, PRICE_OPEN ,i,per1,per2)-JPY(Mode, PRICE_OPEN ,i,per1,per2);
               HIGH=EUR(Mode, PRICE_HIGH ,i,per1,per2)-JPY(Mode, PRICE_HIGH ,i,per1,per2);
               LOW=EUR(Mode, PRICE_LOW ,i,per1,per2)-JPY(Mode, PRICE_LOW ,i,per1,per2);
               CLOSE=EUR(Mode, PRICE_CLOSE ,i,per1,per2)-JPY(Mode, PRICE_CLOSE ,i,per1,per2);
         }
         if ( Symbol () == "GBPUSD" ){
               OPEN=GBP(Mode, PRICE_OPEN ,i,per1,per2)-USD(Mode, PRICE_OPEN ,i,per1,per2);
               HIGH=GBP(Mode, PRICE_HIGH ,i,per1,per2)-USD(Mode, PRICE_HIGH ,i,per1,per2);
               LOW=GBP(Mode, PRICE_LOW ,i,per1,per2)-USD(Mode, PRICE_LOW ,i,per1,per2);
               CLOSE=GBP(Mode, PRICE_CLOSE ,i,per1,per2)-USD(Mode, PRICE_CLOSE ,i,per1,per2);
         }
        
         if ( Symbol () == "GBPJPY" ){
               OPEN=GBP(Mode, PRICE_OPEN ,i,per1,per2)-JPY(Mode, PRICE_OPEN ,i,per1,per2);
               HIGH=GBP(Mode, PRICE_HIGH ,i,per1,per2)-JPY(Mode, PRICE_HIGH ,i,per1,per2);
               LOW=GBP(Mode, PRICE_LOW ,i,per1,per2)-JPY(Mode, PRICE_LOW ,i,per1,per2);
               CLOSE=GBP(Mode, PRICE_CLOSE ,i,per1,per2)-JPY(Mode, PRICE_CLOSE ,i,per1,per2);
         }
         
         if ( Symbol () == "USDJPY" ){
               OPEN=USD(Mode, PRICE_OPEN ,i,per1,per2)-JPY(Mode, PRICE_OPEN ,i,per1,per2);
               HIGH=USD(Mode, PRICE_HIGH ,i,per1,per2)-JPY(Mode, PRICE_HIGH ,i,per1,per2);
               LOW=USD(Mode, PRICE_LOW ,i,per1,per2)-JPY(Mode, PRICE_LOW ,i,per1,per2);
               CLOSE=USD(Mode, PRICE_CLOSE ,i,per1,per2)-JPY(Mode, PRICE_CLOSE ,i,per1,per2);
         }
         
        pair[i]=(OPEN+HIGH+LOW+CLOSE)/ 4 ;
       }
   
//----
   return ( 0 );
  }

//+------------------------------------------------------------------+

double USD( int Mode, int Price, int i, int per1, int per2){
   return (
            ( iMA ( "EURUSD" , 0 ,per1, 0 ,Mode,Price,i)-
             iMA ( "EURUSD" , 0 ,per2, 0 ,Mode,Price,i))* 10000 *kEUR
            +
            ( iMA ( "GBPUSD" , 0 ,per1, 0 ,Mode,Price,i)-
             iMA ( "GBPUSD" , 0 ,per2, 0 ,Mode,Price,i))* 10000 *kGBP
            +
            ( iMA ( "USDJPY" , 0 ,per2, 0 ,Mode,Price,i)-
             iMA ( "USDJPY" , 0 ,per1, 0 ,Mode,Price,i))* 100 *kJPY
          );
   
}   

double EUR( int Mode, int Price, int i, int per1, int per2){
   return (
            ( iMA ( "EURUSD" , 0 ,per2, 0 ,Mode,Price,i)-
             iMA ( "EURUSD" , 0 ,per1, 0 ,Mode,Price,i))* 10000 *kUSD
            +
            ( iMA ( "EURGBP" , 0 ,per2, 0 ,Mode,Price,i)-
             iMA ( "EURGBP" , 0 ,per1, 0 ,Mode,Price,i))* 10000 *kGBP
            +
            ( iMA ( "EURJPY" , 0 ,per2, 0 ,Mode,Price,i)-
             iMA ( "EURJPY" , 0 ,per1, 0 ,Mode,Price,i))* 100 *kJPY
          ); 
   
}   

double GBP( int Mode, int Price, int i, int per1, int per2){
   return (
            ( iMA ( "GBPUSD" , 0 ,per2, 0 ,Mode,Price,i)-
             iMA ( "GBPUSD" , 0 ,per1, 0 ,Mode,Price,i))* 10000 *kUSD
            +
            ( iMA ( "EURGBP" , 0 ,per1, 0 ,Mode,Price,i)-
             iMA ( "EURGBP" , 0 ,per2, 0 ,Mode,Price,i))* 10000 *kEUR
            +
            ( iMA ( "GBPJPY" , 0 ,per2, 0 ,Mode,Price,i)-
             iMA ( "GBPJPY" , 0 ,per1, 0 ,Mode,Price,i))* 100 *kJPY
          );
   
}      
   

double JPY( int Mode, int Price, int i, int per1, int per2){
   return (
            ( iMA ( "USDJPY" , 0 ,per1, 0 ,Mode,Price,i)-
             iMA ( "USDJPY" , 0 ,per2, 0 ,Mode,Price,i))* 100 *kUSD
            +
            ( iMA ( "EURJPY" , 0 ,per1, 0 ,Mode,Price,i)-
             iMA ( "EURJPY" , 0 ,per2, 0 ,Mode,Price,i))* 100 *kEUR
            +
            ( iMA ( "GBPJPY" , 0 ,per1, 0 ,Mode,Price,i)-
             iMA ( "GBPJPY" , 0 ,per2, 0 ,Mode,Price,i))* 100 *kGBP           
           
          );
   
}   
//+------------------------------------------------------------------+
Dosyalar:
 

Kod, ilk beşte, kime hurda indirileceği ... ve göstergeler de dahil olmak üzere kimin sürükleneceği.

Yorumlar için teşekkürler:

 #property copyright "2009, MetaQuotes Software Corp."
#property link       "http://www.mql5.com"
#property version   "2.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
//#property indicator_applied_price PRICE_TYPICAL
//--- подключим функции усреднения из файла MovingAverages.mqh
#include <MovingAverages.mqh>
//---- plot TSI
#property indicator_label1   "Complex2"
#property indicator_type1   DRAW_LINE
#property indicator_color1  Green
#property indicator_style1  STYLE_SOLID
#property indicator_width1   1
//--- input parameters
input int MA_Slow= 56 ;                         //MA_Slow
input ENUM_TIMEFRAMES MA_Slow_TF = PERIOD_H1 ; //MA_Slow_TF
input int MA_Fast= 9 ;                           //MA_Fast
input ENUM_TIMEFRAMES MA_Fast_TF = PERIOD_H1 ; //MA_Fast_TF

input double kUSD= 1 ;
input double kGBP= 1 ;
input double kCAD= 1 ;
input double kJPY= 1 ;
input double kEUR= 1 ;
//--- indicator buffers
double pair[];
//--------------------------ХЭНДЛЫ ИНДИКАТОРОВ ПО ВАЛЮТНЫМ ПАРАМ------------------
int hMA_OPEN_S_EURUSD, hMA_HIGH_S_EURUSD, hMA_LOW_S_EURUSD, hMA_CLOSE_S_EURUSD,
    hMA_OPEN_F_EURUSD, hMA_HIGH_F_EURUSD, hMA_LOW_F_EURUSD, hMA_CLOSE_F_EURUSD;
    
int hMA_OPEN_S_GBPUSD, hMA_HIGH_S_GBPUSD, hMA_LOW_S_GBPUSD, hMA_CLOSE_S_GBPUSD,
    hMA_OPEN_F_GBPUSD, hMA_HIGH_F_GBPUSD, hMA_LOW_F_GBPUSD, hMA_CLOSE_F_GBPUSD;    
   
int hMA_OPEN_S_USDJPY, hMA_HIGH_S_USDJPY, hMA_LOW_S_USDJPY, hMA_CLOSE_S_USDJPY,
    hMA_OPEN_F_USDJPY, hMA_HIGH_F_USDJPY, hMA_LOW_F_USDJPY, hMA_CLOSE_F_USDJPY;
  
int hMA_OPEN_S_EURGBP, hMA_HIGH_S_EURGBP, hMA_LOW_S_EURGBP, hMA_CLOSE_S_EURGBP,
    hMA_OPEN_F_EURGBP, hMA_HIGH_F_EURGBP, hMA_LOW_F_EURGBP, hMA_CLOSE_F_EURGBP;
    
int hMA_OPEN_S_EURJPY, hMA_HIGH_S_EURJPY, hMA_LOW_S_EURJPY, hMA_CLOSE_S_EURJPY,
    hMA_OPEN_F_EURJPY, hMA_HIGH_F_EURJPY, hMA_LOW_F_EURJPY, hMA_CLOSE_F_EURJPY;
                
int hMA_OPEN_S_GBPJPY, hMA_HIGH_S_GBPJPY, hMA_LOW_S_GBPJPY, hMA_CLOSE_S_GBPJPY,
    hMA_OPEN_F_GBPJPY, hMA_HIGH_F_GBPJPY, hMA_LOW_F_GBPJPY, hMA_CLOSE_F_GBPJPY;
    

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,pair, INDICATOR_DATA );      
   /*
   SetIndexBuffer(1,OPEN_S,INDICATOR_CALCULATIONS);
   SetIndexBuffer(2,HIGH_S,INDICATOR_CALCULATIONS);
   SetIndexBuffer(3,LOW_S,INDICATOR_CALCULATIONS);
   SetIndexBuffer(4,CLOSE_S,INDICATOR_CALCULATIONS);
   SetIndexBuffer(5,OPEN_F,INDICATOR_CALCULATIONS);
   SetIndexBuffer(6,HIGH_F,INDICATOR_CALCULATIONS);
   SetIndexBuffer(7,LOW_F,INDICATOR_CALCULATIONS);
   SetIndexBuffer(8,CLOSE_F,INDICATOR_CALCULATIONS);   
  */ 
   
   //hMA1=iMA(NULL,MA_Slow_TF,MA_Slow,0,MODE_LWMA,PRICE_WEIGHTED);
   //hMA2=iMA(NULL,MA_Fast_TF,MA_Fast,0,MODE_LWMA,PRICE_WEIGHTED);  
//---------------------------   
   hMA_OPEN_S_EURUSD= iMA ( "EURUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_S_EURUSD= iMA ( "EURUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_S_EURUSD= iMA ( "EURUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_S_EURUSD= iMA ( "EURUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_CLOSE );  
   
   hMA_OPEN_F_EURUSD= iMA ( "EURUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_F_EURUSD= iMA ( "EURUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_F_EURUSD= iMA ( "EURUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_F_EURUSD= iMA ( "EURUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_CLOSE );
//---------------------------   
   hMA_OPEN_S_GBPUSD= iMA ( "GBPUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_S_GBPUSD= iMA ( "GBPUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_S_GBPUSD= iMA ( "GBPUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_S_GBPUSD= iMA ( "GBPUSD" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_CLOSE );  
   
   hMA_OPEN_F_GBPUSD= iMA ( "GBPUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_F_GBPUSD= iMA ( "GBPUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_F_GBPUSD= iMA ( "GBPUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_F_GBPUSD= iMA ( "GBPUSD" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_CLOSE );
//----------------------------   
   hMA_OPEN_S_USDJPY= iMA ( "USDJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_S_USDJPY= iMA ( "USDJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_S_USDJPY= iMA ( "USDJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_S_USDJPY= iMA ( "USDJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_CLOSE );  
   
   hMA_OPEN_F_USDJPY= iMA ( "USDJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_F_USDJPY= iMA ( "USDJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_F_USDJPY= iMA ( "USDJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_F_USDJPY= iMA ( "USDJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_CLOSE );
//---------------------------   
   hMA_OPEN_S_EURGBP= iMA ( "EURGBP" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_S_EURGBP= iMA ( "EURGBP" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_S_EURGBP= iMA ( "EURGBP" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_S_EURGBP= iMA ( "EURGBP" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_CLOSE );  
   
   hMA_OPEN_F_EURGBP= iMA ( "EURGBP" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_F_EURGBP= iMA ( "EURGBP" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_F_EURGBP= iMA ( "EURGBP" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_F_EURGBP= iMA ( "EURGBP" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_CLOSE );   
//----------------------------      
   hMA_OPEN_S_EURJPY= iMA ( "EURJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_S_EURJPY= iMA ( "EURJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_S_EURJPY= iMA ( "EURJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_S_EURJPY= iMA ( "EURJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_CLOSE );  
   
   hMA_OPEN_F_EURJPY= iMA ( "EURJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_F_EURJPY= iMA ( "EURJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_F_EURJPY= iMA ( "EURJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_F_EURJPY= iMA ( "EURJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_CLOSE );   
//----------------------------      
   hMA_OPEN_S_GBPJPY= iMA ( "GBPJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_S_GBPJPY= iMA ( "GBPJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_S_GBPJPY= iMA ( "GBPJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_S_GBPJPY= iMA ( "GBPJPY" ,MA_Slow_TF,MA_Slow, 0 , MODE_LWMA , PRICE_CLOSE );  
   
   hMA_OPEN_F_GBPJPY= iMA ( "GBPJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_OPEN );
   hMA_HIGH_F_GBPJPY= iMA ( "GBPJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_HIGH );  
   hMA_LOW_F_GBPJPY= iMA ( "GBPJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_LOW );
   hMA_CLOSE_F_GBPJPY= iMA ( "GBPJPY" ,MA_Fast_TF,MA_Fast, 0 , MODE_LWMA , PRICE_CLOSE );   
//----------------------------      
           
   
       
   
//--- с какого бара начнет отрисовываться индикатор
//   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,r+s-1);
   string shortname;
   StringConcatenate (shortname, "Complex(" ,MA_Slow, "," ,MA_Fast, ")" );
//--- установим метку для отображения в DataWindow
   PlotIndexSetString ( 0 , PLOT_LABEL ,shortname);   
//--- установим имя для показа в отдельном подокне и во всплывающей подсказке
   IndicatorSetString ( INDICATOR_SHORTNAME ,shortname);
//--- укажем точность отображения значений индикатора
   IndicatorSetInteger ( INDICATOR_DIGITS , 5 );
//---
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| 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[])

  {
   double OPEN_S_EURUSD[],HIGH_S_EURUSD[],LOW_S_EURUSD[],CLOSE_S_EURUSD[];
   double OPEN_F_EURUSD[],HIGH_F_EURUSD[],LOW_F_EURUSD[],CLOSE_F_EURUSD[];   
//-------------------------------
   double OPEN_S_GBPUSD[],HIGH_S_GBPUSD[],LOW_S_GBPUSD[],CLOSE_S_GBPUSD[];
   double OPEN_F_GBPUSD[],HIGH_F_GBPUSD[],LOW_F_GBPUSD[],CLOSE_F_GBPUSD[];
//-------------------------------
   double OPEN_S_EURGBP[],HIGH_S_EURGBP[],LOW_S_EURGBP[],CLOSE_S_EURGBP[];
   double OPEN_F_EURGBP[],HIGH_F_EURGBP[],LOW_F_EURGBP[],CLOSE_F_EURGBP[];   
//-------------------------------
   double OPEN_S_EURJPY[],HIGH_S_EURJPY[],LOW_S_EURJPY[],CLOSE_S_EURJPY[];
   double OPEN_F_EURJPY[],HIGH_F_EURJPY[],LOW_F_EURJPY[],CLOSE_F_EURJPY[];
//-------------------------------
   double OPEN_S_USDJPY[],HIGH_S_USDJPY[],LOW_S_USDJPY[],CLOSE_S_USDJPY[];
   double OPEN_F_USDJPY[],HIGH_F_USDJPY[],LOW_F_USDJPY[],CLOSE_F_USDJPY[];
//-------------------------------
   double OPEN_S_GBPJPY[],HIGH_S_GBPJPY[],LOW_S_GBPJPY[],CLOSE_S_GBPJPY[];
   double OPEN_F_GBPJPY[],HIGH_F_GBPJPY[],LOW_F_GBPJPY[],CLOSE_F_GBPJPY[];
 
//-------------------------------

   
   

   double OPEN,HIGH,LOW,CLOSE;
   int i;  

   CopyBuffer ( hMA_OPEN_S_EURUSD, 0 , 0 , 1000 ,OPEN_S_EURUSD); 
   CopyBuffer ( hMA_HIGH_S_EURUSD, 0 , 0 , 1000 ,HIGH_S_EURUSD);
   CopyBuffer ( hMA_LOW_S_EURUSD, 0 , 0 , 1000 ,LOW_S_EURUSD);
   CopyBuffer ( hMA_CLOSE_S_EURUSD, 0 , 0 , 1000 ,CLOSE_S_EURUSD);
   
   CopyBuffer ( hMA_OPEN_F_EURUSD, 0 , 0 , 1000 ,OPEN_F_EURUSD);
   CopyBuffer ( hMA_HIGH_F_EURUSD, 0 , 0 , 1000 ,HIGH_F_EURUSD);
   CopyBuffer ( hMA_LOW_F_EURUSD, 0 , 0 , 1000 ,LOW_F_EURUSD);
   CopyBuffer ( hMA_CLOSE_F_EURUSD, 0 , 0 , 1000 ,CLOSE_F_EURUSD);  
//-----------------------------------------------    
   
   CopyBuffer ( hMA_OPEN_S_GBPUSD, 0 , 0 , 1000 ,OPEN_S_GBPUSD); 
   CopyBuffer ( hMA_HIGH_S_GBPUSD, 0 , 0 , 1000 ,HIGH_S_GBPUSD);
   CopyBuffer ( hMA_LOW_S_GBPUSD, 0 , 0 , 1000 ,LOW_S_GBPUSD);
   CopyBuffer ( hMA_CLOSE_S_GBPUSD, 0 , 0 , 1000 ,CLOSE_S_GBPUSD);
   
   CopyBuffer ( hMA_OPEN_F_GBPUSD, 0 , 0 , 1000 ,OPEN_F_GBPUSD);
   CopyBuffer ( hMA_HIGH_F_GBPUSD, 0 , 0 , 1000 ,HIGH_F_GBPUSD);
   CopyBuffer ( hMA_LOW_F_GBPUSD, 0 , 0 , 1000 ,LOW_F_GBPUSD);
   CopyBuffer ( hMA_CLOSE_F_GBPUSD, 0 , 0 , 1000 ,CLOSE_F_GBPUSD);  
//-----------------------------------------------   
   
   CopyBuffer ( hMA_OPEN_S_EURGBP, 0 , 0 , 1000 ,OPEN_S_EURGBP); 
   CopyBuffer ( hMA_HIGH_S_EURGBP, 0 , 0 , 1000 ,HIGH_S_EURGBP);
   CopyBuffer ( hMA_LOW_S_EURGBP, 0 , 0 , 1000 ,LOW_S_EURGBP);
   CopyBuffer ( hMA_CLOSE_S_EURGBP, 0 , 0 , 1000 ,CLOSE_S_EURGBP);
   
   CopyBuffer ( hMA_OPEN_F_EURGBP, 0 , 0 , 1000 ,OPEN_F_EURGBP);
   CopyBuffer ( hMA_HIGH_F_EURGBP, 0 , 0 , 1000 ,HIGH_F_EURGBP);
   CopyBuffer ( hMA_LOW_F_EURGBP, 0 , 0 , 1000 ,LOW_F_EURGBP);
   CopyBuffer ( hMA_CLOSE_F_EURGBP, 0 , 0 , 1000 ,CLOSE_F_EURGBP);  
//----------------------------------------------   
   
   CopyBuffer ( hMA_OPEN_S_EURJPY, 0 , 0 , 1000 ,OPEN_S_EURJPY); 
   CopyBuffer ( hMA_HIGH_S_EURJPY, 0 , 0 , 1000 ,HIGH_S_EURJPY);
   CopyBuffer ( hMA_LOW_S_EURJPY, 0 , 0 , 1000 ,LOW_S_EURJPY);
   CopyBuffer ( hMA_CLOSE_S_EURJPY, 0 , 0 , 1000 ,CLOSE_S_EURJPY);
   
   CopyBuffer ( hMA_OPEN_F_EURJPY, 0 , 0 , 1000 ,OPEN_F_EURJPY);
   CopyBuffer ( hMA_HIGH_F_EURJPY, 0 , 0 , 1000 ,HIGH_F_EURJPY);
   CopyBuffer ( hMA_LOW_F_EURJPY, 0 , 0 , 1000 ,LOW_F_EURJPY);
   CopyBuffer ( hMA_CLOSE_F_EURJPY, 0 , 0 , 1000 ,CLOSE_F_EURJPY);  
//---------------------------------------------------------   
   
   CopyBuffer ( hMA_OPEN_S_USDJPY, 0 , 0 , 1000 ,OPEN_S_USDJPY); 
   CopyBuffer ( hMA_HIGH_S_USDJPY, 0 , 0 , 1000 ,HIGH_S_USDJPY);
   CopyBuffer ( hMA_LOW_S_USDJPY, 0 , 0 , 1000 ,LOW_S_USDJPY);
   CopyBuffer ( hMA_CLOSE_S_USDJPY, 0 , 0 , 1000 ,CLOSE_S_USDJPY);
   
   CopyBuffer ( hMA_OPEN_F_USDJPY, 0 , 0 , 1000 ,OPEN_F_USDJPY);
   CopyBuffer ( hMA_HIGH_F_USDJPY, 0 , 0 , 1000 ,HIGH_F_USDJPY);
   CopyBuffer ( hMA_LOW_F_USDJPY, 0 , 0 , 1000 ,LOW_F_USDJPY);
   CopyBuffer ( hMA_CLOSE_F_USDJPY, 0 , 0 , 1000 ,CLOSE_F_USDJPY);
//----------------------------------------------------------
  
   CopyBuffer ( hMA_OPEN_S_GBPJPY, 0 , 0 , 1000 ,OPEN_S_GBPJPY); 
   CopyBuffer ( hMA_HIGH_S_GBPJPY, 0 , 0 , 1000 ,HIGH_S_GBPJPY);
   CopyBuffer ( hMA_LOW_S_GBPJPY, 0 , 0 , 1000 ,LOW_S_GBPJPY);
   CopyBuffer ( hMA_CLOSE_S_GBPJPY, 0 , 0 , 1000 ,CLOSE_S_GBPJPY);
   
   CopyBuffer ( hMA_OPEN_F_GBPJPY, 0 , 0 , 1000 ,OPEN_F_GBPJPY);
   CopyBuffer ( hMA_HIGH_F_GBPJPY, 0 , 0 , 1000 ,HIGH_F_GBPJPY);
   CopyBuffer ( hMA_LOW_F_GBPJPY, 0 , 0 , 1000 ,LOW_F_GBPJPY);
   CopyBuffer ( hMA_CLOSE_F_GBPJPY, 0 , 0 , 1000 ,CLOSE_F_GBPJPY); 
//----------------------------------------------------------       
     
   ArraySetAsSeries (OPEN_S_EURUSD, true );
   ArraySetAsSeries (HIGH_S_EURUSD, true );
   ArraySetAsSeries (LOW_S_EURUSD, true );
   ArraySetAsSeries (CLOSE_S_EURUSD, true );
   ArraySetAsSeries (OPEN_F_EURUSD, true );
   ArraySetAsSeries (HIGH_F_EURUSD, true );
   ArraySetAsSeries (LOW_F_EURUSD, true );
   ArraySetAsSeries (CLOSE_F_EURUSD, true );       
       
     
   ArraySetAsSeries (OPEN_S_GBPUSD, true );
   ArraySetAsSeries (HIGH_S_GBPUSD, true );
   ArraySetAsSeries (LOW_S_GBPUSD, true );
   ArraySetAsSeries (CLOSE_S_GBPUSD, true );
   ArraySetAsSeries (OPEN_F_GBPUSD, true );
   ArraySetAsSeries (HIGH_F_GBPUSD, true );
   ArraySetAsSeries (LOW_F_GBPUSD, true );
   ArraySetAsSeries (CLOSE_F_GBPUSD, true );    
          
     
   ArraySetAsSeries (OPEN_S_EURGBP, true );
   ArraySetAsSeries (HIGH_S_EURGBP, true );
   ArraySetAsSeries (LOW_S_EURGBP, true );
   ArraySetAsSeries (CLOSE_S_EURGBP, true );
   ArraySetAsSeries (OPEN_F_EURGBP, true );
   ArraySetAsSeries (HIGH_F_EURGBP, true );
   ArraySetAsSeries (LOW_F_EURGBP, true );
   ArraySetAsSeries (CLOSE_F_EURGBP, true );     
       
     
   ArraySetAsSeries (OPEN_S_EURJPY, true );
   ArraySetAsSeries (HIGH_S_EURJPY, true );
   ArraySetAsSeries (LOW_S_EURJPY, true );
   ArraySetAsSeries (CLOSE_S_EURJPY, true );
   ArraySetAsSeries (OPEN_F_EURJPY, true );
   ArraySetAsSeries (HIGH_F_EURJPY, true );
   ArraySetAsSeries (LOW_F_EURJPY, true );
   ArraySetAsSeries (CLOSE_F_EURJPY, true );     
       
     
   ArraySetAsSeries (OPEN_S_GBPJPY, true );
   ArraySetAsSeries (HIGH_S_GBPJPY, true );
   ArraySetAsSeries (LOW_S_GBPJPY, true );
   ArraySetAsSeries (CLOSE_S_GBPJPY, true );
   ArraySetAsSeries (OPEN_F_GBPJPY, true );
   ArraySetAsSeries (HIGH_F_GBPJPY, true );
   ArraySetAsSeries (LOW_F_GBPJPY, true );
   ArraySetAsSeries (CLOSE_F_GBPJPY, true );         
     
   ArraySetAsSeries (OPEN_S_USDJPY, true );
   ArraySetAsSeries (HIGH_S_USDJPY, true );
   ArraySetAsSeries (LOW_S_USDJPY, true );
   ArraySetAsSeries (CLOSE_S_USDJPY, true );
   ArraySetAsSeries (OPEN_F_USDJPY, true );
   ArraySetAsSeries (HIGH_F_USDJPY, true );
   ArraySetAsSeries (LOW_F_USDJPY, true );
   ArraySetAsSeries (CLOSE_F_USDJPY, true );        
   
   for (i=prev_calculated;i<rates_total;i++)
     {          
       if ( Symbol () == "EURUSD" )
        {     
// ----  OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);          
         OPEN=((OPEN_F_EURUSD[i]-OPEN_S_EURUSD[i])* 10000 *kUSD+(OPEN_F_EURGBP[i]-OPEN_S_EURGBP[i])* 10000 *kGBP+(OPEN_F_EURJPY[i]-OPEN_S_EURJPY[i])* 100 *kJPY -
               (OPEN_S_EURUSD[i]-OPEN_F_EURUSD[i])* 10000 *kEUR+(OPEN_S_GBPUSD[i]-OPEN_F_GBPUSD[i])* 10000 *kGBP+(OPEN_F_USDJPY[i]-OPEN_S_USDJPY[i])* 100 *kJPY);
               
// ----  HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);              
         HIGH=((HIGH_F_EURUSD[i]-HIGH_S_EURUSD[i])* 10000 *kUSD+(HIGH_F_EURGBP[i]-HIGH_S_EURGBP[i])* 10000 *kGBP+(HIGH_F_EURJPY[i]-HIGH_S_EURJPY[i])* 100 *kJPY -
               (HIGH_S_EURUSD[i]-HIGH_F_EURUSD[i])* 10000 *kEUR+(HIGH_S_GBPUSD[i]-HIGH_F_GBPUSD[i])* 10000 *kGBP+(HIGH_F_USDJPY[i]-HIGH_S_USDJPY[i])* 100 *kJPY);
               
// ----  LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
         LOW=((LOW_F_EURUSD[i]-LOW_S_EURUSD[i])* 10000 *kUSD+(LOW_F_EURGBP[i]-LOW_S_EURGBP[i])* 10000 *kGBP+(LOW_F_EURJPY[i]-LOW_S_EURJPY[i])* 100 *kJPY -
               (LOW_S_EURUSD[i]-LOW_F_EURUSD[i])* 10000 *kEUR+(LOW_S_GBPUSD[i]-LOW_F_GBPUSD[i])* 10000 *kGBP+(LOW_F_USDJPY[i]-LOW_S_USDJPY[i])* 100 *kJPY);
               
// ---   CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
         CLOSE=((CLOSE_F_EURUSD[i]-CLOSE_S_EURUSD[i])* 10000 *kUSD+(CLOSE_F_EURGBP[i]-CLOSE_S_EURGBP[i])* 10000 *kGBP+(CLOSE_F_EURJPY[i]-CLOSE_S_EURJPY[i])* 100 *kJPY -
               (CLOSE_S_EURUSD[i]-CLOSE_F_EURUSD[i])* 10000 *kEUR+(CLOSE_S_GBPUSD[i]-CLOSE_F_GBPUSD[i])* 10000 *kGBP+(CLOSE_F_USDJPY[i]-CLOSE_S_USDJPY[i])* 100 *kJPY);
         }
      
      pair[i]=(OPEN+HIGH+LOW+CLOSE)/ 4 ;      
     
     } // Конец цикла for
   return (rates_total);
  }

void OnDeinit ( const int reason) 
  {
   IndicatorRelease (hMA_OPEN_S_EURUSD); IndicatorRelease (hMA_HIGH_S_EURUSD); IndicatorRelease (hMA_LOW_S_EURUSD); IndicatorRelease (hMA_CLOSE_S_EURUSD);
   IndicatorRelease (hMA_OPEN_F_EURUSD); IndicatorRelease (hMA_HIGH_F_EURUSD); IndicatorRelease (hMA_LOW_F_EURUSD); IndicatorRelease (hMA_CLOSE_F_EURUSD);
 
   IndicatorRelease (hMA_OPEN_S_GBPUSD); IndicatorRelease (hMA_HIGH_S_GBPUSD); IndicatorRelease (hMA_LOW_S_GBPUSD); IndicatorRelease (hMA_CLOSE_S_GBPUSD);
   IndicatorRelease (hMA_OPEN_F_GBPUSD); IndicatorRelease (hMA_HIGH_F_GBPUSD); IndicatorRelease (hMA_LOW_F_GBPUSD); IndicatorRelease (hMA_CLOSE_F_GBPUSD);
   
   IndicatorRelease (hMA_OPEN_S_EURGBP); IndicatorRelease (hMA_HIGH_S_EURGBP); IndicatorRelease (hMA_LOW_S_EURGBP); IndicatorRelease (hMA_CLOSE_S_EURGBP);
   IndicatorRelease (hMA_OPEN_F_EURGBP); IndicatorRelease (hMA_HIGH_F_EURGBP); IndicatorRelease (hMA_LOW_F_EURGBP); IndicatorRelease (hMA_CLOSE_F_EURGBP);
   
   IndicatorRelease (hMA_OPEN_S_EURJPY); IndicatorRelease (hMA_HIGH_S_EURJPY); IndicatorRelease (hMA_LOW_S_EURJPY); IndicatorRelease (hMA_CLOSE_S_EURJPY);
   IndicatorRelease (hMA_OPEN_F_EURJPY); IndicatorRelease (hMA_HIGH_F_EURJPY); IndicatorRelease (hMA_LOW_F_EURJPY); IndicatorRelease (hMA_CLOSE_F_EURJPY);
   
   IndicatorRelease (hMA_OPEN_S_USDJPY); IndicatorRelease (hMA_HIGH_S_USDJPY); IndicatorRelease (hMA_LOW_S_USDJPY); IndicatorRelease (hMA_CLOSE_S_USDJPY);
   IndicatorRelease (hMA_OPEN_F_USDJPY); IndicatorRelease (hMA_HIGH_F_USDJPY); IndicatorRelease (hMA_LOW_F_USDJPY); IndicatorRelease (hMA_CLOSE_F_USDJPY);
   
   IndicatorRelease (hMA_OPEN_S_GBPJPY); IndicatorRelease (hMA_HIGH_S_GBPJPY); IndicatorRelease (hMA_LOW_S_GBPJPY); IndicatorRelease (hMA_CLOSE_S_GBPJPY);
   IndicatorRelease (hMA_OPEN_F_GBPJPY); IndicatorRelease (hMA_HIGH_F_GBPJPY); IndicatorRelease (hMA_LOW_F_GBPJPY); IndicatorRelease (hMA_CLOSE_F_GBPJPY);   
   
  }
 

Beyler, bir şey çiziyor gibi görünüyor! :-)

Fare tekerleğini hikayenin en başına vidaladım ve en başında, 71 yaşından itibaren, yukarıdaki kodda yazıldığı gibi ilk 1000 çubuğu (daha fazla - sessizlik) çiziyor gibi görünüyor. Bu göstergenin okumalarına dayanarak Expert Advisor'ı test edebilmek için göstergenin tüm geçmişi boyunca nasıl çizileceğini. Teşekkür ederim.


Düzenlemeler yapıldı - hiç çizmiyor.

Bakın lütfen fragman:

Dosyalar:
Complex2.mq5  23 kb
 
R0MAN :

Beyler, bir şey çiziyor gibi görünüyor! :-)

Fare tekerleğini hikayenin en başına vidaladım ve en başında, 71 yaşından itibaren, yukarıdaki kodda yazıldığı gibi ilk 1000 çubuğu (daha fazla - sessizlik) çiziyor gibi görünüyor. Bu göstergenin okumalarına dayanarak Expert Advisor'ı test edebilmek için göstergenin tüm geçmişi boyunca nasıl çizileceğini. Teşekkür ederim.


ArraySetAsSeries koymak
 
sergeev :
ArraySetAsSeries koymak

Koymak. fragmana bakın...

Dosyalar:
Complex2.mq5  23 kb
 
R0MAN :

Koymak. fragmana bakın...


OnCalcul'da gelen tüm kullanılmış dizilerde de gereklidir.

kodunuz bana hata veriyor

' Hareketli Ortalama ' göstergesi yüklenemiyor [4302]


Terminalin teslimatında böyle bir gösterge bulamadım

 

mql4'ten mql5'e geçmeme yardım et İşte Bubbles&Drops.mq4 göstergesi MathRound ((Açık[uzunluk]-Kapat[uzunluk])* bölücü);

 

 

İnsanların sayfada açıkça yaymak için manichka çeşitleri var.

sonuna kadar, çarkı döndürmek için parmak eziyet edilir.


Kim ister ve indirir ve bakar ve kim buna ihtiyaç duymaz, o zaman açık kod yandaki gönderide