OrderSend() Problem, it is crazy .. :( - page 2

 

Please use this to post code . . . it makes it easier to read.


You need to show the code that produces the -1 return value . .

 
void NewLongMagic()
{
  int NewLongMagicSent = 0;
  while (NewLongMagicSent == 0) {
     NewLongMagicSent = OrderSend(Symbol(), OP_BUY, mLot,Ask,mSlipage,0,0, "Magic Long",Magic,0,Blue);
     if (NewLongMagicSent == 0) 
              {
                 Fehler();
              }
              else {
              Print("Ticketnumber = " + NewLongMagicSent);
              }
  }
}
hier is the function.
 

you need to add to that to get the error code.

{
                 Fehler();
              }
              else {
              Print("Ticketnumber = " + NewLongMagicSent);
              Alert("OrderSend Error = ", GetLastError());
              
              }
  }

you probably also should change this line

if (NewLongMagicSent == 0)

to

if (NewLongMagicSent >= 0)

remember if everything works correctly so your order is opened, you are expecting OrderSend() to return a ticket number it is not likely to be a ticket number of zero

 

actually before you do that let me ask you, which did you want to do if the OrderSend() is successful ?

The Fehler() function or Print ticket number ?

I was assuming your Fehler() function was to proceed after a successful OrderSend() but now after thinking about it, my limited German has me suspecting Fehler translates to fail ?

either way you should change your code to reflect the following:

if the OrderSend() is successful NewLongMagicSent will be assigned the value of the ticket number which will be >0

if OrderSend() fails NewLongMagic will be recieve the value of -1

 

Hey people,


I have to thank you very much. Nearly all works now. It seems, that it was a wrong call of the ordersend, but sometimes it opened and opened buys over and over, but sometimes not.. i get wired ^^


Fehler means mistake or fail or in this case error, right ;) But this problem too, has been solved. :)


Thank you all so much :)

Reason: