Say THX and take the idea created by Vladimir Karputov to get the counts of Bull-Bear bars from 1 to 7 ( except the current bar, and i added some lines to comment the counts of B/S's ) i added lines with labelled "...MNS" to show the counting results within the original source code. such as Comment("Count/Body of B/S for Last 1-7 bars "+ string(cnt_B)+" ("+DoubleToString(bodyB/_Point,0)+") - " +string(cnt_S)+" ("+DoubleToString(bodyS/_Point,0)+")"); // printing counts/Body added by MNS
Say THX and take the idea created by Vladimir Karputov to get the counts of Bull-Bear bars from 1 to 7 ( except the current bar, and i added some lines to comment the counts of B/S's )
//+------------------------------------------------------------------+
//| Bar number.mq5 |
//| Copyright © 2021, Vladimir Karputov |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2021, Vladimir Karputov"
#property link "https://www.mql5.com/en/users/barabashkakvn"
....
cnt_S=cnt_S+1; // count added by MNS
.....
cnt_B=cnt_B+1; // count added by MNS
....
Comment("Count of B/S for Last 1-7 bars "+ string(cnt_B)+" & "+string(cnt_S)+" ." ); // printing counts added by MNS
Files:
Bar_number.mq5
20 kb
@nail sertoglu #: Say THX and take the idea created by Vladimir Karputov to get the counts of Bull-Bear bars from 1 to 7 ( except the current bar, and i added some lines to comment the counts of B/S's )
Please edit your post (don't create a new post) and replace your code properly (with "</>" or Alt-S), or attach the original file directly with the "+ Attach file" button below the text box.
NB! Very important! DO NOT create a new post. EDIT your original post.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi ,,
I appreciate your help for the below function that search in a range to extract the most number of bullish candles and return the first candle in the trend with an exception of maximum 2 bearish candles , in other words , if there were 7 candles in uptrend and there were 2 maximum bearish candles in between it will ignore them and return the start of the bullish trend
below is the code I am trying but getting only1 , it is a robot and there is a button to execute the function