I'm coding a formula to scan for left sides of bases made in stocks.

It will be a new high and then no new highs made for subsequent 20 days after this.

I used:

```
LeftSide = C>=HHV(C,250) and Sum(C>=HHV(C, 250), 20)==1;
```

This finds an initial NH, but then only looks back for the previous 20 days - and not 20 days in the future.

Suggestions welcome.

Thanks

C_M
2
Something like this (not tested). Base it on today is easier. I don't think there's any need to look at future bars.

```
a = C>Ref(HHV(H,250),-1);
x = valuewhen(a,H,1);
b = HHV(H,20)< Ref(x,-1);
d = Sum(Ref(a,-1),20)==1 ;
Filter = b AND d;
AddColumn(C,"Close");
```

Thanks for your answer, but it didnt work for me

SOLVED IT.

```
nhm = C>=HHV(C, 250);
t1 = Sum(nhm, 20)==0;
leftsidebase = nhm AND Ref(t1, 19)==0 AND Ref(t1, 20)==1;
```