Code blocks for “Counters” like Count “X” time and pass – EA MetaTrader 5

Code blocks for "Counters" like Count "X" time and pass - expert for MetaTrader 5
01. Count “X” Times and then pass. Step 01 – Created a variable for set the count limit. you can use it as an input parameter as well of optimization in your code.  Step 02 – Create another variable to store the counted limit (How many times it has been counted). Step 03 – Once

Count of candles in interval (histogram) – indicator MetaTrader 5

Count of candles in interval (histogram)
The indicator calculates bullish and bearish bars in the period from The number of the starting bar (the first bar on the right of the chart) till The number of the end bar (located on the left). The indicator with ‘starting bar’ (0) and ‘end bar’ (5): Possible application: three timeframes with the same settings:

Bounce Number for Grid/Martingale strategies Lot Sizing/Order Count set – EA MetaTrader 4

Image No. 1
Lot sizing and/or Number of trades for strategies like Grid and Martingale are very important. We always ask about what happened in history of a symbol during range zones and How Many Times price bounced between two price of a Range Zone?! This is what I define as Bounce Number. It can be calculated by