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

Indicator's "New Bar" event handler - MetaTrader 5 Script | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

The idea for this approach is in the " New Bar" event handler article. This article presents examples of its use in Expert Advisor trading. Here you can find solutions for indicators. The idea is the same: recalculation is allowed to be performed only when a new bar appears. This is a convenient alternative to using the OnCalculate() function directly.

This is a simple indicator that prints a line when a new bar appears:


Attachment download

📎 libcisnewbar.mqh (6.3 KB)

📎 onnewbarcalculate.mqh (1.66 KB)

📎 onnewbarcalculate.mq5 (1.69 KB)

Source: MQL5 #199

Indicator's "New Bar" event handler - MetaTrader 5 script | Forex indicator download - MT4/MT5 resource usage and screening recommendations

Indicator's "New Bar" event handler - MetaTrader 5 script | Forex indicator download - MT4/MT5 resources are resources related to Forex indicators. Before downloading or referencing, it is recommended to confirm the platform version, transaction type, time period, whether DLL is required, whether source code is included, parameter description and historical update records.

Both automated trading tools and foreign exchange indicators should first undergo backtesting, simulated account observation, and small capital verification. Pay special attention to spreads, slippages, maximum drawdowns, position opening frequency, stop loss methods, trading periods and broker rules, and avoid direct real-time execution based only on titles or short-term profit descriptions.

Verification code Refresh