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

Candle Size (Text) - MetaTrader 5 Script | Forex Indicators Download - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

Size of candles (text) - indicator for MetaTrader 5

Size of candles (text) - indicator for MetaTrader 5

This indicator reflects the size of the bars. The size is calculated by the following formula: "minuend" minus "deduction". The Minuand and Deduction can be any of four values ​​(Opening, High, Low or Closing).

The number of bars for the displayed size can be limited in the input parameter ( Inp Number of Bars ). The number remains the same even if a new bar is opened:

Graphical object accounting

The names of the objects are stored in the m_arr_names[] array, the size of which is equal to the Inp bar number input. Why do we use arrays instead of simple string variables? This is a reserve for the future.

form object name

The object name corresponding to the "Index" column is composed of the following formula:

 name[index] = m_prefix + ( "high_" or "low_" ) + string time (time[index])

When all objects need to be deleted

Indicators are unloaded in the following cases :

Therefore, we completely delete the created graphics object:

We also clear m_arr_names[] in bulk:

Maintain a constant number of graphics objects:

When a new bar appears, the prev_calculated!=rates_total condition will be triggered. In this case, all objects are deleted and the m_arr_names[] array is cleared.


Attachment download

📎 size_of_candles_itextf.mq5 (10.77 KB)

Source: MQL5 #18269

Verification code Refresh