int currentOrderTicket = --whatever the order ticket is--; int barCount = 0; if(Bars > barCount){ if(OrdersTotal() > 0){ OrderSelect(currentOrderTicket, SELECT_BY_TICKET); if(OrderType() == OP_BUY){ OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue); }else if(OrderType() == OP_SELL){ OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red); } } barCount = Bars; }
jmca:
Thank you, I will give it a try
cheers
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
HI,
can some one please tell me how to get my EA to close my open position when the hourly bar closes...
I want the open position to close when the hourly bar closes no matter how long it has been open.
i have tried many things ...
eg.
if(Volume[0]==1)
{
OrderClose(......)
return(0);
}
and I tried many other ways but none work...can anyone please help me to get this to work.
Thanks