- Topics: 56
- Replies: 464
- Posts: 520
It’s always good practice to break things down in to the separate components as a Show Bar – so you can verify that the script formulas are doing what you want them to do. In this example the green Show Bars are the new 52 week high closes (Y1), and the red ones are the new 20 day lows(L20). The green shaded areas are when the lows occur within 50 bars of the new highs, created using a Show View tool with the following formula (and true/false in the watchlist column).
//Is it a new 52 week high?
Y1 = CLOSE()>HIGHESTHIGH(CLOSE(), BACKTYPE=Weeks, BARS=52);
//Is it a new 20 day low?
L20 = CLOSE()<LOWESTLOW(CLOSE(), BACKTYPE=Bars, BARS=20);
//is the low within 50 days of the high?
L20 and TIMESINCESIGNAL(Y1)<50