코딩 도움말 - 페이지 782

 
  1. 이중 게시 하지 마십시오! 스레드는 이미 열려 있습니다.
    포럼의 일반 규칙 및 모범 사례. - 일반 - MQL5 프로그래밍 포럼

  2. mcaesart : 하지만 내가 원하는대로 작동하지 않습니다.

    "작동하지 않는다"는 의미가 없습니다. 마치 자동차가 작동하지 않는다고 말하는 것과 같습니다. 시동이 걸리지 않고, 기어가 들어가지 않고, 전기가 들어오지 않고, 열쇠가 없고, 타이어가 펑크납니다. 의미가 없습니다.
    현명한 방법으로 질문하는 방법 . 20 04
    코드에 대해 질문할 때

 
mcaesart

동일한 주제로 귀하의 주제를 삭제했습니다.

 
KristijanO : 많은 오류가 발생합니다... 예기치 않은 토큰 오류가 발생합니다.
  1. 주제를 벗어난 게시물을 위해 다른 스레드를 가로채지 마세요. "코딩 도움말"을 요청하지 않습니다. 다음에는 자신만의 새로운 실을 만드십시오.

  2. 정말 대답을 기대합니까? 여기에는 마음의 독자가 없고 우리의 수정 구슬은 금이 갔습니다. 깨진 코드를 볼 수 없습니다. 한 줄에 대한 컨텍스트가 없습니다. 귀하의 문제는 그 이상일 가능성이 큽니다.

  3. 모든 관련 코드를 게시합니다(예: 해당 줄 위에 있는 코드).
  4. 오류 메시지를 게시하고 오류가 있는 행을 표시하십시오.

  5. 현명한 방법으로 질문하는 방법 . 20 04
    무의미한 쿼리 를 정리합니다.

 
auto_free_TEAMTRADER :

모든 기호는 내 플랫폼에서 사용할 수 있습니다.

3개의 다른 renko 지표와 3개의 다른 플랫폼에서 시도했지만 여전히 renko 차트에서는 아무 것도 작동하지 않습니다.

다른 모든 지표는 올바르게 작동하며 CCI, RSI 및 스토치입니다.

다른 사람이 제안 사항이 있습니까?

팀 트레이더

안녕하세요 Auto_free_Teamleader


나는 같은 문제가 있습니다. 솔루션을 찾은 경우 pls 회신

 
Rex Kalist :

안녕하세요 Auto_free_Teamleader


나는 같은 문제가 있습니다. 솔루션을 찾은 경우 pls 회신

auto_free_TEAMTRADER 또는 Mladen, Pls 지원
 

안녕하세요 여러분,

나는 사용자 지정 지표를 만드는 데 3주를 보냈지만 누군가가 도울 수 있기를 바라며 충분히 좋지 않습니다.

내 표시기는 "시간 프레임", "차트의 표시 수준 수" 및 "각 수준 사이의 최소 거리"의 3가지 extern을 사용합니다.

내가 코딩해야 하는 것은 그룹화하고 최소 거리 내에서 프랙탈 포인트를 제거한 다음 나머지 프랙탈 포인트 레벨을 표시하는 것입니다.

내가 만든 첫 번째 버전(MainRS_AddOn2.mq4)은 내가 원하는 대로 정확하게 수행하지만 개체를 그리고 수정 개체를 유지하여 어리석은 방법을 사용하면 표시기가 매우 느리게 실행됩니다.

두 번째 버전(17_8_2020_RS_Indicator.mq4)은 훨씬 빠르게 실행되는 버퍼에 모든 레벨을 저장하지만 해결할 수 없는 문제가 있습니다.

----나는 새로운 프랙탈 수준을 저장하는 데 논리적 오류가 있다고 생각합니다. 일부 디스플레이 수준은 최소 거리 요구 사항을 충족하지 않고 테스터에서 실행할 때 더 많은 중복 수준을 얻었습니다.

왼쪽은 레벨이 중복된 17_8_2020_RS_Indicator.mq4입니다.

위는 테스터 내부의 중복 레벨입니다.


 if (modify == false ) // store new level when display level limit have no more room
                     {      
                                 if (RSMode[limit]== 1 )
                                    { 
                                       int index = ArrayMinimum (Display_level, WHOLE_ARRAY , 0 );
                                       Display_Mode[index]=RSMode[limit] ;
                                       Display_level[index]=RSBuffer1[limit];
                                    }  
                                 if (RSMode[limit]== 2 )
                                    { 
                                       int index = ArrayMaximum (Display_level, WHOLE_ARRAY , 0 );
                                       Display_Mode[index]=RSMode[limit] ;
                                       Display_level[index]=RSBuffer1[limit];
                                    }
                                    
                                  modify = true ; 
                                      
                     } 
                 }          

