[ARCHIVE!] 포럼을 어지럽히 지 않도록 초보자 질문. 프로, 놓치지 마세요. 너 없이는 아무데도 - 4. - 페이지 408

 

상위 5개 항목에 대한 액세스 제한이 있는 사람이 있습니까?

아니면 그들이 챔피언십에 대한 "복수 등록"이라고 주장하는 이유로 나를 거기에서 잘라낸 방법입니다! :-)


 
Roman. :

1. 상호.

2. 구글 사용법 배우기 !

정말 감사합니다! 그것은 효과가 있었던 것 같습니다.

 
Vinin :


그리고 그들은 오류를 처리하려고 노력했습니다.

몇 가지 조건이 있습니다.

1. 두 번째 상품은 Market Watch에서 열려 있어야 합니다. 원하는 기간의 차트가 열려 있으면 더 좋습니다(필수는 아니지만).

2. 오류 4066이 없어야 합니다.

3. 귀하에 따르면 문제가 있는 일부가 아닌 전체 코드를 검토하기 위해 제공해야 합니다.

답변 해주셔서 감사합니다. 많은 실수. 코드 섹션 제공, p.ch. 그것 없이는 컴파일이 성공합니다. 전체 코드는 다음과 같습니다.
 //+------------------------------------------------------------------+
//|                                                   PriseRatio.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//для часовиков aud/usd (прикрепляется) и nzd/usd
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link       "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DarkViolet
//--- input parameters
extern int        ProcessDeep= 1000 ;
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle ( 0 , DRAW_LINE );
   SetIndexBuffer ( 0 ,ExtMapBuffer1);
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
 //----расчет отношения цен
     double a, b;
     int i;
     double Ratio( double a, double b) 
    {a = iClose ( NULL , PERIOD_H1 , i);
     b = iClose ( "NZDUSD" , PERIOD_H1 ,i);
     return (a/b);
    }
    
 
 //----оптимизация
     int counted_bars= IndicatorCounted (),
       limit;
 
     if (counted_bars> 0 )
      counted_bars--;
   
    limit= Bars -counted_bars;
   
     if (limit>ProcessDeep)
      limit=ProcessDeep;
  
     for ( int i= 0 ;i<limit;i++)
    {
      ExtMapBuffer1[i]=Ratio(а,b);
    }
//----
   

   return ( 0 );
  }
 
eternal2 :
답변 해주셔서 감사합니다. 많은 실수. 코드 섹션 제공, p.ch. 그것 없이는 컴파일이 성공합니다. 전체 코드는 다음과 같습니다.


MQL4가 함수 중첩을 지원한다고 결정한 이유

 //+------------------------------------------------------------------+
//|                                                   PriseRatio.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+

#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link       "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DarkViolet
//--- input parameters
extern int        ProcessDeep= 1000 ;
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle ( 0 , DRAW_LINE );
   SetIndexBuffer ( 0 ,ExtMapBuffer1);
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
     int counted_bars= IndicatorCounted (),
       limit;
 
     if (counted_bars> 0 )
      counted_bars--;
   
    limit= Bars -counted_bars;
   
     if (limit>ProcessDeep)
      limit=ProcessDeep;
  
     for ( int i= 0 ;i<limit;i++)
    {
      ExtMapBuffer1[i]=Ratio( "NZDUSD" ,i);
    }
//----
   

   return ( 0 );
  }
  
double Ratio( string lsSymbol, int lnPos) {
   double res= 0 ;
   int shift= iBarShift (lsSymbol, 0 , Time[lnPos]);
   double a = iClose ( NULL , 0 , lnPos);
   double b = iClose (lsSymbol, 0 ,shift);
   if (b> 0 ) res=a/b;
   return (res);
}
  
 
Vinin :


MQL4가 함수 중첩을 지원한다고 결정한 이유

감사하다. 하지만 어떤 함수가 중첩되었는지 설명하고 코드에 주석을 달 수 있습니까?
 
