Exp_GTakeProfit_Tm - MetaTrader 5 Expert - MT4/MT5 Resources
Expert Advisor for closing all positions, in case the total profit of these positions exceeds the take-profit level fixed in the input, or the position needs to be closed beyond the time interval fixed in the settings. In a way, this EA also acts as a global take-profit function for all open positions.
//+------------------------------------------------------------------------+ //| Options for calculating profit| //+------------------------------------------------------------------------+ enum takes pattern { ENUM_PERCENT, //Profit as a percentage of deposit ENUM_CARRENCY //Profit calculated in deposit currency unit }; //+---------------------------------------------------------+ //|Input parameters of EA indicator| //+------------------------------------------------------------------------+ Enter TakeMode LMode=ENUM_PERCENT; //Method to detect profits Enter double take profit = 100.0 ; //Take profit level Input boolean value TimeTrading= True ; //Allow trading within the specified range
The EA offers the option to close positions only after exceeding the time interval defined in its input variables:
input boolean timetrading= true ; //Allow trading by time interval Enter hour start H=ENUM_HOUR_0; //Transaction start (hour) Enter the minute StartM=ENUM_MINUT_0; //Transaction starts (minutes) Enter the end of hour H=ENUM_HOUR_23; //End of transaction (hour) Enter minutes EndM=ENUM_MINUT_59; //End of transaction (minutes)
Provide two variables (hours and minutes) for the operation start time and two similar variables for the end time.
The default settings enable the Expert Advisor to trade for the entire trading session starting from 0:00, while all positions are closed at 23:59.
If the start time is later than the specified end time, the Expert Advisor will close the position at the specified time the next day.
Attachment download
📎 exp_gtakeprofit_tm.mq5 (32.45 KB)
Source: MQL5 #21342
Exp_GTakeProfit_Tm - MetaTrader 5 Expert Pre-Using Tips
This page has been supplemented with structured instructions, focusing on the purpose of EA source code, MQL4/MQL5 platform compatibility, testing process and risk control. Before downloading or deploying, it is recommended to first determine whether it is consistent with your own variety, cycle and account environment.
Suitable for who to use
- Users who want to quickly screen EA source code and are willing to do simulation disk verification first.
- People who need to compare MT4/MT5 EAs, indicators, scripts or source code projects.
- Traders who wish to record backtests, parameters and risk boundaries before placing a trade.
Testing and risk control suggestions
- First verify the default parameters in the strategy tester or demo account, and then adjust the symbol, period, spread and trading period one by one.
- Scalping, grid, martin, and high-frequency strategies should focus on observing maximum drawdowns, consecutive losses, slippage, and trading frequency.
- It is not recommended to run any document directly on the real disk. At least observe the simulated disk performance for 2-4 weeks first.
FAQ
Can MT4 and MT5 be used interchangeably?
Usually cannot be used directly. EX4/MQ4 corresponds to MT4, EX5/MQ5 corresponds to MT5, and the source code needs to be compiled in the corresponding MetaEditor.
Is this resource guaranteed to be profitable?
cannot. EAs, indicators and scripts can only be used as trading tools, and the results depend on parameters, market environment, spreads, slippage and risk control.
What else can I continue to watch?
Forex EA download , foreign exchange indicator download , EA evaluation , MQL5 CodeBase .
English Search Notes
This page is also optimized for English search intent around Exp_GTakeProfit_Tm - MetaTrader 5 Expert . Related search terms include: MQL4 source code, MQL5 source code. Test any Forex EA, Expert Advisor, MT4/MT5 indicator, script or MQL source code with historical data and a demo account before live trading.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •