How to separate two Low[1] by if statement?

 
Example, previous low is 1.55. When next candle low is 1.66, then next next candle low is 1.44 which is lower than previous low (1.55) then do something. How to achieve it?

    double previous_low = 0;
    double new_low = 0;
    double new_low2 = 0;
    if (((previous_low==0)&&(Low[1] < Low[2])){
         previous_low = Low[1];
    }
    if (previous_low != 0){
         if (Low[1] < previous_low){
              new_low2 = Low[1]; //it fail
         }
         if (Low[0] < previous_low){
              new_low2 = Low[0]; //it works only if next 1 candle is lower than previous. It fail if next 2 candle is lower than previous_low (1.55).
         }
    }
 
  1. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon. As they did with your previous post.

  2. There are not "two Low[1]". There is only one, the last complete candle low (Low[1]) and the previous candle low (Low[2]). There isn't an "old Close[1] and new Close[1]". The last close (Close[1]) becomes close[2] as soon as a new candle starts.

  3. Eng Keat Ang: next next candle low is 1.44 which is lower than previous low (1.55) then do something. 
    Code it exactly like you stated.
    if( Low[1] < Low[2] ) DoSomething();

 
William Roeder:
  1. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon. As they did with your previous post.

  2. There are not "two Low[1]". There is only one, the last complete candle low (Low[1]) and the previous candle low (Low[2]). There isn't an "old Close[1] and new Close[1]". The last close (Close[1]) becomes close[2] as soon as a new candle starts.

  3. Code it exactly like you stated. 

That is the problem.

I cannot use code :

 if( Low[1] < Low[2] ) DoSomething();

Because sometime next candle won't be lower than previous candle, need to wait 6th candle only will find lower than the previous 6th candle back. So I need to have old Low[1] and new Low[1]. Is it posible to store Low[1] at variable or array or private class? And when found new Low[1] is lower than the old 1, then do something.

 

https://www.mql5.com/en/forum/316883Eng Keat Ang:

Because sometime next candle won't be lower than previous candle,

need to wait 6th candle only will find lower than the previous 6th candle back.

So I need to have old Low[1] and new Low[1].

Is it posible to store Low[1] at variable or array or private class?

And when found new Low[1] is lower than the old 1, then do something.

  1. So what?
  2. Now you are changing your problem. That isn't what you originally posted. That is what your other thread already discussed. You already know how — you posted the code:
    int iLL = iLowest(_Symbol, _Period, MODE_LOW, 6, 2);  // Lowest candle 6 back.
    if (Low[1] < Low[iLL]) {                              // Last candle is lower.
         DoSomething(); 
    }

  3. Stop saying that. There are no old and new, there are only candles, the forming one (0,) the last one (1,) the previous one (2,) …
  4. Why do you think you need to store values in a variable or array, when they are already in an array to start with?
  5. That is your original question and was answered, but you state you "cannot use code." Until you can concretely describe what you want, you can't code it.
 
that is my original question : "Example, previous low is 1.55. When next candle low is 1.66, then next next candle low is 1.44 which is lower than previous low (1.55) then do something. How to achieve it?"
 
Eng Keat Ang: hen next next candle low is 1.44 which is lower than previous low (1.55) then do something. How to achieve it?"

Asked and answered

 if( Low[1] < Low[2] ) DoSomething();
 
William Roeder:

Asked and answered

i see. I got what you mean know. Thanks.

 
William Roeder:

Asked and answered

should be 

if( Low[1] < Low[2] ) DoSomething();
if
( Low[1] < Low[3] ) DoSomething();