How many days are all up?

Curious about a stat for, say, SPY. What percentage of trading days opened up, and stayed up, without going red and closed up? Longer time frame the better.
 
over last 5 yrs .2%


Code:
import yfinance as yf
tickers = [ "SPY"]
ohlc = yf.download(tickers, period="5y")
len(ohlc[ohlc.Open <= ohlc.Low]) / len(ohlc)

0.0023828435266084196
 
Ah,thanks for the translation. The figure now seems plausible but I am a little surprised it's so low. But I guess if 52% are up at the close then ...
 
not 20%. .2%
3/1259 = .002

there were 3 days over last 5 years meeting your criteria. Maybe you can make a few bucks
 
not 20%. .2%
3/1259 = .002

there were 3 days over last 5 years meeting your criteria. Maybe you can make a few bucks
Check your script, 3 days is not even close.

edit: some weeks have 3 daily up close never going red, after going green.
 
these are the days. If the open is ever greater than the low doesn't that mean the day went into the red?


Code:
                  Open        High         Low       Close   Adj Close    Volume
Date
2019-11-25  311.980011  313.369995  311.980011  313.369995  290.974365  48647200
2020-08-04  327.859985  330.059998  327.859985  330.059998  311.152649  41917900
2022-03-22  445.859985  450.579987  445.859985  449.589996  434.387634  74650400
 
Could be right, he is talking about day's with 0 ticks below the opening price.
How do you know beforehand that there won't be any tick below the opening price?
I guess you know it after the close....
 
Back
Top