//+------------------------------------------------------------------+
//|                                                      _Symbol.mq4 |
//|           Copyright © 2012. XrustSolution. mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012. XrustSolution. mail:xrustx@gmail.com"
#property link      "https://www.youtube.com/user/opmlv http://forexrust.info"
//+------------------------------------------------------------------+
//| Super Global Variables                                           |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_width1 0
#property indicator_width2 0
//+------------------------------------------------------------------+
//| Extern Variables                                                 |
//+------------------------------------------------------------------+
extern   color    Chart_Color                             = Teal     ;
extern   string   SYMBOL                                  = "USDCHF" ;
extern   bool     Mirror                                  = false    ; 
extern   bool     Sinshronise_Daily_Weekly                = true     ;
extern   double   Scale_Multyplier                        = 1        ; 
extern   int      Bars_Back                               = 2000     ;       
//+------------------------------------------------------------------+
//|   Defines & Global variavles                                     |
//+------------------------------------------------------------------+
#define empty  EMPTY_VALUE
//+------------------------------------------------------------------+
string _sy;
int    _per;
//--- buffers
double hi[];
double lo[];
double op[];
double cl[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init(){_sy = StringUpper(SYMBOL);
   if(StringLen(_sy)<4){_sy = Symbol();}
   IndicatorShortName(_sy);
   IndicatorDigits(MarketInfo(_sy,MODE_DIGITS));
   if(Sinshronise_Daily_Weekly){
      _per = PERIOD_D1;
   }else{
      _per = PERIOD_W1;
   }
   if(Scale_Multyplier==0){
      Scale_Multyplier=1;
   }
   if(Scale_Multyplier > 1000){
      Scale_Multyplier=1000;
   }
    //---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,0,Chart_Color);
   SetIndexBuffer(0,hi);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexLabel(0,_sy);
   SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,0,Chart_Color);
   SetIndexBuffer(1,lo);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexLabel(1,_sy);
   SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,1,Chart_Color);
   SetIndexBuffer(2,op);
   SetIndexEmptyValue(2,EMPTY_VALUE);
   SetIndexLabel(2,_sy);
   SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,1,Chart_Color);
   SetIndexBuffer(3,cl);
   SetIndexEmptyValue(3,EMPTY_VALUE);
   SetIndexLabel(3,_sy);
    //----
return;}
//+------------------------------------------------------------------+
void deinit(){return;}
//+------------------------------------------------------------------+
void start(){    
    //---- Стандартный набор переменых 
    static int pretime=0;
    static double prerp = 0;     
   int i, ii = 0, counted = IndicatorCounted();
   if (counted > 0) counted--;
   int limit = Bars - counted;
   int per   = Period();
   string sy = Symbol();
   string txt="";
   //---- Предварительные расчеты и объявления
   double op_1,op_2,_hi,_lo,_op,_cl;
   double ss = iOpen(sy,_per,0)/iOpen(_sy,_per,0);
   if(ss<1){ss=ss*MathPow(10,(Digits-MarketInfo(_sy,MODE_DIGITS)));}
   double sm, mno = (Point/MarketInfo(_sy,MODE_POINT))*ss*Scale_Multyplier;
   if(Bars_Back!=0){limit=Bars_Back;}
   if(limit < 5){limit=5;}
   //---- Масштабирование ширины гистограммы
    int width = GetChartScale();
    SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,0);
    SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,0);
   SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,width);
   SetIndexStyle(3,DRAW_HISTOGRAM,EMPTY,width);
    //---- Основной расчет индикатора
   for(i=0;i<limit;i++){
      //---- Пропускаем отсутвующие бары (синхронизация)
      while(iBarShift(_sy,per,iTime(sy,per,ii),true)<0){
         ii++;
         continue;
      }
      //---- Вычисляем смещение для точки синхронизации цены
      op_1 = iOpen(sy ,_per,iBarShift(sy ,_per,iTime(sy,per,ii)));
      op_2 = iOpen(_sy,_per,iBarShift(_sy,_per,iTime(_sy,per,i))); 
      sm = op_1 - op_2 * mno;    
      //---- Читаем данные символа  
      _hi = sm + iHigh(_sy,per,i)*mno;
      _lo = sm + iLow(_sy,per,i)*mno;
      _op = sm + iOpen(_sy,per,i)*mno;
      _cl = sm + iClose(_sy,per,i)*mno;
      //---- Переворачиваем чарт
      if(Mirror){
         _hi += 2 * (op_1-_hi);
         _lo += 2 * (op_1-_lo); 
         _op += 2 * (op_1-_op); 
         _cl += 2 * (op_1-_cl);       
      }
      //---- Отображаем график
      hi[ii] = _hi;
       lo[ii] = _lo;
      op[ii] = _op;
       cl[ii] = _cl;
       //---- Обработка дожи
       if(op[ii]==lo[ii]){op[ii]+=Point;}
       ii++;
   }
    //----
return;}
//+------------------------------------------------------------------+
//|   includes                                                       |
//+------------------------------------------------------------------+
#import "user32.dll"
    bool GetWindowRect(int h, int& pos[4]);
#import
//+------------------------------------------------------------------+
//|          Function  : int GetChartScale()[1,2,4,6,13]             |
//|          Copyright © 2012, XrustSolution.  mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
//|          Description: Return bar width in current chart scale    |
//+------------------------------------------------------------------+
int GetChartScale(){
    int h = WindowHandle(Symbol(), Period());
    int rect[4];
    if(h==0) return(1);
    GetWindowRect(h, rect);
    int wW  = rect[2] - rect[0]; // ширина окна
    int bpc = WindowBarsPerChart();
    if(bpc==0) return(1);
    int scale = MathFloor((wW-48)/bpc);
    switch(scale){
        case  1 :    return(0);
        case  2 :    return(1);
        case  4 :    return(2);
        case  8 :    return(4);
        case 16 :    return(7);
        case 32 :    return(14);
        default :   return(1);
    }
    return(1);
}
//+------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru         |
//+------------------------------------------------------------------+
//|  Версия   : 01.09.2005                                           |
//|  Описание : Возвращает строку в ВЕРХНЕМ регистре                 |
//+------------------------------------------------------------------+
string StringUpper(string s) {
  int c, i, k=StringLen(s), n;
  for (i=0; i<k; i++) {
    n=0;
    c=StringGetChar(s, i);
    if (c>96 && c<123) n=c-32;    // a-z -> A-Z
    if (c>223 && c<256) n=c-32;   // а-я -> А-Я
    if (c==184) n=168;            //  ё  ->  Ё
    if (n>0) s=StringSetChar(s, i, n);
  }
  return(s);
}
//+------------------------------------------------------------------+
 
FAQ :

우리는 러시아어로 말할 수 있습니까? 저는 초보자입니다.

코드의 일부를 댓글로 남겨주세요.

 double Ratio( string lsSymbol, int lnPos) {
   double res= 0 ;
   int shift= iBarShift (lsSymbol, 0 , Time[lnPos]);
   double a = iClose ( NULL , 0 , lnPos);
   double b = iClose (lsSymbol, 0 ,shift);
   if (b> 0 ) res=a/b;
   return (res);
 

인사말!

코드에 무엇이 잘못되었는지 알려주세요... 보류 중인 주문 가격에 오류가 있습니다. 정확히 무엇이 잘못되었는지 이해하지 못합니다. 어떻게 고치는 지?

파일:
thsayn.mq4  15 kb
 
안녕하세요" Expert Advisor에 사용자 정의 기능을 추가할 수 없습니다! 추가하는 방법과 사용자 정의 기능에 대한 일반적인 정보를 읽을 수 있는 곳을 아는 사람이 있으면 작성해 주세요!
 
lowech :
안녕하세요" Expert Advisor에 사용자 정의 기능을 추가할 수 없습니다! 추가하는 방법과 사용자 정의 기능에 대한 일반적인 정보를 읽을 수 있는 곳을 아는 사람이 있으면 작성해 주세요!

도움! F1!