위의 코드가 논리적 오류를 일으킬 수 있다고 생각합니다. 그러나 전체 파일을 조사하는 데 시간을 할애하지 않는 한 아무도 말할 수 없습니다.

누구든지 도움을 주시면 감사하겠습니다. 아래는 전체 코드입니다. 첨부 파일을 복사하여 붙여넣거나 다운로드할 수 있습니다.

감사합니다.

 //+------------------------------------------------------------------+
//|                                             MainRS_Indicator.mq4 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+

#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property description "Indicator to show Grouped Fractal Support and Resisitance Level"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#define Confirm_Level 3
#define Up_Fractal   1
#define Down_Fractal   2
#define Combined_Up   4
#define Combined_Down   5
 
enum timeframe_display_option
   {
    Current = 0 ,
    PeriodM5 = 5 ,
    PeriodM15 = 15 ,
    PeriodM30 = 30 ,
    PeriodH1 = 60 ,
    PeriodH4 = 240 ,
    PeriodD1 = 1440 ,
    PeriodW1 = 10080 ,
   };
double RSBuffer1[]; //hold new form fractal
double RSMode[]; //hold new form fractal status
double Display_level[]; // hold fractal display level 
double Display_Mode[]; // hold fractal display level status

extern int                        Show_Level_Limit = 15 ;         //Max Level to be display on chart
extern timeframe_display_option  Level_of_TimeFrame=Current; //Option to display which timeframe level on chart
extern double                     sensitvity = 15 ;     // Min distance between each RS level,input in pips values
int DisplayIndex = 0 ;


//++++ These are adjusted for 5 digit brokers.
   int      pips2points;     // slippage  3 pips    3=points    30=points
   double   pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
   int      Digitspips;     // DoubleToStr(dbl/pips2dbl, Digits.pips)
   string indId = "SR_" ;     // string to name object on chart for delete and create object
   double fractal;         // to store fractal point value
   bool modify = false ;     // to indicate a existing level on chart being modify or not
   double status; // status of display level, use to reduce and combine level within min distance
   color mark = clrRed ;                 

   //--------------------------------------------------
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
                                            
     if ( Digits % 2 == 1 )
     {       // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                pips2dbl    = Point * 10 ; 
                pips2points = 10 ;   
                Digitspips = 1 ;
     } 
     else 
     {   pips2dbl    = Point ;    
         pips2points =   1 ;   
         Digitspips = 0 ; 
     }
   SetIndexBuffer ( 0 , RSBuffer1);
   SetIndexStyle( 0 , DRAW_ARROW );
   SetIndexArrow( 0 , 251 );   //buffer 0 draw line not symbol
   SetIndexEmptyValue( 0 , 0.0 );
   SetIndexBuffer ( 1 , RSMode);
   SetIndexStyle( 1 , DRAW_NONE );
   SetIndexArrow( 1 , 251 );   //buffer 0 draw line not symbol
   SetIndexEmptyValue( 1 , 0.0 );
   sensitvity = sensitvity * pips2dbl; // min distance of each display level/fractal point
     return ( 0 );

  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   DeleteAllObjects();
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if (counted_bars > 0 )       //---- the last calculated bar will be recalculated   
      counted_bars--;
   int limit = Bars - counted_bars- 1 ;

