A 3-line script that tells you how many bars there are on the chart - MetaTrader 5 Script - MT4/MT5 Resources
The code below seems simple and straightforward.
But it's also very useful, especially if you want to know how many bars there are on the chart.
Of course, this is always equal to or smaller than any constraints you specify via Tools/Options/Charts and Max Bars in Charts, and depends on the data downloaded from the broker or the data you upload using a custom symbol.
I'm using the built-in bar to work in this example. All you have to do is drag the script onto the chart and view the toolbox in the Expert tab.
You can also look at the upper left corner of the chart window because I added a comment line
Attachment download
📎 rates_total.mq5 (0.98 KB)
Source: MQL5 #55976
A 3-line script that tells you how many bars there are on the chart - MetaTrader 5 script usage and filtering recommendations
A 3-line script that tells you how many bars there are on the chart - MetaTrader 5 Script is a resource related to trading scripts. 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 on titles or short-term profit descriptions.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •