A Code block to detect A “New Candle/Bar” using bars history (very effective way) – EA MetaTrader 5

A Code block to detect A "New Candle/Bar" using bars history (very effective way) - expert for MetaTrader 5
In previous code I used the time to detect a new bar. This time let’s use the bars count to detect a new bar. it’s way lighter and faster than using the time method. Declare the variables in integer data type to store the bar counts.  Assign the bars count for the “BarsTotal_OnInt” at the

Simple Code for Detect A “New Bar or New Candle ” Received – EA MetaTrader 5

Simple Code for Detect  A  "New Bar or New Candle " Received - expert for MetaTrader 5
This code block detects a New Bar or a New Candle when it has received.  the basic principle of the codes is very simple. First the code stores the Time of the previous bar / Candle. (Then add 60 seconds (equals to 1 min. you can add time as you want) to the Time of