//-------------------------------------------------------------------------------------------------  
//---- store fractal point to array   
//-------------------------------------------------------------------------------------------------  
   while (limit> 0 )
   { 
   fractal = iFractals ( NULL , Level_of_TimeFrame, MODE_UPPER, limit);
       if (fractal != 0 )
     {   
      RSBuffer1[limit]= fractal;
      RSMode[limit]= Up_Fractal;
     }
   fractal = iFractals ( NULL , Level_of_TimeFrame, MODE_LOWER, limit);
       if (fractal != 0 )
      {
      RSBuffer1[limit]= fractal;
      RSMode[limit]= Down_Fractal;
      }
//-----------------------------------------------------------------------------------------------------------------------------------------------      
//below status for fractal point reduction  
//Confirm_Level 3
//Up_Fractal  1
//Down_Fractal  2
//Combined_Up   4
//Combined_Down  5
//upper fractal point with another upper fractal point == combined up
//lower fractal point with another lower fractal point == combine down
//opposite fractal merge == confirm level (up & down || up & combine down || up && confirm || down & up || down & combine up ||down && confirm)
//--------------------------------------------------------------------------------------------------------------------------------------------------

   ArrayResize (Display_level,Show_Level_Limit+ 1 );
   ArrayResize (Display_Mode,Show_Level_Limit+ 1 );
     if ( RSBuffer1[limit]!= 0 )
     { 
       for ( int i=Show_Level_Limit- 1 ;  i>= 0 ; i--)
      {
         double diff = MathAbs (RSBuffer1[limit]-Display_level[i]); // calculate min distance between level
         modify = false ;

                   if (diff<=sensitvity ) //new fractal, check against Displaylevel
                     {  
                         if (Display_Mode[i]== 1 && RSMode[limit] == 1 ) // 
                           {   
                                 Display_Mode[i]= 4 ; // mode up & up = combine up
                                 if (RSBuffer1[limit]<Display_level[i])
                                    Display_level[i]=Display_level[i];
                                    
                               Comment (   " Up & Up== " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]);
                           }
                         if (Display_Mode[i]== 4 && RSMode[limit] == 1 )
                           {
                                    Display_Mode[i]= 4 ; // mode combine up & up = combine up
                                     if (RSBuffer1[limit]<Display_level[i])
                                       Display_level[i]=Display_level[i];
                               Comment (   " Up & combine Up== " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]);
                           }      
                         if (Display_Mode[i]== 2 && RSMode[limit] == 2 )
                           {  
                                  Display_Mode[i]= 5 ; // mode down & down = combine down
                                   if (RSBuffer1[limit]>Display_level[i])
                                    Display_level[i]=Display_level[i];
                               Comment (   "down & down== " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]); 
                           }
                         if (Display_Mode[i]== 5 && RSMode[limit] == 2 )
                           {
                                    Display_Mode[i]= 5 ; // mode down & combine down  = combine down
                                     if (RSBuffer1[limit]>Display_level[i])
                                       Display_level[i]=Display_level[i];
                               Comment (   " Down & combine down== " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]);
                           }   
                         
                     }    

                     if (diff<=sensitvity) 
                     {    
                         
                         if ((Display_Mode[i]== 2 && RSMode[limit] == 1 )||(Display_Mode[i]== 1 && RSMode[limit] == 2   ))
                           {
                               Display_Mode[i]= 3 ; // mode  up & down & combine down  = confirm 
                                    Display_level[i]=Display_level[i];
                               Comment (   "Up & down or combine down == " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]);
                              modify = true ;
                               break ;
                           }                          
                         if ( (Display_Mode[i]== 3 || Display_Mode[i]== 5 ))
                           {
                               Display_Mode[i]= 3 ; // mode  up & confirm level = confirm 
                               Display_level[i]=Display_level[i];
                               Comment (   "Up & confirm level== " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]);
                              modify = true ;
                               break ;
                           }
                           
                         if ( Display_Mode[i]== 3 || Display_Mode[i]== 4 )
                           {
                               Display_Mode[i]= 3 ; // mode  down & confirm level = confirm 
                               Display_level[i]=Display_level[i];
                               Comment (   "Down & confirm level== " + Display_level[i]+ "Display_Mode = " +Display_Mode[i]);
                              modify = true ;
                               break ;
                           }
                           
                     }
                  
       } //end of modify existing level for loop 
                  
                   if (modify == false ) // store disply level untill reacah show level limit
                  { 
                     for ( int a= 0 ;  a<Show_Level_Limit- 1 ; a++)
                     { 
                         if (Display_Mode[a]== 0 )
                        {
                           Display_Mode[a]=RSMode[limit];
                           Display_level[a] = RSBuffer1[limit];
                           
                           modify = true ;
                           break ;
                        } 
                        a++;  
                     }
                 
                   if (modify == false ) // store new level when display level limit have no more room
                     {      
                                 if (RSMode[limit]== 1 )
                                    { 
                                       int index = ArrayMinimum (Display_level, WHOLE_ARRAY , 0 );
                                       Display_Mode[index]=RSMode[limit] ;
                                       Display_level[index]=RSBuffer1[limit];
                                    }  
                                 if (RSMode[limit]== 2 )
                                    { 
                                       int index = ArrayMaximum (Display_level, WHOLE_ARRAY , 0 );
                                       Display_Mode[index]=RSMode[limit] ;
                                       Display_level[index]=RSBuffer1[limit];
                                    }
                                    
                                  modify = true ; 
                                      
                     } 
                 }          
      }

      limit--;
      
   }    
                  DeleteAllObjects();
                 
                   int uplevel= 1 ;
                   int downlevel= 1 ;
                   ArraySort (Display_level, WHOLE_ARRAY , 0 ,MODE_ASCEND);
                  DisplayIndex = 0 ;
                   for ( int a= 0 ;a< ArraySize (Display_level)- 1 ; a++)
                  {
                         if (Display_level[a]<Bid && Display_level[a+ 1 ]>Bid)
                           DisplayIndex =a+ 1 ;
                  }         

                     for ( int c =DisplayIndex ; c<=Show_Level_Limit; c++)
                  {         
                     HLine( "SR_RES" +uplevel+ " # " + c, Display_level[c],mark);
                     uplevel++;
                  }   
                     for ( int c =DisplayIndex- 1 ; c> 0 ; c--)
                  {         
                     HLine( "SR_SUP" +downlevel+ " # " + c, Display_level[c],mark);
                     downlevel++;
                  }   

                     

       



