helfen Sie mir mit dem Code - Seite 3

 
mohsin360:

und beheben Sie bitte die Fehler oder geben Sie mir einige Hinweise


"mohsin360", der Compiler sagt Ihnen, was falsch ist. Warum lesen Sie nicht den Fehlerbericht und gehen dem nach.

Wenn es heißt, dass Sie eine Variable haben, die nicht definiert wurde, dann definieren Sie die Variable so, dass sie den Fehler nicht verursacht.

Wenn es heißt, dass Sie eine unausgewogene Klammer ")" haben, bedeutet das, dass Sie überprüfen müssen, ob Sie die richtige Anzahl von linken und rechten Klammern gesetzt haben und dass wahrscheinlich eine oder mehrere fehlen.

Dies sind einfache Fehler für jemanden, der bereits ein wenig programmieren kann.

Wenn Sie keine Ahnung vom Programmieren haben, sollten Sie vielleicht erst einmal etwas Zeit darauf verwenden, die Grundlagen des Programmierens zu erlernen, einen Compiler zu benutzen und die Syntaxfehler im Code im Allgemeinen zu korrigieren, bevor Sie versuchen, einen EA oder Indikator zu schreiben.

Ein guter Startpunkt ist das "MQL4 Buch", gleich hier auf dieser Seite!

Alternativ vielleicht ein Anfängerbuch über "C-Programmierung" oder vielleicht einige Online-Tutorials über "C" für Anfänger. Das wird Ihnen den Start, um die Grundlagen zu verstehen und dann können Sie mit MQL4 fortfahren.

 

Ja, ich lese Fehlerbericht und es enthält erste und zweite Fehler acht in Zahlen b coz von meinem Trailing-Start-Code und ich komme zu wissen, dass alpari oder mt4 nicht zulassen, dass ein Minimum Trailing von 30 Pips, so dass ich beschlossen, Code ein wenig zu ändern und mit geraden, um modifizierende Code anstelle von Trailing-Start-Code .thanks u alle für die Zusammenarbeit mit mir so viel. dont so entspannen ill wieder fragen, wenn ich Hilfe brauche, nachdem sie und Kompilieren der neuen Änderungen

Mit freundlichen Grüßen

Mohsin.meo

 
Nochmals vielen Dank WHRoeder
 

meine Meta-Editor zeigt einige Fehler erste ist (145,51), wenn ich in der Fehlerliste suchen ich fein keine 145 sagen, dass:[Änderung verweigert, weil um zu nah an den Markt.] und das stimmt, weil ich in dieser Zeile den Code eingegeben habe, um die Order um 5 Pips zu ändern, aber wenn ich nach anderen Fehlern wie (153,62),(158,8),(164,8),(170,55),(180,60) und (185,8) suche, kann ich keine Fehlernummer in der Liste finden, hier ist die Liste, in der ich eine Bedeutung gefunden habe und andere nicht.Bitte kann mir jemand sagen, was die Bedeutung der Fehler ist und wo ich die Bedeutungen finden kann, denn ich habe nach "unerwarteten Token" gesucht und festgestellt, dass ich nur komme, wenn es ein Problem mit der Codesyntax gibt, aber wie Sie sehen können, habe ich zwei Fehler an der Spitze, die besagen, dass die Anzahl der Parameter falsch ist @(145,51) und (153,62) und nur 145 ist im Index aufgeführt, aber 153,62 ist nicht 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);
  }
Hier ist der Code
 
mohsin360:

meine Meta-Editor zeigt einige Fehler erste ist (145,51), wenn ich in der Fehlerliste suchen ich fein keine 145 sagen, dass:[Änderung verweigert, weil um zu nah an den Markt.] und das stimmt, weil ich in dieser Zeile den Code eingegeben habe, um die Order um 5 Pips zu ändern, aber wenn ich nach anderen Fehlern wie (153,62),(158,8),(164,8),(170,55),(180,60) und (185,8) suche, kann ich keine Fehlernummer in der Liste finden, hier ist die Liste, in der ich eine Bedeutung gefunden habe und andere nicht.Bitte kann mir jemand sagen, was die Bedeutung der Fehler ist und wo ich die Bedeutung finden kann, denn ich habe nach "unerwarteten Token" gesucht und festgestellt, dass ich nur komme, wenn es ein Problem mit der Codesyntax gibt, aber wie Sie sehen können, habe ich zwei Fehler oben, die besagen, dass die Anzahl der Parameter falsch ist @(145,51) und (153,62), und nur 145 ist im Index aufgeführt, aber 153,62 ist nicht Y

145 ist die Zeilennummer, nicht die Fehlernummer. 51 ist die Nummer der Zeichenspalte. Dies sind Kodierungsfehler, keine Ausführungsfehler ... korrigieren Sie Ihre geschweiften Klammern.

Das ist falsch ...

buy_selection = OrderSelect(  "Buy_ticket",   SELECT_BY_TICKET);

OrderSelect() der erste Parameter muss ein int sein, nicht ein String, lesen Sie die Dokumentation.

Das Gleiche hier . . .

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


Das sind Schnüre und funktionieren nicht...

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

genauso hier . . .

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

Ich habe bereits Buy_ticket als intiger deklariert, der den Wert des Tickets enthält, das ich vom Server bei orderselect Buy erhalten habe, und dasselbe für sell.

Wenn Sie sagen, dass der erste Parameter der orderselect muss in Zahlen dann, wie ich die Nr. offensichtlich ich zuerst gespeichert es in einem intiger und rufen Sie dann, dass intiger und thts was im tun.

?

 
mohsin360:

Ich habe bereits Buy_ticket als intiger deklariert, der den Wert des Tickets enthält, das ich vom Server bei orderselect Buy erhalten habe, und dasselbe für sell.

Wenn Sie sagen, dass der erste Parameter der orderselect muss in Zahlen dann, wie ich die Nr. offensichtlich ich zuerst gespeichert es in einem intiger und rufen Sie dann, dass intiger und thts was im tun.

?

Dies ist ein Integer...

int Buy_ticket;

Buy_ticket = 10;

dies ist ein String

"Buy_ticket"
 

wenn du von "" erzählst?

Ich habe diese entfernt und der Metaeditor fragt nach vordefinierten Variablen und zeigt den Fehler Variable nicht definiert an

kaufen_ticket

verkauf_ticket

jetzt habe ich diese doppelten Kommas entfernt und habe nur noch zwei Fehler

Hier ist der Code

//+------------------------------------------------------------------+
//|                                                 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:

wenn du von "" erzählst?

Ich habe diese entfernt und der Metaeditor fragt nach vordefinierten Variablen und zeigt den Fehler Variable nicht definiert an

kaufen_ticket

verkauf_ticket

jetzt habe ich diese doppelten Kommas entfernt und habe nur noch zwei Fehler

Hier ist der Code


buy_ticket ist nicht dasselbe wie Buy_ticket

Sie haben noch viele andere Fehler...

OrderModify() (bitte lesen Sie die Dokumentation) benötigt mindestens 5 Parameter ...

OrderModify(buy_ticket, buy_open_price, slbuy);

. . nicht drei. Farbe ist optional .

was sonst?

       else{
     
       }
       
Grund der Beschwerde: