Jump to content

{Reg} Script for Close All Entry Order EA


forex4love

Recommended Posts

Re: {Reg} Script for Close All Entry Order EA

 

HI forex4love,

 

Good day,

 

//+------------------------------------------------------------------+
//| CloseOnTime.mq4 |
//| [url]http://www.kimiv.ru[/url] |
//+------------------------------------------------------------------+
#property copyright ""
#property link "http://www.kimiv.ru"

//---- input parameters
extern int CloseHour=23;
extern int CloseMinute=55;

int start() {
int cnt, ticket, total;
if (Hour() == CloseHour && Minute() >= CloseMinute) {
total=OrdersTotal();
for (cnt=0; cnt < total ;cnt++) {
if (OrderType() == OP_BUY) {
OrderClose(OrderTicket(), OrderLots(), Bid, 3, Yellow);
return(0); // exit
}
if (OrderType() == OP_SELL) {
OrderClose(OrderTicket(), OrderLots(), Ask, 3, Yellow);
return(0); // exit
}
}
}
return(0);
}

 

I guess this script would do.

 

Best wishes,

 

SF

a New Year 2011 has come, and the challenge has just started 8-)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...