return ( 0 );
   } 
void HLine( string name, double P0, color clr)
      {
           #define WINDOW_MAIN 0
     /**/    if ( ObjectMove ( name, 0 , Time[ 0 ], P0 )){}
             else if (! ObjectCreate ( name, OBJ_HLINE , WINDOW_MAIN, Time[ 0 ], P0 ))
                     Alert ( "ObjectCreate(" ,name, ",HLINE) failed: " , GetLastError () );
           if (!ObjectSet(name, OBJPROP_COLOR , clr )) // Allow color change
                   Alert ( "ObjectSet(" , name, ",Color) [1] failed: " , GetLastError () );
           if (!ObjectSetText(name, PriceToStr(P0), 10 ))
                     Alert ( "ObjectSetText(" ,name, ") [1] failed: " , GetLastError ());
}
void DeleteAllObjects()
{
   // Delete all objects created by the indicator
   for ( int i = ObjectsTotal () - 1 ;  i >= 0 ;  i--)
   {
       string name = ObjectName (i);
      
       if ( StringSubstr (name, 0 , StringLen (indId)) == indId)
         ObjectDelete (name);
   }
}
 
string   PriceToStr( double p)
   {
     string pFrc = DoubleToStr(p, Digits );       
     if (Digitspips== 0 ) 
       return (pFrc);
     string pPip = DoubleToStr(p, Digits - 1 );
     if (pPip+ "0" == pFrc)       
       return (pPip);           
       return (pFrc);          
   }
//---------------------------------------------------------------------------------------------  
double Price( double Old, double New, int result) //1 return larger value, 2 return smaller value
   { 
   double value= 0 ;
   if (result== 1 )
   value= MathMax (Old,New);
   if (result== 2 )
   value= MathMin (Old,New);
   return (value);
   }
//---------------------------------------------------------------------------------------------   
 

다른 스레드를 가로채는 경우 사과드립니다.

누군가가 내 코드 내에서 저지른 실수를 지적하는 데 도움을 줄 수 있기를 바라면 중복된 디스플레이 수준 문제를 해결할 수 있습니다.

많은 감사

 
wccmcd :

MQL4에서 MQL5로 이동하려고 하지만 첫 번째 단계에서 멈췄습니다. 기능 iCCI의 경우 "shift" 매개변수가 더 이상 없는 이유는 무엇입니까?

게시물을 수정하고

코드를 붙여넣을 때 코드 버튼(Alt+S) 사용

이 섹션은 MQL4입니다.

MQL5에서는 OnInit에서 핸들을 만들고 기본 코드의 버퍼 값에 액세스합니다.

MQL5에 대한 문서를 읽는 것이 좋습니다.

 
Keith Watford :

게시물을 수정하고

코드를 붙여넣을 때 코드 버튼(Alt+S) 사용

이 섹션은 MQL4입니다.

MQL5에서는 OnInit에서 핸들을 만들고 기본 코드의 버퍼 값에 액세스합니다.

MQL5에 대한 문서를 읽는 것이 좋습니다.

그 죄송합니다. 엉뚱한 곳에 글을 올리고 있다는 걸 이제서야 깨달았습니다. 를 통해 회신해 주셔서 감사합니다. 방금 삭제했습니다.
 
여보세요,
저는 mql4를 배우는 초보자일 뿐입니다. 기본적인 슈퍼트렌드 지표를 만들려고 합니다.
경고 코드와 관련하여 전문가의 도움이 필요합니다.


현재 경고 코드:
Alert(Symbol() + "(" + 마침표() + "M) --> " + Lsignal + CPri);

다음과 같이 출력됩니다.
기호 이름(15M) --> 524.55에서 구매

그러나 다음과 같은 간단한 계산을 기반으로 경고에도 손절매와 목표가 필요합니다.

524.55에서 구매 항목을 가정합니다.

손절매 : 진입 - 주식 진입 가격의 1.5% (524.55 - 7.85 = 516.70)
목표 1 : 진입 + 주식 진입 가격의 2.5% (524.55 + 13.10 = 537.65)
Target 2 : 진입 + 주가의 5% (524.55 + 26.20 = 550.75)

(참고: 틱 크기는 0.05입니다. 따라서 손절매 또는 목표 계산이 홀수인 경우 가장 가까운 틱 크기로 반올림해야 합니다. 그리고 LSignal이 매도 신호 인 경우 역 계산이 필요합니다.


마지막으로 다음 출력이 필요합니다.
기호 이름(15M) --> 524.55에서 매수, SL: 516.70, 목표 1: 537.65, 목표 2: 550.75


누군가 내 요구 사항에 대한 코드를 다시 작성할 수 있습니까?

TY in adv.