Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Closing positions by time - MetaTrader 4 Expert | MT4 EA Download - MetaTrader 4 Resources

author EAcpu | 2 reads | 0 comments |

Close At Time is an EA trading program for the MetaTrader 4 trading platform, which can close positions or delete pending orders or both. You can also specify how to close it - via symbol, magic number or ticket number. The last one is when Expert Advisor closes the selected order. The time refers to the computer's local time. The Expert Advisor also integrates error descriptions for cases when problems occur when closing a single order.

EA is built on the idea that "it must be done". This means that if there is an error when closing or closing a position, the EA will try again on the next price move. When this idea is applied, it also has a small problem. Other trades opened after the selected time and meeting the selected conditions will be closed (the EA will not be stopped). But it does not violate the basic idea.

Input parameters:

Close settings:

 external boolean b close all = false ; // close all
External boolean bSymClose = false ; //Close position by symbol
External boolean bMN close = false ; //Close position by magic number
external boolean bTN close = false ; // close by ticket number
External boolean PO = false ; //Close pending order
external boolean mo = false ; // close market order
External string closing time = "YYYY.MM.DD HH:MI" ; //Local time closing time

Close parameters:

 outer string symbol close = ”” ; // close symbol
external integer MN off = 0 ; // magic number off
External integer TN closed = 0 ; //Ticket number to be closed

Attachment download

📎Closing time.mq4 (14.69 KB)

Source: MQL5 #14303

Verification code Refresh