Look up the help file for OrderClose(), you cannot close an order with the magic number.
GumRai:
Look up the help file for OrderClose(), you cannot close an order with the magic number.
Look up the help file for OrderClose(), you cannot close an order with the magic number.
Thanks GumRai. I've changed it to the below but still having problems
if (PreviousInd<Lower && CurrentInd>Lower && OrdersTotal () == 0) {
int ticket;
ticket = OrderSend (Symbol (), OP_BUY, LotSize, Ask, 3, Ask - (StopLoss*0.00001), NULL);
};
if (OrdersTotal () == 1 && OrderType ()==OP_BUY && PreviousInd<Upper && CurrentInd>Upper)
{
OrderClose(ticket, LotSize, Bid,10);
};
if (OrdersTotal () == 1 && OrderType ()==OP_BUY && PreviousInd<Upper && CurrentInd>Upper)
You have to select an order before you can access OrderType()
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am new to MQL4 and have been trying to solve the following problem all day. Currently the code below will buy when the indicator raises up above -40 from below. However, I cannot get it to close that same order when it raises above +40. (The same is true of the sell signal in the opposite direction)