For sure it is not that simple, but I open (market or pending) position(s) 1min after market open and close 2-3min before market close.
For example I opened buy for EURJPY today at 129.671. I will close today 2-3min before market close if the trade is profitable, if not than it will be carried for tomorrow.
The EA starts working when the Equity of the trading account reaches the value " Get started with Equity> =
". After that, the EA constantly remembers the maximum value of Equity (remembers in the variable
m_prev_max_equity and at the same time in the global terminal variable " TEM ").
As soon as Equity decreases by " Close all with a decrease of " from the maximum value, this is a signal to close all
positions on the trading account. After closing all positions, the EA pauses: removes the global variable of the terminal and no longer
tracks Equity.
Every discretionary trader asks the same question about an open position: is this the best exit I'm going to get, or should I give it more room? Most automated systems answer with a fixed stop-loss/take-profit pair decided at entry, sometimes with a trailing rule bolted on - a reasonable default, but one that throws away information, since the market keeps talking after entry and a fixed level can't listen to any of it.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Forum on trading, automated trading systems and testing trading strategies
Which strategy is best to close the position?
Sergey Golubev, 2018.03.27 06:56
Time.
For sure it is not that simple, but I open (market or pending) position(s) 1min after market open and close 2-3min before market close.
For example I opened buy for EURJPY today at 129.671. I will close today 2-3min before market close if the trade is profitable, if not than it will be carried for tomorrow.
Time is the magic word.
I've found another exit.
Average out.
Yeah. Time exit is also very good.
Trailing Equity Money - expert for MetaTrader 5
The EA starts working when the Equity of the trading account reaches the value " Get started with Equity> = ". After that, the EA constantly remembers the maximum value of Equity (remembers in the variable m_prev_max_equity and at the same time in the global terminal variable " TEM ").
As soon as Equity decreases by " Close all with a decrease of " from the maximum value, this is a signal to close all positions on the trading account. After closing all positions, the EA pauses: removes the global variable of the terminal and no longer tracks Equity.
Forum on trading, automated trading systems and testing trading strategies
Which strategy is best to close the position?
Sergey Golubev, 2026.10.27 12:07
Optimal Trade Exit in MQL5: Longstaff-Schwartz Least-Squares Monte Carlo for Continuation-Value Estimation
Automatic translation was applied by a moderator. Please post in the language of the forum section you selected.
Each trader uses their own strategy that is convenient for them, so there are thousands of options and answers.