코드를 도와주세요 - 페이지 3

 
mohsin360 :

오류를 수정하거나 힌트를 주세요.


"mohsin360", 컴파일러가 무엇이 잘못되었는지 알려줍니다. 오류 보고서를 읽고 후속 조치를 취하지 않는 이유는 무엇입니까?

정의되지 않은 변수가 있다고 표시되면 오류가 발생하지 않도록 변수를 정의하십시오.

불균형 괄호 ")"가 있다고 표시되면 올바른 수의 왼쪽 및 오른쪽 괄호를 배치했는지 그리고 하나 이상이 누락되었을 수 있는지 확인해야 함을 의미합니다.

이것은 이미 코딩하는 방법을 조금 알고 있는 사람을 위한 간단한 오류입니다.

프로그래밍에 대해 아무 것도 모른다면 EA 또는 Indicator를 작성하기 전에 먼저 프로그래밍의 기초를 배우고 컴파일러를 사용하고 일반적으로 코드의 구문 오류를 수정하는 데 시간을 할애해야 합니다.

시작하기에 좋은 곳은 바로 여기 이 사이트의 " MQL4 Book "입니다!

또는 "C 프로그래밍"에 대한 초보자 책이나 초보자를 위한 "C"에 대한 온라인 자습서일 수 있습니다. 이를 통해 기본 사항을 이해하고 MQL4를 계속 진행할 수 있습니다.

 

예, 저는 오류 보고서를 읽었고 내 후행 시작 코드의 b coz에 첫 번째 및 두 번째 오류가 포함되어 있습니다. 그리고 나는 alpari 또는 mt4가 최소 30핍의 후행을 허용하지 않는다는 것을 알게 되어 코드를 약간 변경하기로 결정하고 시작 코드를 뒤따르는 대신 코드를 수정하는 스트레이트 오더를 사용합니다. 저와 함께 작업해 주셔서 감사합니다. 새 변경 사항을 만들고 컴파일한 후 도움이 필요한지 다시 물어보십시오.

문안 인사

모신.meo

 
다시 한 번 감사합니다 . WHRoeder
 

내 메타 편집기는 오류 목록에서 검색할 때 첫 번째 오류가 (145,51)임을 표시합니다 . 나는 다음과 같이 말합니다. 단 5핍 외에 순서를 수정하지만 (153,62),(158,8),(164,8),(170,55),(180,60)및 (185,8)과 같은 다른 오류를 검색할 때 .I cant fine any error no which is list in the list of the list is a list that I fine things that I fine things and failed to find other. 제발 아무도 나에게 오류의 의미가 무엇인지 그리고 내가 검색한 의미를 찾을 수 있는 곳을 말해 줄 수 있습니까? " 예기치 않은 토큰"이 표시되고 코드 구문에 문제가 있을 때만 오는 것을 알 수 있지만 보시다시피 맨 위에 잘못된 매개변수 개수 @(145,51) 및 (153,62)와 145개만 나열되는 두 개의 오류가 있습니다. 인덱스이지만 153,62는 Y가 아닙니다.

 
//+------------------------------------------------------------------+
//|                                                 every tick20.mq4 |
//|                                                    mohsin mewati |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "mohsin mewati"
#property link        ""

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
 
int init()
  {
//----
   int order_open_time_buy = 0 ; //intiger to save buy open Time
   int order_open_time_sell = 0 ; //intiger to save sell open Time
   bool err_close_all_orders = 0 ; //bolean to save get last error for close all opened orders code
   
   bool err_sell= 0 ;
   bool err_buy= 0 ;
   bool err_selection_buy= 0 ;
   bool err_selection_sell= 0 ;
   bool buy_modified= 0 ;
   bool sell_modified= 0 ;
   double mf_buy= 0 ;
   double mf_sell= 0 ;
   int buy_trail= 0 ;
 
   int err_trail_buy= 0 ;
   int err_modify_sell= 0 ;
   int buy_selection= 0 ;
   bool buy_open_price= 0 ;
   int sell_selection= 0 ;
//----
   return ( 0 );
  }

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

