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

Candle Statistics - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 2 reads | 0 comments |

Statistics of candles - script for MetaTrader 5

Statistics of candles - script for MetaTrader 5

Statistics of candles - script for MetaTrader 5

Calculate the number of bullish and bearish bar series. Display the results as a graph. Save a screenshot of the results chart. This script uses the Graphics class.

Bar series are coded according to the following principles:

 Enumeration ENUM_SERIES_TYPE
    {
      Bull = 1 , // ↑ Bear =- 1 , // ↓ };

A "bullish" candlestick has the code "1" and a "bearish" candlestick has the code "-1".

Another parameter of the series name is calculated as follows:

Current series (ENUM_SERIES_TYPE) * number of consecutive bars in the series

NOTE: The last series is not included in the calculation because you have no way of knowing how long the series will last.

The screenshot is saved (if saving screenshots is enabled) to [Data Folder]\MQL5\Files\Candle Statistics\. An example of a saved screenshot of the generated chart. The series is plotted along the X-axis, i.e. the "-5" series represents five consecutive bearish bars, and the "2" represents two consecutive bullish bars:

Statistics of candles - script for MetaTrader 5

Figure 1. AUDCAD, H1. 1200 items

Statistics of candles - script for MetaTrader 5

Figure 2. EURUSD, H1. 1200 items

Statistics of candles - script for MetaTrader 5

Figure 3.RTS-12.17, M5. 1200 items


Attachment download

📎 statistics_of_candles.mq5 (11.33 KB)

Source: MQL5 #19304

Verification code Refresh