- Topics: 23
- Replies: 39
- Posts: 62
Hi. I’d like to build on the idea of ranking using IF statements in a watchlist, if possible.
I have 2 IF statements. They both work. Each IF statement assigns a number if true and a different number if false. I want to use them together to save space on my watchlist. Below I am pasting 2 scripts, but in reality the IF statements are in different scripts/columns:
//Define the 4 possibilities
V1 = Close() >= HIGHESTHIGH(CLOSE(), BARS=21) ;
V2 = Close() >= HIGHESTHIGH(CLOSE(), BARS=63) ;
V3 = Close() >= HIGHESTHIGH(CLOSE(), BARS=252) ;
V4 = Close() >= HIGHESTHIGH(CLOSE(), BARS=21, RANGE=All Time) ;
//Script 1 works perfectly to pick up v1 and v2***
If(v1, if(v2, 2, 1))
//Script 2 works perfectly to pick up v3 and v4**
If(v3, if(v4, 4, 3))
The idea is to have 1 column in the watchlist instead of 2 columns. I want to see 4 if it’s an all time closing high, 3 if its a 252 bar closing high, 2 if it’s a 63 bar closing high, and 1 if it’s a 21 bar closing high. I have tried many, may things and cannot seem to crack the code. Please let me know if I can accomplish this.