//----
 
   int start()
  {
  
   bool err_buy;
   int buy_ticket;
   bool err_sell;
   int sell_ticket;
   bool err_selection_buy;
   int buy_selection;
   double buy_open_price;
   bool err_selection_sell;
   int sell_selection;
   bool err_mf_buy;
   bool srr_mf_sell;
   bool err_mf_sell;
   bool err_trail_buy;
   bool err_modify_sell;
   bool buy_modified;
   bool err_trail_sell;
   bool err_modify_buy;
   int buy_trail= 0 ;
   int sell_trail= 0 ;
   string buy= "open" ;
   string sell= "open" ;
   int bp= 20 ;
   int sp= 20 ;
   double buy_ans;
   double sell_ans;
   double slbuy;
   double slsell;
   double tp_sell;
   double tp_buy;
   
 
   //coding starts
  
  
   while (err_buy== 0 ){ //for loop started to execute a buy Order
  
   buy_ticket= OrderSend ( "GBPUSD" , OP_BUY , 1 , Ask , 3 , Ask + 20 * Point , 0 ,Green); //code to execute a buy (buy order placed without SL but with a TP of 20 pips
  err_buy=GetLastError(); //code to check either buy is executed or not?
  
 } //for loop end
   while (err_sell== 0 ){ //for loop to place a sell order
    sell_ticket = OrderSend ( "GBPUSD" , OP_SELL , 1 , Ask , 3 , Ask - 20 * Point , 0 ,Red); //code to place a sell ,order placed without SL but with a TP of 20 pips
   err_sell=GetLastError(); //code to check either sell is placed or not?
   } //for loop ends
   Alert ( "buy/sell executed" );
   
   //__________________________________________________________________________________________________________________________________
   
   while (err_selection_buy== 0 ){ // for loop start to selection of first executed order for further procedure
   buy_selection= OrderSelect ( "Buy_ticket" , SELECT_BY_TICKET ); //order select and stored in intiger
   err_selection_buy=GetLastError(); //code to check eithet order is selected or not
   } //for loop ends
   
   
   
  buy_open_price= OrderOpenPrice (); //taking open price for the first selected order
  buy_ans=buy_open_price;
   
   
   
     while (err_selection_sell== 0 ){ // for loop start to selection of second executed order for further procedure
   sell_selection= OrderSelect ( "Sell_ticket" , SELECT_BY_TICKET ); //order select and stored in intiger
   err_selection_sell=GetLastError(); //code to check eithet order is selected or not
   } //for loop ends
   
   
   
double sell_open_price= OrderOpenPrice (); //taking open price for the second selected order
   
 sell_ans=sell_open_price;
   
   
   
   while ( "buy_trail==0" && "Sell_trail==0" ){ // while loop started to check if thow of them or one is true
      
       while ( "err_mf_buy==0" &&   "err_mf_sell==0" ){ //while loop start to take price quote every time for buy and sell
         double mf_buy= MarketInfo ( "GBPUSD" , MODE_POINT ); //code to store markeet info in integer mf_buy
        err_mf_buy=GetLastError(); //code to confirm the previous line of code executed? 
       double mf_sell= MarketInfo ( "GBPUSD" , MODE_POINT ); //code to store markeet info in integer mf_sell
        err_mf_sell=GetLastError(); //code to confirm the previous line of code executed? 
       }
       
       if (mf_buy==slbuy){
        buy= "closed" ;}
       
       else {
       if ( mf_sell==slsell){
     
       sell= "closed" ;}
       else {}
       }
       
       
       if ( "mf_buy-bp == buy_ans" && "Buy==open" ){ //if condition to compare if current markeet quote which stored in mf_buy is 20 times greater than the open price of buy Order?
       
       
       while (err_trail_buy== 0 ){ //if above condition true for loop started to start trailing on buy order.
       OrderModify (buy_ticket,buy_open_price,slbuy);
             bp= "(bp+5)" ;
        err_trail_buy=GetLastError(); //code to confirm the previous line of code executed? 
        }
        
         if (bp>= 30 ){
        tp_sell= 0.00005 ;
         while (err_modify_sell== 0 ){ //if buy is in profit for 20 pips and trailing stop started on it i want my sell to modify for take profit for just 5 pips.
       OrderModify (sell_ticket,sell_open_price,slsell,tp_sell);
       err_modify_sell=GetLastError(); //code to confirm the previous line of code executed? 
       buy_trail= 1 ; //intiger use to remember that the buy was in profit and all the cooding associated with it was executed there is no need to check .
       }
       }
       else {
     
       }
       
       
       
       else if ( "mf_sell+sp" <= "Sell_ans" && "Sell" == "open" ){ //another logical test to check if buy was not in 20 pips if our sell is in 20 pips profit if so then in the next for loop statrted
       
       
       
       
       while (err_trail_sell== 0 ){ //for loop start to modify sell for trail
         OrderModify (sell_ticket,sell_open_price,slsell);
       sp= "(sp+5)" ;
       
        err_trail_sell=GetLastError(); //code to confirm the previous line of code executed? 
        }
        
         if (sp>= 30 ){
        tp_buy= 0.00005 ;
        
       while (err_modify_buy== 0 ){ //if our sell is in 20 pips profit and trailing executed on it while loop start to modify buy for tp for just 5 pips 
         OrderModify (buy_ticket,buy_open_price,slbuy,tp_buy);
          err_modify_buy=GetLastError(); //code to confirm the previous line of code executed? 
         sell_trail= 1 ; //intiger use to remember that the sell was in profit and all the cooding associated with it was executed there is no need to check .
         }
       }
       else {
       }
       
       }
       
       
   }

 
   
   
  }
   double ab= AccountBalance ();
  
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
여기 코드가 있습니다
 
mohsin360 :

내 메타 편집기는 오류 목록에서 검색할 때 첫 번째 오류가 (145,51)임을 표시합니다 . 나는 다음과 같이 말합니다. 단 5핍 외에 순서를 수정하지만 (153,62),(158,8),(164,8),(170,55),(180,60)및 (185,8)과 같은 다른 오류를 검색할 때 .I cant fine any error no which is list in the list of the list is a list that I fine things that I fine things and failed to find other. 제발 아무도 나에게 오류의 의미가 무엇인지 그리고 내가 검색한 의미를 찾을 수 있는 곳을 말해 줄 수 있습니까? " 예기치 않은 토큰"이 표시되고 코드 구문에 문제가 있을 때만 오는 것을 알 수 있지만 보시다시피 맨 위에 잘못된 매개변수 개수 @(145,51) 및 (153,62)와 145개만 나열되는 두 개의 오류가 있습니다. 인덱스이지만 153,62는 Y가 아닙니다.

145는 오류 번호가 아닌 줄 번호입니다. . . 51은 문자 열 번호입니다. 이것은 실행 오류가 아니라 코딩 오류입니다. . . 교정기를 고치십시오.

이것은 잘못된 것입니다. . .

buy_selection = OrderSelect (    "Buy_ticket" ,   SELECT_BY_TICKET );

OrderSelect() 첫 번째 매개변수는 문자열이 아닌 int여야 합니다. 설명서를 읽어보세요.

여기도 마찬가지입니다. . .

sell_selection = OrderSelect (    "Sell_ticket" ,   SELECT_BY_TICKET ); //order select and stored in intiger


이것들은 문자열이며 작동하지 않습니다. . .

 while  "buy_trail==0"    && "Sell_trail==0"      ){ // while loop started to check if thow of them or one is true

여기도 마찬가지입니다. . .

 while  "err_mf_buy==0" &&    "err_mf_sell==0"    ){ //while loop start to take price quote every time for buy and sell
 

나는 이미 Buy_ticket을 서버 @ordersend Buy로부터 받은 티켓의 값을 포함하는 intiger로 선언했으며 판매에 대해서도 동일합니다.

orderselect의 첫 번째 매개변수 가 숫자여야 한다고 말하면 분명히 먼저 intiger에 저장한 다음 그 intiger를 호출하고 내가 하는 일을 어떻게 했는지 알 수 있습니다.

?

 
mohsin360 :

나는 이미 Buy_ticket을 서버 @ordersend Buy로부터 받은 티켓의 값을 포함하는 intiger로 선언했으며 판매에 대해서도 동일합니다.

orderselect의 첫 번째 매개변수가 숫자여야 한다고 말하면 분명히 먼저 intiger에 저장한 다음 그 intiger를 호출하고 내가 하는 일을 어떻게 했는지 알 수 있습니다.

?

이것은 정수입니다. . .

 int Buy_ticket;

Buy_ticket = 10 ;

이것은 문자열이다

 "Buy_ticket"
 

abt ""를 말하는 경우?

나는 이것들을 제거 했고 메타 에디터는 정의되지 않은 오류 변수를 보여주는 사전 정의 변수 abt를 요청합니다.

구매_티켓

매도 티켓

이제 이 이중 쉼표를 수정하고 오류가 두 개뿐입니다.

여기 코드가 있습니다

 //+------------------------------------------------------------------+
//|                                                 every tick20.mq4 |
//|                                                    mohsin mewati |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "mohsin mewati"
#property link        ""

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
 
int init()
  {
//----
   int order_open_time_buy = 0 ; //intiger to save buy open Time
   int order_open_time_sell = 0 ; //intiger to save sell open Time
   bool err_close_all_orders = 0 ; //bolean to save get last error for close all opened orders code
   
   bool err_sell= 0 ;
   bool err_buy= 0 ;
   bool err_selection_buy= 0 ;
   bool err_selection_sell= 0 ;
   bool buy_modified= 0 ;
   bool sell_modified= 0 ;
   double mf_buy= 0 ;
   double mf_sell= 0 ;
   int buy_trail= 0 ;
 
   int err_trail_buy= 0 ;
   int err_modify_sell= 0 ;
   int buy_selection= 0 ;
   bool buy_open_price= 0 ;
   int sell_selection= 0 ;
//----
   return ( 0 );
  }

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

//----
 
   int start()
  {
  
   bool err_buy;
   int buy_ticket;
   bool err_sell;
   int sell_ticket;
   bool err_selection_buy;
   int buy_selection;
   double buy_open_price;
   bool err_selection_sell;
   int sell_selection;
   bool err_mf_buy;
   bool srr_mf_sell;
   bool err_mf_sell;
   bool err_trail_buy;
   bool err_modify_sell;
   bool buy_modified;
   bool err_trail_sell;
   bool err_modify_buy;
   int buy_trail= 0 ;
   int sell_trail= 0 ;
   string buy;
   string sell;
   int bp= 20 ;
   int sp= 20 ;
   double buy_ans;
   double sell_ans;
   double slbuy;
   double slsell;
   double tp_sell;
   double tp_buy;
   
 
   //coding starts
  
  
   while (err_buy== 0 ){ //for loop started to execute a buy Order
  
   buy_ticket= OrderSend ( "GBPUSD" , OP_BUY , 1 , Ask , 3 , Ask + 20 * Point , 0 ,Green); //code to execute a buy (buy order placed without SL but with a TP of 20 pips
  err_buy=GetLastError(); //code to check either buy is executed or not?
  
 } //for loop end
   while (err_sell== 0 ){ //for loop to place a sell order
    sell_ticket = OrderSend ( "GBPUSD" , OP_SELL , 1 , Ask , 3 , Ask - 20 * Point , 0 ,Red); //code to place a sell ,order placed without SL but with a TP of 20 pips
   err_sell=GetLastError(); //code to check either sell is placed or not?
   } //for loop ends
   Alert ( "buy/sell executed" );
   
   //__________________________________________________________________________________________________________________________________
   
   while (err_selection_buy== 0 ){ // for loop start to selection of first executed order for further procedure
   buy_selection= OrderSelect (Buy_ticket, SELECT_BY_TICKET ); //order select and stored in intiger
   err_selection_buy=GetLastError(); //code to check eithet order is selected or not
   } //for loop ends
   
   
   
  buy_open_price= OrderOpenPrice (); //taking open price for the first selected order
  buy_ans=buy_open_price;
   
   
   
     while (err_selection_sell== 0 ){ // for loop start to selection of second executed order for further procedure
   sell_selection= OrderSelect (Sell_ticket, SELECT_BY_TICKET ); //order select and stored in intiger
   err_selection_sell=GetLastError(); //code to check eithet order is selected or not
   } //for loop ends
   
   
   
double sell_open_price= OrderOpenPrice (); //taking open price for the second selected order
   
 sell_ans=sell_open_price;
   
   
   
   while ( "buy_trail" == 0 &&   "Sell_trail" == 0 ){ // while loop started to check if thow of them or one is true
      
       while (err_mf_buy== 0 &&  err_mf_sell== 0 ){ //while loop start to take price quote every time for buy and sell
         double mf_buy= MarketInfo ( "GBPUSD" , MODE_POINT ); //code to store markeet info in integer mf_buy
        err_mf_buy=GetLastError(); //code to confirm the previous line of code executed? 
       double mf_sell= MarketInfo ( "GBPUSD" , MODE_POINT ); //code to store markeet info in integer mf_sell
        err_mf_sell=GetLastError(); //code to confirm the previous line of code executed? 
       }
       
       if (mf_buy==slbuy){
        buy= "closed" ;}
       
       else {
       if ( mf_sell==slsell){
     
       sell= "closed" ;}
       else {}
       }
       
       
       if (mf_buy-bp == buy_ans && "Buy" == "open" ){ //if condition to compare if current markeet quote which stored in mf_buy is 20 times greater than the open price of buy Order?
       
       
       while (err_trail_buy== 0 ){ //if above condition true for loop started to start trailing on buy order.
       OrderModify (buy_ticket,buy_open_price,slbuy);
             bp= "(bp+5)" ;
        err_trail_buy=GetLastError(); //code to confirm the previous line of code executed? 
        }
        
         if (bp>= 30 ){
        tp_sell= 0.00005 ;
         while (err_modify_sell== 0 ){ //if buy is in profit for 20 pips and trailing stop started on it i want my sell to modify for take profit for just 5 pips.
       OrderModify (sell_ticket,sell_open_price,slsell,tp_sell);
       err_modify_sell=GetLastError(); //code to confirm the previous line of code executed? 
       buy_trail= 1 ; //intiger use to remember that the buy was in profit and all the cooding associated with it was executed there is no need to check .
       }
       }
       else {
     
       }
       
       
       
       else if ( "mf_sell" + "sp" <= "Sell_ans" && "Sell" == "open" ){ //another logical test to check if buy was not in 20 pips if our sell is in 20 pips profit if so then in the next for loop statrted
       
       
       
       
       while (err_trail_sell== 0 ){ //for loop start to modify sell for trail
         OrderModify (sell_ticket,sell_open_price,slsell);
       sp= "(sp+5)" ;
       
        err_trail_sell=GetLastError(); //code to confirm the previous line of code executed? 
        }
        
         if (sp>= 30 ){
        tp_buy= 0.00005 ;
        
       while (err_modify_buy== 0 ){ //if our sell is in 20 pips profit and trailing executed on it while loop start to modify buy for tp for just 5 pips 
         OrderModify (buy_ticket,buy_open_price,slbuy,tp_buy);
          err_modify_buy=GetLastError(); //code to confirm the previous line of code executed? 
         sell_trail= 1 ; //intiger use to remember that the sell was in profit and all the cooding associated with it was executed there is no need to check .
         }
       }
       else {
       }
       
       }
       
       
   }

 
   
   
  }
   double ab= AccountBalance ();
  
//----
   return ( 0 );
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return ( 0 );
  }
 
mohsin360 :

abt ""를 말하는 경우?

나는 이것들을 제거했고 메타 에디터는 정의되지 않은 오류 변수를 보여주는 사전 정의 변수 abt를 요청합니다.

구매_티켓

판매 티켓

이제 이 이중 쉼표를 수정하고 오류가 두 개뿐입니다.

여기 코드가 있습니다


buy_ticketBuy_ticket 과 동일하지 않습니다.

당신은 여전히 많은 다른 오류가 있습니다. . .

OrderModify() (문서 참조)는 최소 5개의 매개변수를 사용합니다. . .

 OrderModify (buy_ticket, buy_open_price, slbuy);

. . . 세 가지가 아닙니다. 색상은 선택 사항입니다. . .

다른 무엇?

       else {
     
       }