Here is the code:
Everytime the code is executed, ticket value is -1, meaning there has been a problem but GetLastError() returns 0, meaning everything is OK.
The order is not passed.
This happens on backtesting, and probably real trading too.
write_time() is my own function to log data into a file.
Any clue?
Inserted Code
ticket=OrderSend(Symbol(), OP_BUY, max_slippage, Ask, max_slippage, Ask-take_profit*Point, Ask+lot_size*Point, "Long Order", 31337, 0, Green); write_time("OrderSend BUY"); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); write_time("OrderSend failed with error #"+GetLastError()); return(0); }
The order is not passed.
This happens on backtesting, and probably real trading too.
write_time() is my own function to log data into a file.
Any clue?
I used to be schizophrenic, but now we are sane.