As we have no idea of the values of
total
bar3
ticket
OrderLots() (as we don't see an order selected)
How do we guess?
Check the return of OrderClose
Does ticket refer to a Buy order or a Sell order? It seems that if certain conditions apply you are trying to close at bid, if different conditions, you are trying to close the same type of order at ask
Hi,
Thank you
This is the complete listing: see the highlighted portion, do i need to put the return(0) there, what is the different if there is no return(0) there?
//+------------------------------------------------------------------+
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- As GumRai said, you can not use OrderLots unless you select the order first. Once you select the order, you can use OrderClosePrice instead of Bid/Ask.
- As GumRai said, Check your return codes (OrderClose) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- As GumRai said, where do you test the order type? Why would you close a buy order when the current candle is rising?
Hi,
How shall i place the orderselect?
Hi,
May I know how many ways of select orders and close orders? I know select by symbol.
I don't know what that is.
There is, as far as I know, only one way to select an order and that is with OrderSelect()
I manage to use OrderSelect() to resolve the problem. So now if I use MagicNumber , can I assign MagicNumber=1 to chart 1 and MagicNumber=2 and so on?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My Oredrclose is not working, please help.
if (total>0)
{
if(bar3<-1) OrderClose(ticket,OrderLots(),Bid,3,Green);
if(bar3>1)OrderClose(ticket,OrderLots(),Ask,3,Red);
return (0);
}