Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Error 130/129 bei OrderSend() (http://www.expert-advisor.com/forum/showthread.php?t=4554)

Ensholm 04.11.15 21:47

Error 130/129 bei OrderSend()
 
Dieser EA sollte einen Trade eröffnen, sobald eine Kerze beendet ist. Wenn der Schlusskurs tiefer liegt, sollte der EA einen Sell-Trade und wenn der Schlusskurs höher liegt einen Buy-Trade eröffnen. Ich erhalte aber leider immer einen Error 130 oder 129, wenn dieser einen Trade eröffnen sollte.
Wenn ich nur die OrderSend() Function, ohne den restlichen Code ausführe, dann funktioniert diese und eröffnet Trades.
Was mache ich falsch?

Code:

#property strict

extern double StopLoss      = 100.0;
extern double TakeProfit    = 100.0;
//+------------------------------------------------------------------+
//| --- Variablen fest Festlegen: (Global)                          |
//+------------------------------------------------------------------+

double LastClose1;
double LastClose2;
int Count;
string Dir;

//+------------------------------------------------------------------+
//| Expert initialization function                                  |
//+------------------------------------------------------------------+
int OnInit()
  {

    Count=0;
 
  return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Expert tick function                                            |
//+------------------------------------------------------------------+
void OnTick()
{

  if(Count==0)
      {
      LastClose2 = iClose(NULL,0,2);
      Count=1;
      }
     
  LastClose1 = iClose(NULL,0,1);
 
 
  if(LastClose1 > LastClose2)
      {

      //--- place market order to buy 1 lot
      int ticket=OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),NULL,NULL,0,clrRed);
        if(ticket<0)
        {
            Print("OrderSend failed with error #",GetLastError());
        }
        else
            Print("OrderSend placed successfully");
        //Comment("Zähleranfang: "+Count+"\n Dir: "+Dir+"    \n LastClose2: "+LastClose2+"\n LastClose1: "+LastClose1);
           
      LastClose2 = LastClose1;
      Dir = "Kaufen"; 
      }
 
  if(LastClose1 < LastClose2)
      {
 

      //--- place market order to buy 1 lot
      int ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Bid-(StopLoss*Point),Bid+(TakeProfit*Point),NULL,NULL,0,clrGreen);
        if(ticket<0)
        {
            Print("OrderSend failed with error #",GetLastError());
        }
        else
            Print("OrderSend placed successfully");
         
      LastClose2 = LastClose1;
      Dir = "Verkaufen"; 
      }

}


traderdoc 04.11.15 22:14

int ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Bid-(StopLoss*Point),Bid+(TakeProfit*Point),NULL,NULL, 0,clrGreen);

muß lauten:

int ticket=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,Bid+( StopLoss*Point),Bid-(TakeProfit*Point),NULL,NULL,0,clrGreen);

traderdoc

Ensholm 05.11.15 19:55

Besten Dank für deine Hilfestellung Traderdoc. Da sucht man in alle erdenklichen Richtungen, dafür ist die Lösung so nah.

Deepack 06.11.15 08:52

die einfachste Variante wäre

googlen nach MQL Errorcodes
->Invalid Price und Invalid Stop

Crashbulle 06.11.15 20:23

http://Error Codes für MT4.html


Hier mal ein paar Error-Codes

Crashbulle 09.11.15 21:45

Das scheint eine Uralt-Seite gewesen zu sein.

Hier nun eine Aktuelle Seite

Error Codes - Appendixes - MQL4 Tutorial


Alle Zeitangaben in WEZ +2. Es ist jetzt 06:12 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum