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

Utility to view statistics of a single bar on any time frame - MetaTrader 5 Script - MT4/MT5 Resource

author EAcpu | 5 reads | 0 comments |

Utility to view the statistics for a Single Bar of any time frame - indicator for MetaTrader 5

Utility to view the statistics for a Single Bar of any time frame - indicator for MetaTrader 5

The utility will display high, low, open, close and time statistics for any user-selected bar for any time frame of the chart symbol on which the utility resides. The indicator publishes an event (EventChartCustom) to handle its data collection and display activities, keeping the processing time of these activities outside the indicator's quote (OnCalculate) processing time.

Utility to view the statistics for a Single Bar of any time frame - indicator for MetaTrader 5

User input value:

Input int unique identifier = 3; // Display offset and unique instance number

This value makes the object name unique within this metric instance; if you use multiple instances, change this numeric metric. Additionally, this number changes the display offset of the indicator.

Input ENUM_ON_OFF DirectClick = ON; // Select bars by mouse click

You can select which bars to display by clicking on the chart. This turns the feature on or off. This feature may interfere with clicking other controls.

Display controls:

Bar up: Click this text to increase the column in which the information is displayed by 1.

Bar_Dn: Click this text to decrease the bar displaying the information by one.

'The Box': This is a text input box where you can directly enter the column number for displaying information.

period: Click this text to increase the time range displayed by the bar chart.

"_H4" {time range}: Click this text to reduce the time the bar chart is displayed.

"Rate" {data acquisition method}: Click this text to increment through various data collection methods.

There are 3 different ways to implement statistics of individual bars in the indicator:

Copy function: CopyClose, CopyHigh, CopyLow and CopyTime.

Direct: iClose, iHigh, iLow, iOpen and iTime.

price: CopyRates (to MqlRates structure)

Here are the controls and features in the indicator, purely for those who want to know how to obtain information in different ways.

The indicator also highlights the bar for which statistics are being displayed - this shows the highlighting of the H4 bar on the M30 chart:

Utility to view the statistics for a Single Bar of any time frame - indicator for MetaTrader 5

When the bar chart's time range is smaller than the chart's time range (or the same as the chart's), this highlight can be difficult to discern.


Attachment download

📎 singlebarvalues.mq5 (58.64 KB)

Source: MQL5 #26195

Verification code Refresh