why my OrderSend function failed to work ?

 

Hello ,

When I learn to program as follows :

int start()
{
//----
int handle;
int ticket;

Print (Ask);

ticket = OrderSend (Symbol(),OP_BUY,0.1,Ask,3,Ask-25*Point,Ask+25*Point, "My order #2",16384,0,Green);
if (ticket<0)
{
Print ("OrderSend failed with error #", GetLastError());
return (0);
}


//----
return(0);
}

in the automated trading enviroment , I found that both Print function and OrderSend function failed to work .

So , ... please found my errors in this . Thank you !

 
I'd say start() function failed to work.

Please make sure the EA is enabled and allowed to trade and there is a happy smiley in the right top corner of the chart.
 

Irtron,

First ,thank you for your answer .

And then ,Yes, it does (the EA is enabled and allowed to trade and there is a happy smiley in the right top corner of the chart) .

But I can't find the output of Print ,and the OrderSend function can't work too .

Can you give me some help further ?

 
It's hard to say really.

There might be a few reasons, e.g. no connection (meaning no incoming ticks), fatal failure at initialisation like zero divide, etc.
Also I can remember some weirdness in the EA behaviour in deleted and restored chart.
 

en , now I found it return a error #4109 from OrderSend function .

What does this code mean ?

(I have found in the web , but I can't found the answer )

Thank you ...

Reason: