PROFI에서 SUPERPROFI에 대한 모든 질문 - 1. - 페이지 41

 
Sergey Dzyublik :

감독자! 흥미로운 방법입니다.

 
Ihor Herasko :

감독자! 흥미로운 방법입니다.

https://www.mql5.com/en/search#!keyword=TOSTRING

Поиск - MQL5.community
Поиск - MQL5.community
  • www.mql5.com
Поиск выполняется с учетом морфологии и без учета регистра. Все буквы, независимо от того, как они введены, будут рассматриваться как строчные. По умолчанию наш поиск показывает страницы...
 
fxsaber :

https://www.mql5.com/en/search#!keyword=TOSTRING

네, 저는 당신이 매크로 천재라는 것을 기억합니다. 고맙습니다. 또 한 가지는 작품에 대한 묘사가 거의 없다는 점이다. 이러한 미묘함을 설명하는 출처를 추천할 수 있습니까? 물론 C/C++용입니다.

나는 매크로를 아주 드물게 그리고 간단한 수준에서 사용합니다. 분명히, 부당하게 그들에게 관심을 기울이지 마십시오.

 
빠르고 포괄적인 답변에 감사드립니다!
 
Ihor Herasko :

이러한 미묘함을 설명하는 출처를 추천할 수 있습니까?

나는 MT5 빌드 중 하나의 발표에 있었던 MQ의 유일한 예에서 매크로를 연구했습니다. # 과 ##이 입력되었고 좋은 예가 있었습니다. 링크를 찾을 수 없습니다.

 
fxsaber :

나는 MT5 빌드 중 하나의 발표에 있었던 MQ의 유일한 예에서 매크로를 연구했습니다. # 과 ##이 입력되었고 좋은 예가 있었습니다. 링크를 찾을 수 없습니다.

알았습니다. 다시 한번 감사합니다.

 
Andrey Khatimlianskii :

우연의 일치가 있습니다... 결국, 게시를 위해 포함 파일을 CodeBase에 보냈습니다. 이 파일은 2015년에 이 토론을 기반으로 컴파일했습니다. https://www.mql5.com/en/forum/63951/page2# 댓글_1908129

출판을 위해 준비한 라이브러리 파일의 코드 자체는 간단합니다. 동시에 의미 측면에서 - 귀하가 관심을 갖고 있는 것과 대략적으로 Sergey Dzyublik이 가져온 것처럼

P./S. 시간이 지남에 따라 가장 간단한 것이 나에게 가장 많이 사용되었습니다. 시간이 지남에 따라 포함된 파일이 없다는 사실을 깨달았습니다. - 무언가가 누락되어 / * 일부 결과를 표시할 때: 코드, 기능을 구성할 때 * /

 
fxsaber :

나는 MT5 빌드 중 하나의 발표에 있었던 MQ의 유일한 예에서 매크로를 연구했습니다. # 과 ##이 입력되었고 좋은 예가 있었습니다. 링크를 찾을 수 없습니다.

거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼

MetaTrader 5 클라이언트 터미널 빌드의 변경 사항 목록

MetaQuotes Software Corp. , 2014.10.30 06:25

MetaTrader 5 플랫폼 업데이트 빌드 1010: 새로운 신호, 시장 및 옵션

10월 31일 금요일에 MetaTrader 5 플랫폼에 대한 업데이트가 게시되며 업데이트에는 다음 변경 사항이 포함됩니다.

