Thread: Super Ea
View Single Post
  #71 (permalink)  
Old 12-15-2006, 09:28 PM
AQUILEZ's Avatar
AQUILEZ AQUILEZ is offline
Sophomore
 
Join Date: Jul 2006
Posts: 91
Thanks: 2
Thanked 20 Times in 9 Posts
AQUILEZ will become famous soon enough
Default

Here is another one
It will close all running positions.

#include <stdlib.mqh>
#include <WinUser32.mqh>
int start()
{
double sA;
int cnt, totalOrders;
totalOrders = OrdersTotal();

if (totalOrders>0)
{
for (cnt=0;cnt<totalOrders;cnt++)
{
OrderSelect(0, SELECT_BY_POS);
if (OrderType() == OP_BUY) sA = MarketInfo(OrderSymbol(),MODE_BID);
else sA = MarketInfo(OrderSymbol(),MODE_ASK);
OrderClose(OrderTicket(),OrderLots(),sA,3,CLR_NONE );
}
}
return(0);
}
Reply With Quote

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now