Order execution problem with IBFX - page 2

 
blogzr3:
I'm talking about having a double in there when an int is required, is very unlikely to work under any circumstances.
Nope, works just fine . . . I expect it gets typecast to 0
 

Just tell us the error description and we'll try to help you ...

if (/*OrdersTotal()== 0 &&*/ ask <= openprice)
{
 int success = OrderSend(pair,OP_BUY,LOT1, Ask, 0 ,0,0,"HI",0,0,Green);
 if (success > 0)
   {
   Print ("Order was sent. Now we\'re going to add SL and TP");
   OrderSelect (success, SELECT_BY_TICKET, MODE_TRADES);
   bool modif = OrderModify (success, OrderOpenPrice(), SL, TP, 0);
   if (modif == false)
      {
      Print ("Fail to add TP and SL to ticket no "+success+" with error no "+GetLastError());
      // must execute OrderModify() again 
      }
      else
      {
      Print ("Success adding TP and SL");
      }
   }
   else
   {
   Print ("Order was not sent and there is error "+GetLastError());
   // should I re send the order ???
   }
}

BTW, What IBFX AU account type you use. The mini account has prefix "m" in front of symbol.

 
RaptorUK:
Nope, works just fine . . . I expect it gets typecast to 0
That's when the "point" derived from somewhere has the value of zero to begin with, but interesting point so to speak.
 
blogzr3:

No need to ask other people, just ask your code to tell you like so:

The "else" is when your OrderSend works, which means you need to adjust the TP and SL - unless you intentionally don't want to.


Thank you. However, I have already the modify function in place once the trade opens. I just did not show it here.
 
blogzr3:
That's when the "point" derived from somewhere has the value of zero to begin with, but interesting point so to speak.

Nope, I wrote a script with this . . .

OrderSend(Symbol(),OP_BUY,0.1,Ask,30*Point,0,0,"HI",0,0,Green);

. . . 30*Point is a double

 
zaffrono:

Thank you. However, I have already the modify function in place once the trade opens. I just did not show it here.
So what is the error when the OrderSend() fails ?
 
blogzr3:
What do you mean? Note it's point, not Point, which may or may not be the same thing.

That's right: the code for point is


point =MarketInfo(pair1,MODE_POINT)

 
RaptorUK:

Nope, I wrote a script with this . . .

. . . 30*Point is a double

What I meant was - if someone was dealing with "point", the value is likely to be 0.0001 or something, rather than 1,2 etc, rather than the issue of type double or type int. You can write scripts which compiles ok, but do we know the result when we run it?
 
Yeah, more to the point - what is the failure code?
 
zaffrono:

That's right: the code for point is


point =MarketInfo(pair1,MODE_POINT)

So your code is wrong . . . 30 * point is not an int . . . you either mean 3 or 30
Reason: