BULLISH/BEARISH Bar counter code - page 2

 
GumRai:


As

is within the Start() function, won't it reset every tick?


Theoretically i dont know but practically the code works very well.
 
GumRai:


As

static datetime Bar1Time =0;

is within the Start() function, won't it reset every tick?

No. Bar1Time is declared as a static variable. See documentation for Static Variables.

 
Thirteen:

No. Bar1Time is declared as a static variable. See documentation for Static Variables.


Thanks Thirteen, I find that explanation a bit confusing.

I understand now, so a little bit more added to the knowledge bank.

 
Proximus, I was wondering if you could post this indicator, this is something that I was searching for as well but I don't code. Many thanks!
 
Proximus: .It would count how many consecutive BEARISH bars appear before a BULLISH bar disrupts the sequence, and how many consecutive BULLISH bars appear before a BEARISH bar disrupts the sequence;
Then why don't you do exactly that instead of trying to remember the count as bars form.
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){
   int upmax=0;
   int downmax=0;
   if( Close[1] > Open[1]){
      for(int iBar=1; iBar < Bars; iBar++) if( Close[iBar] >  Open[iBar]) upmax++; else break;
      for(          ; iBar < Bars; iBar++) if( Close[iBar] <= Open[iBar]) dnmax++; else break;
   }
   else{
      for(    iBar=1; iBar < Bars; iBar++) if( Close[iBar] <= Open[iBar]) dnmax++; else break;
      for(          ; iBar < Bars; iBar++) if( Close[iBar] >  Open[iBar]) upmax++; else break;
   }
   :
 
Please I need a candle stick counter indicator with functions as followed once the bar closes 

Example: there are 24 hours bar that made up the daily candle.  So at the end of the day,  it will show small stuff like 

Green = 20
Red = 4

If possible for doji not to be counted it is welcome 

This is how similar stuff to be on other time frame.  
Is tthis possible please?  

Same for 15m, 30m, 1h, 4h, weekly & monthly time frame 
 
Jaylist:
Please I need a candle stick counter indicator with functions as followed once the bar closes 

Example: there are 24 hours bar that made up the daily candle.  So at the end of the day,  it will show small stuff like 

Green = 20
Red = 4

If possible for doji not to be counted it is welcome 

This is how similar stuff to be on other time frame.  
Is tthis possible please?  

Same for 15m, 30m, 1h, 4h, weekly & monthly time frame 


Please do not hijack old threads.

Forum on trading, automated trading systems and testing trading strategies

Welcome,

  • Usually people who cannot code do not receive free help on this forum, although it could happen if you are lucky. Be patient.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).

Good luck.