Hello rainerd,
You cannot use the letter “h” for a variable as it is reserved by the programming language.
Also, on line 2 and 3, you must define the chosen price to look for the highest and lowest. I modified your code a bit, here it is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
n = 4 hh = highest[n](high) l = lowest[n](low) once b = 2 v = hh if hh = high[n-1] and high[n-1] > high and high[n-1] > low and (b = 1 or b = 2 ) then v = hh b = 0 else if l = low[n-1] and low[n-1] < low and low[n-1] < high and ( b = 0 or b = 2 ) then v = l b = 1 else v = v[1] endif endif return v |
Please find attached what we get for your indicator.