A request that was addressed to ProRealTime:
I want a method to get the “PREVIOUS HIGH, PREVIOUS LOW & PREVIOUS CLOSE” of previous year.
Suggestion for an anwser:
You must select the data from the beginning of last year
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
once currenthigh=high once currentlow=low once previousclose=undefined once previoushigh=undefined once previouslow=undefined if openyear <> openyear[1] then previousclose=close[1] previoushigh=currenthigh previouslow=currentlow currenthigh=high currentlow=low else currenthigh=max(high,currenthigh) currentlow=min(low,currentlow) endif return previoushigh as "previous year high",previouslow as "previous year low",previousclose as "previous year close" |