# Close < 50% of last 6 months range

hi,

I am looking for the stocks with a close > 50% of their last 6 Months range.
I use the following formula:

v1= last(high(month(PERIODAMOUNT=1))[6]);
v2= last(low(month(PERIODAMOUNT=1))[6]);

6M50=(v1+v2)*0.5;

close() > 6M50

I got a bunch of results (ACC, ADP, ACI…) where the close is below the 50% line.
Why isn’t it working pls?

Thanks
Marc

Hi Marc,

If you plot your V1 and V2 variables you will see the values returned - ie the monthly highest and lowest prices 6 months ago (remember [6] is an offset, not a lookback).

Try using the HIGHESTHIGH() and LOWESTLOW() functions to create the range instead.

Thanks but I see no difference. I still have results I should not have.: ACI, ACN, ADP, AEHR…

v1= last(highesthigh(month(PERIODAMOUNT=6))[1]);
v2= last(lowestlow(month(PERIODAMOUNT=6))[1]);
6M50=(v1+v2)*0.5;
close() > 6M50

What formula do you use?

Tanks
Marc

That’s not the syntax for the function… you can’t just type the text - you need to add the function and then click on it to set the required properties from the pop-up box, and it will then fill in the correct text for you ie HIGHESTHIGH(BACKTYPE=Months, BARS=6, INCBAR=True) to get the 6 month high.

You also don’t need the LAST() or the [1] offset, so use LOWESTLOW(BACKTYPE=Months, BARS=6, INCBAR=True) for V2 and it should work.

See here for other examples of calculating ranges and levels:

https://forum.optuma.com/topic/50-all-time-high-all-time-range/

Ok Thanks Darren. Now I got it