MetaTrader 5 클라이언트 터미널 빌드 1010
  1. MQL5: 매크로 매개변수를 문자열로 변환하고 매크로 매개변수를 연결하는 기능이 추가되었습니다. 다음은 매크로 연결을 사용하여 클래스 인스턴스의 자동 삭제를 구성할 수 있는 예입니다.
  2.  //+------------------------------------------------------------------+
    //|                                                     MacroExample |
    //|                        Copyright 2014, MetaQuotes Software Corp. |
    //|                                       http://www.metaquotes.net  |
    //+------------------------------------------------------------------+
    #property script_show_inputs
    input bool InpSecond=true;
    
    #define DEFCLASS(class_name) class class_name: public CBase{ public :class_name( string name):CBase(name){}};
    #define TOSTR(x) #x
    #define AUTODEL(obj) CAutoDelete auto_ ##obj(obj)
    #define NEWOBJ(type,ptr) do { ptr= new type(TOSTR(ptr)); \
                             Print ( "Create object '" ,TOSTR(type), " " ,TOSTR(ptr), "' by macro NEWOBJ" ); } \
                             while ( 0 )
    //+------------------------------------------------------------------+
    //| Базовый класс, необходим для автоудаления объектов               |
    //+------------------------------------------------------------------+
    class CBase
      {
    protected :
       string             m_name;
    
    public :
                         CBase( string name):m_name(name) { }
       string             Name( void ) const { return (m_name); }
    
      };
    //+------------------------------------------------------------------+
    //| Класс автоудаления объектов позволяет не следить за созданными   |
    //| объектами. Он удаляет их в своем деструкторе                     |
    //+------------------------------------------------------------------+
    class CAutoDelete
      {
       CBase            *m_obj;
    
    public :
                         CAutoDelete(CBase *obj):m_obj(obj) { }
                        ~CAutoDelete()
         {
           if ( CheckPointer (m_obj)==POINTER_DYNAMIC)
            {
             Print ( "Delete object '" ,m_obj.Name(), "' by CAutoDelete class" );
             delete m_obj;
            }
         }
      };
    //+------------------------------------------------------------------+
    //| Объявим два новых класса CFoo и CBar                             |
    //+------------------------------------------------------------------+
    DEFCLASS(CFoo);
    DEFCLASS(CBar);
    //+------------------------------------------------------------------+
    //| Основная функция скрипта                                         |
    //+------------------------------------------------------------------+
    void OnStart ()
      {
       CFoo *foo;
    //--- создадим объект класса CFoo
       NEWOBJ(CFoo,foo);
    //--- создадим экземпляр класса автоудаления объекта CFoo foo
       AUTODEL(foo);
    //---
       if (InpSecond)
         {
          CBar *bar;
           //---
          NEWOBJ(CBar,bar);
          AUTODEL(bar);
         }
    //--- Удалять foo не нужно, он будет удален автоматически
      }
    //+------------------------------------------------------------------+
 
fxsaber :

고맙습니다. 나는 같은 길을 갈 것이다.

출판 당시(06:25)로 판단하여, 나는 어리석게도 이 뉴스를 늦잠을 잤다)))

 

안녕하세요, 그들은 저에게 MA 표시기를 보냈습니다. 필요한 모든 레벨이 즉시 있습니다. 문제는 지표(각 MA) 위로 마우스를 가져가면 이 MA의 기간이 표시되지 않는다는 것입니다. 이 순간을 해결하는 방법? 이름 IndicatorShortName ( "MASHKI =)" )을 변경할 때 영구적인 구문 오류가 발생했습니다. 도와주세요, 제발.

 //+------------------------------------------------------------------+
//|                                                       ManyMA.mq4 |
//|                                                              VVM |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "VVM"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Gold
#property indicator_color2 Aqua
#property indicator_color3 Blue
#property indicator_color4 Magenta
#property indicator_color5 Red
#property indicator_color6 Green
#property indicator_color7 BurlyWood
#property indicator_color8 DarkViolet

extern int MA1_Period= 8 ;
extern int MA1_Shift= 0 ;
extern int MA1_Method= 1 ;

extern int MA2_Period= 13 ;
extern int MA2_Shift= 0 ;
extern int MA2_Method= 0 ;

extern int MA3_Period= 21 ;
extern int MA3_Shift= 0 ;
extern int MA3_Method= 1 ;

extern int MA4_Period= 50 ;
extern int MA4_Shift= 0 ;
extern int MA4_Method= 1 ;

extern int MA5_Period= 50 ;
extern int MA5_Shift= 0 ;
extern int MA5_Method= 0 ;

extern int MA6_Period= 100 ;
extern int MA6_Shift= 0 ;
extern int MA6_Method= 0 ;

extern int MA7_Period= 200 ;
extern int MA7_Shift= 0 ;
extern int MA7_Method= 0 ;

extern int MA8_Period= 350 ;
extern int MA8_Shift= 0 ;
extern int MA8_Method= 1 ;

extern int MA9_Period= 1000 ;
extern int MA9_Shift= 0 ;
extern int MA9_Method= 0 ;

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
double ExtMapBuffer9[];

