Why does this OrderSend not work?
BuyTicket=OrderSend(Symbol(), OP_BUYSTOP, Lots, MaxBuyPrice, 3, MaxBuyPrice - StopLoss, MaxBuyPrice + TakeProfit, "Grid", 0, 0, Blue);
Lots, MaxBuyPrice, StopLoss and TakeProfit all have the "double" data type. I used the Comment command before OrderSend() to display the contents of MaxBuyPrice, StopLoss and TakeProfit and they are what they should be. The value of BuyTicket after the OrderSend command is -1 so why did the OrderSend fail? I replaced all the variables with values so the command became:
BuyTicket=OrderSend(Symbol(), OP_BUYSTOP, 0.1, 1.2971, 3, 1.2971, 1.2979, "Grid", 0, 0, Blue);
BuyTicket is still -1. The buy price in the command was above Ask so a buy stop would be a valid order. Stop loss price is the same as buy price. There is no magic number or expiration so I set them to 0. What am I doing wrong?
Thanks.
BuyTicket=OrderSend(Symbol(), OP_BUYSTOP, Lots, MaxBuyPrice, 3, MaxBuyPrice - StopLoss, MaxBuyPrice + TakeProfit, "Grid", 0, 0, Blue);
Lots, MaxBuyPrice, StopLoss and TakeProfit all have the "double" data type. I used the Comment command before OrderSend() to display the contents of MaxBuyPrice, StopLoss and TakeProfit and they are what they should be. The value of BuyTicket after the OrderSend command is -1 so why did the OrderSend fail? I replaced all the variables with values so the command became:
BuyTicket=OrderSend(Symbol(), OP_BUYSTOP, 0.1, 1.2971, 3, 1.2971, 1.2979, "Grid", 0, 0, Blue);
BuyTicket is still -1. The buy price in the command was above Ask so a buy stop would be a valid order. Stop loss price is the same as buy price. There is no magic number or expiration so I set them to 0. What am I doing wrong?
Thanks.