Posted By: strimp099
N day high - 02/15/21 07:59
Greetings,
How can I determine if yesterday's close price is the rolling 50 day high? This is what I tried so far
When I run this, I'm entering the IF statement on every iteration even though equalF(Max50Day, Prices[1]) evaluates to 0.000.
I've also tried the following in the IF expression
Which only matches once in 16 years worth of SPY daily close history (?).
How can I determine if yesterday's close price is the rolling 50 day high? This is what I tried so far
Code
vars Prices = series(priceClose()) var Max50Day = MaxVal(series(priceClose()+1),50); if (equalF(Max50Day, Prices[1])) { // do stuff printf("\n%f %f %f",Max50Day, Prices[1], equalF(Max50Day, Prices[1])); }
When I run this, I'm entering the IF statement on every iteration even though equalF(Max50Day, Prices[1]) evaluates to 0.000.
I've also tried the following in the IF expression
Code
if (Prices[1] >= Max50Day)
Which only matches once in 16 years worth of SPY daily close history (?).