Order execution problem with IBFX

 
I am testing my Slave EA on IBFX Australia ( US Currency ) and have the following problem:

For Buy Trade I am using the following command:



if (OrdersTotal()==0&&ask<=openprice)
{
ticket=OrderSend(pair,OP_BUY,LOT1,newask,30*point,0,0,"HI",0,0,Green);
}
Please note that the value of the open price is determined by the Master EA. Therefor, whenever the ask price is less or equal to open price, my Slave EA must execute a buy trade. However, IBFX sometimes execute and opens a buy trade and sometime not.

I have tested the EA on other brokers and it has worked smoothly.

Could someone tell me what would be the best solution for IBFX.

TIA
 

Try this perhaps ?. The comment should be string and the newask should be Ask

ticket=OrderSend(pair,OP_BUY,LOT1, Ask, 30*point,0,0,"0",0,0,Green);
 
zaffrono:
I am testing my Slave EA on IBFX Australia ( US Currency ) and have the following problem:

For Buy Trade I am using the following command:



Please note that the value of the open price is determined by the Master EA. Therefor, whenever the ask price is less or equal to open price, my Slave EA must execute a buy trade. However, IBFX sometimes execute and opens a buy trade and sometime not.

I have tested the EA on other brokers and it has worked smoothly.

Could someone tell me what would be the best solution for IBFX.

TIA


Test the return value from the OrderSend, if it's -1 report the error . . . then you will have an idea of why it failed. I suspect that the issue is that you are trying to buy at a price other than Ask . . . and you can't do that with a market order.
 
onewithzachy:

Try this perhaps ?. The comment should be string and the newask should be Ask


Thank you for your prompt respond. I have already tried it and no use.
 

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

ticket=OrderSend(pair,OP_BUY,LOT1,newask,30*point,0,0,0,0,0,Green);
if (ticket<=0) 
   Print("+OrderSendErr=",GetLastError()," tic=",ticket);
else
   myOrderModify(ticket,OrderOpenPrice(),sl,tp,0,oColour);

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

 
zaffrono:

Thank you for your prompt respond. I have already tried it and no use.
You can't set Slippage at 30*point if you want 30 points use 30 check the documentation, OrderSend() . . . Slippage is an int that should give you a clue.
 
RaptorUK:
You can't set Slippage at 30*point if you want 30 points use 30 check the documentation, OrderSend() . . . Slippage is an int that should give you a clue.
What do you mean? Note it's point, not Point, which may or may not be the same thing.
 
blogzr3:
What do you mean? Note it's point, not Point.
OK, we can't see what point is . . . but I suspect it is a double and is related to pip . . . but my suspicion might be wrong.
 
RaptorUK:
OK, we can't see what point is . . . but I suspect it is a double and is related to pip . . . but my suspicion might be wrong.
The "sometime works, and sometimes don't" would tend to rule that out.
 
blogzr3:
The "sometime works, and sometimes don't" would tend to rule that out.
Why ? will setting slippage at 30 Points cause OrderSend to fail sometimes but not always ? won't it just be typecast to 0 ?
 
I'm talking about having a double in there when an int is required, is very unlikely to work under any circumstances.
Reason: