Looking for consecutive up or down bars

 

Hi,

I'm looking for something fairly simple, I believe, but can't seem to

make it work.  Not sure if there's a better way either.

 

I want to check the close price of the currrent candle with the close price

of previous candles.  If requirement met, put an order in.  This is the code

to check for consecutive down candles (int ConsecutiveBars, global variable):

 

      int consecutiveDownBars = 0;
      
      //check for consecutive bars in negative direction;
      for(int i = 0; i < ConsecutiveBars; i++)
      {
      
         if(Close[i] < Close[i+1])
           { consecutiveDownBars++;
            Alert("consecutiveDownBars incremented"); }
         else
            break;

      }

 

Any help would be appreciated.

Karlo 

 
karlor:

Hi,

I'm looking for something fairly simple, I believe, but can't seem to

make it work.  Not sure if there's a better way either.

 

I want to check the close price of the currrent candle with the close price

of previous candles.  If requirement met, put an order in.  This is the code

to check for consecutive down candles (int ConsecutiveBars, global variable):

 

 

Any help would be appreciated.

 Karlo 



Hello, I am looking for the same alert : after consecutive determined number of candles I want to receive an alert.

for mt4 I have some indicators that work, but not for MT5.

 

could you help me please????

 
karlor: Any help would be appreciated.
  1. Help with what? you haven't posted a question or a problem. Start with getting the current candle, and then comparing it to a non-zero number of previous ones.
  2. learn to code it, or pay (Freelance) someone. We're not going to code it FOR you.
    We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
zefontes: Hello, I am looking for the same alert : after consecutive determined number of candles I want to receive an alert. could you help me please????
  1. You're not looking for the same alert. "after consecutive" is not the same as "currrent candle with previous candles"
  2. OP already gave you the code, but since you can't code there is no common language
    for us to communicate.
  3. learn to code it, or pay (Freelance) someone. We're not going to code it FOR you.
    We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Reason: