Download MetaTrader 5

OrderSend / OrderClose use wrong prices!?

To add comments, please log in or register
Deposit to your account via WebMoney
luedman
79
luedman 2014.01.03 15:51 

Hi,

every time I test my code, the results look like this (see picture). The prices used by the OrderSend / OrderClose function are wrong. As you can see the expert does not Open or Close many Orders at the current market price but uses a price far above it.


Testing

Does any of you know how to solve this? Do you think the problem is in my price data (I use the usual data by metatrader) or is in the code? I don't see that there is something wrong with my OrderSend() oder OrderClose()

if (SignalSHORT == true && OrdersTotal() == 0)
      {
      RefreshRates();
      TicketSHORT = OrderSend(Symbol(),OP_SELL,1,Bid,1,0,0,"SELL",16384,0,Red); 
      PositionSHORT = true;
      }

//...

if (CloseSHORT == True && OrderSelect(TicketSHORT,SELECT_BY_TICKET) == true) 
      {
      RefreshRates();
      OrderClose(TicketSHORT,1,Ask,0,Blue);
      
      //RESET
      PositionSHORT = False;
      }

Thanks!

Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2014.01.03 15:59  
luedman:

Hi,

every time I test my code, the results look like this (see picture). The prices used by the OrderSend / OrderClose function are wrong. As you can see the expert does not Open or Close many Orders at the current market price but uses a price far above it.


Does any of you know how to solve this? Do you think the problem is in my price data (I use the usual data by metatrader) or is in the code? I don't see that there is something wrong with my OrderSend() oder OrderClose()

Thanks!

Ask is not shown on your chart, the bars are drawn by Bid price ONLY.
To add comments, please log in or register