First New High in X Weeks

Earlier this week there were 128 new 8 week highs in the S&P500 members, but for 26 of them it was the first new high. By using the BARSTRUE() function with HIGHESTHIGH() you can use the following to scan for when these first new highs occur:

//Set lookback period;
V1 = HIGH() > HIGHESTHIGH(BACKTYPE=Weeks, BARS=8);
//Count how many new highs over the lookback period (in trading days). Signal when 1 new high and its the last bar (V1 is true).
BARSTRUE(V1, LOOKBACK=40)==1 and V1

NOTE: the lookback period in the last line must be in trading days ie 40 (8 x 5) for 8 weeks, of 60 for 12 weeks.

Clients can download the ASX and SPX workbooks attached, which includes the following.

Avg 20 Day Volume formula:

VOL() / MA(VOL(), BARS=20, CALC=Close)

# New Highs over X weeks:

V1 = HIGH() > HIGHESTHIGH(BACKTYPE=Weeks, BARS=8);
//Count how many new highs over the lookback period
BARSTRUE(V1, LOOKBACK=40)

New High arrows:

HIGH() > HIGHESTHIGH(BACKTYPE=Weeks, BARS=8)

Custom Bar Colours to show last 8 weeks in blue:

//Get last BarIndex value;
B1 = LAST(BARINDEX());
//Subtract number of trading days;
BARINDEX() >= (B1-40)

 

1st-X-Week-Highs-SPX.owb (211 KB)

1st-X-Week-Highs-ASX.owb (102 KB)

Darren, BARINDEX() is a not valid script criteria in my system. I have Optuma 1.5X64 Build 64.

Peter

Hi Peter,

You need v1.6 beta for this script to work. You can sign up to the beta via a banner on your Optuma home page.