# An other Use of close[ ] 11

Hi to all! I have a simple question. I need in my ea to enter buy, for example, if ALL the last 3 candles are Above a moving average.

Example:

If ((Close&&Close&&Close)>ima(......))

Is there another method instead of out all this close&&..?

Like Close[1+2+3]?

Manu Hanks to you 20105

1. ```If ((Close&&Close&&Close)>ima(......))
```

Bogus. True = non-zero and false = zero so you get true && true && Close>ima

 ```if( 3 < 2 < 1 ) if( false < 1 ) if(     0 < 1 ) if(     true  )``` ```if( 3 > 2 > 1 ) if(  true > 1 ) if(     1 > 1 ) if(     false ) ```

2. Like Close[1+2+3]?
Equivalent to Close

3. There are no short cuts. Try one of these:
```if (Close)>iMA(…)
&&  Close)>iMA(…)
&&  Close)>ima(…)) …
```
```double ma=iMA(…);
if (Close)>ma
&&  Close)>ma
&&  Close)>ma) …
```
```template<typename T>
T MathMax(T a, T b, T c){ return MathMax(a, MathMax(b, c)); }
⋮
if (MathMAx(Close, Close, Close) > iMA(…)) …``` 910

William Roeder:
1. Bogus. True = non-zero and false = zero so you get true && true && Close>ima

2. Equivalent to Close

3. There are no short cuts. Try one of these:

3. This won't catch it. Actually you need:

```template<typename T>
T MathMin(T a, T b, T c){ return MathMin(a, MathMin(b, c)); }
⋮
if (MathMin(Close, Close, Close) > iMA(…)) …``` 20105

correct