int ExtCountedBars= 0 ;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   int     draw_begin1;
   int     draw_begin2;
   int     draw_begin3;
   int     draw_begin4;
   int     draw_begin5;
   int     draw_begin6;
   int     draw_begin7;
   int     draw_begin8;
   int     draw_begin9;
   
   string short_name;
   SetIndexStyle ( 0 , DRAW_LINE , 0 , 2 );
   SetIndexStyle ( 1 , DRAW_LINE , 0 , 2 );   
   SetIndexStyle ( 2 , DRAW_LINE , 0 , 2 );   
   SetIndexStyle ( 3 , DRAW_LINE , 0 , 2 );   
   SetIndexStyle ( 4 , DRAW_LINE , 0 , 2 );   
   SetIndexStyle ( 5 , DRAW_LINE , 0 , 3 );   
   SetIndexStyle ( 6 , DRAW_LINE , 0 , 3 );   
   SetIndexStyle ( 7 , DRAW_LINE , 0 , 3 );   
   SetIndexStyle ( 8 , DRAW_LINE , 0 , 4 );   
   
   SetIndexShift ( 0 , MA1_Shift);
   SetIndexShift ( 1 , MA2_Shift);
   SetIndexShift ( 2 , MA3_Shift);
   SetIndexShift ( 3 , MA4_Shift);
   SetIndexShift ( 4 , MA5_Shift);
   SetIndexShift ( 5 , MA6_Shift);
   SetIndexShift ( 6 , MA7_Shift);
   SetIndexShift ( 7 , MA8_Shift);
   SetIndexShift ( 8 , MA9_Shift);
   
   IndicatorDigits ( MarketInfo ( Symbol (), MODE_DIGITS ));
   
   draw_begin1=MA1_Period- 1 ;
   draw_begin2=MA2_Period- 1 ;
   draw_begin3=MA3_Period- 1 ;
   draw_begin4=MA4_Period- 1 ;
   draw_begin5=MA5_Period- 1 ;
   draw_begin6=MA6_Period- 1 ;
   draw_begin7=MA7_Period- 1 ;
   draw_begin8=MA8_Period- 1 ;
   draw_begin9=MA9_Period- 1 ;
   
   IndicatorShortName ( "MASHKI =)" );
   
   SetIndexDrawBegin ( 0 ,draw_begin1);
   SetIndexDrawBegin ( 1 ,draw_begin2);
   SetIndexDrawBegin ( 2 ,draw_begin3);
   SetIndexDrawBegin ( 3 ,draw_begin4);
   SetIndexDrawBegin ( 4 ,draw_begin5);
   SetIndexDrawBegin ( 5 ,draw_begin6);
   SetIndexDrawBegin ( 6 ,draw_begin7);   
   SetIndexDrawBegin ( 7 ,draw_begin8);
   SetIndexDrawBegin ( 8 ,draw_begin9);
   
   SetIndexBuffer ( 0 ,ExtMapBuffer1);
   SetIndexBuffer ( 1 ,ExtMapBuffer2);
   SetIndexBuffer ( 2 ,ExtMapBuffer3);
   SetIndexBuffer ( 3 ,ExtMapBuffer4);
   SetIndexBuffer ( 4 ,ExtMapBuffer5);
   SetIndexBuffer ( 5 ,ExtMapBuffer6);
   SetIndexBuffer ( 6 ,ExtMapBuffer7);
   SetIndexBuffer ( 7 ,ExtMapBuffer8);
   SetIndexBuffer ( 8 ,ExtMapBuffer9);
   
   
   
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   ExtCountedBars= IndicatorCounted ();
   if (ExtCountedBars< 0 ) return (- 1 );
   if (ExtCountedBars> 0 ) ExtCountedBars--;
   switch (MA1_Method)
     {
       case 0 : sma( 1 , MA1_Period);   break ;
       case 1 : ema( 1 , MA1_Period);  
     }
   switch (MA2_Method)
     {
       case 0 : sma( 2 , MA2_Period);   break ;
       case 1 : ema( 2 , MA2_Period); 
     }
   switch (MA3_Method)
     {
       case 0 : sma( 3 , MA3_Period);   break ;
       case 1 : ema( 3 , MA3_Period); 
     }
   switch (MA4_Method)
     {
       case 0 : sma( 4 , MA4_Period);   break ;
       case 1 : ema( 4 , MA4_Period); 
     }
   switch (MA5_Method)
     {
       case 0 : sma( 5 , MA5_Period);   break ;
       case 1 : ema( 5 , MA5_Period);
     }
   switch (MA6_Method)
     {
       case 0 : sma( 6 , MA6_Period);   break ;
       case 1 : ema( 6 , MA6_Period);  
     }
   switch (MA7_Method)
     {
       case 0 : sma( 7 , MA7_Period);   break ;
       case 1 : ema( 7 , MA7_Period);  
     }                  
   switch (MA8_Method)
     {
       case 0 : sma( 8 , MA8_Period);   break ;
       case 1 : ema( 8 , MA8_Period);  
     }
   switch (MA9_Method)
     {
       case 0 : sma( 9 , MA9_Period);  
       case 1 : ema( 9 , MA9_Period);  
     }      

   return ( 0 );
  }

void sma( int MAnum, int MA_period)
  {
   double sum= 0 ;
   int     i,pos= Bars -ExtCountedBars- 1 ;
//---- initial accumulation
   if (pos<MA_period) pos=MA_period;
   for (i= 1 ;i<MA_period;i++,pos--)
      sum+= Close [pos];
//---- main calculation loop
   while (pos>= 0 )
     {
      sum+= Close [pos];
       switch (MAnum)
        {
           case 1 : ExtMapBuffer1[pos]=sum/MA_period; break ;
           case 2 : ExtMapBuffer2[pos]=sum/MA_period; break ;
           case 3 : ExtMapBuffer3[pos]=sum/MA_period; break ;
           case 4 : ExtMapBuffer4[pos]=sum/MA_period; break ;
           case 5 : ExtMapBuffer5[pos]=sum/MA_period; break ;
           case 6 : ExtMapBuffer6[pos]=sum/MA_period; break ;
           case 7 : ExtMapBuffer7[pos]=sum/MA_period; break ;
           case 8 : ExtMapBuffer8[pos]=sum/MA_period; break ;
           case 9 : ExtMapBuffer9[pos]=sum/MA_period;    
        }        
                       
           sum-= Close [pos+MA_period- 1 ];
           pos--;
     }
//---- zero initial bars
       if (ExtCountedBars< 1 )
       switch (MAnum)
        {
           case 1 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer1[ Bars -i]= 0 ; break ;
           case 2 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer2[ Bars -i]= 0 ; break ;
           case 3 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer3[ Bars -i]= 0 ; break ;
           case 4 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer4[ Bars -i]= 0 ; break ;
           case 5 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer5[ Bars -i]= 0 ; break ;
           case 6 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer6[ Bars -i]= 0 ; break ;
           case 7 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer7[ Bars -i]= 0 ; break ;
           case 8 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer8[ Bars -i]= 0 ; break ;
           case 9 : for (i= 1 ;i<MA_period;i++) ExtMapBuffer9[ Bars -i]= 0 ;
        }                 
  }
  
   void ema( int MAnum, int MA_Period)
  {
   double pr= 2.0 /(MA_Period+ 1 );
   int     pos= Bars - 2 ;
   if (ExtCountedBars> 2 ) pos= Bars -ExtCountedBars- 1 ;
//---- main calculation loop
   while (pos>= 0 )
     {
       switch (MAnum)
        {
           case 1 : if (pos== Bars - 2 ) ExtMapBuffer1[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 2 : if (pos== Bars - 2 ) ExtMapBuffer2[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 3 : if (pos== Bars - 2 ) ExtMapBuffer3[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 4 : if (pos== Bars - 2 ) ExtMapBuffer4[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 5 : if (pos== Bars - 2 ) ExtMapBuffer5[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 6 : if (pos== Bars - 2 ) ExtMapBuffer6[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 7 : if (pos== Bars - 2 ) ExtMapBuffer7[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 8 : if (pos== Bars - 2 ) ExtMapBuffer8[pos+ 1 ]= Close [pos+ 1 ]; break ;
           case 9 : if (pos== Bars - 2 ) ExtMapBuffer9[pos+ 1 ]= Close [pos+ 1 ];
        }     
       switch (MAnum)
        {
           case 1 : ExtMapBuffer1[pos]= Close [pos]*pr+ExtMapBuffer1[pos+ 1 ]*( 1 -pr); break ;
           case 2 : ExtMapBuffer2[pos]= Close [pos]*pr+ExtMapBuffer2[pos+ 1 ]*( 1 -pr); break ;
           case 3 : ExtMapBuffer3[pos]= Close [pos]*pr+ExtMapBuffer3[pos+ 1 ]*( 1 -pr); break ;
           case 4 : ExtMapBuffer4[pos]= Close [pos]*pr+ExtMapBuffer4[pos+ 1 ]*( 1 -pr); break ;
           case 5 : ExtMapBuffer5[pos]= Close [pos]*pr+ExtMapBuffer5[pos+ 1 ]*( 1 -pr); break ;
           case 6 : ExtMapBuffer6[pos]= Close [pos]*pr+ExtMapBuffer6[pos+ 1 ]*( 1 -pr); break ;
           case 7 : ExtMapBuffer7[pos]= Close [pos]*pr+ExtMapBuffer7[pos+ 1 ]*( 1 -pr); break ;
           case 8 : ExtMapBuffer8[pos]= Close [pos]*pr+ExtMapBuffer8[pos+ 1 ]*( 1 -pr); break ;
           case 9 : ExtMapBuffer9[pos]= Close [pos]*pr+ExtMapBuffer9[pos+ 1 ]*( 1 -pr);
        }             
           pos--;
     }
  }

마침표가 표시되지 않고 Mashki의 이름만 표시됩니다 =))