I want to initialize those 2 values, baseHigh and baseLow as const variables, i.e., non-mutable. I want these to be set to the H and L values as they are today, right now, the day this exploration is run. Then, if the prior H and L for 10 days, or periods, falls within the calculated channel of the H and L at t sub 0, I want to return a boolean true, else, return a false.
The current program changes the vase values to the OHLC value of every period examined, which makes the channel value useless. The manual's explanatio of ref() gives the impression that the value at a given time is returned, i..e., 0, but that is now what happens. So the script does what I asked, but not what I wanted. Hence, I'm asking the gurus that frequent this forum.
Garp
{ change the next 3 lines to change search criteria }
upPct:=.20; { 20 % }
dwnPct:=.20; { 20 % }
lookBack:=10;
/* const */ baseHigh:=ref(H,0); // how do I do this???
/* const */ baseLow:=ref(L,0); // how do I do this ???
upLimit:=baseHigh+(baseHigh*upPct);
dwnLimit:=baseLow-(baseLow*dwnPct);
hiHigh:=HHV(H,lookBack);
lowLow:=LLV(C,lookBack);
{ if condition is true, return 1, els, return 0 }
If( upLimit <= hiHigh AND dwnLimit >= lowLow, 1, 0 )