How many days are all up?

Discussion in 'Trading' started by UVXY20, Jul 22, 2024.

  1. UVXY20

    UVXY20

    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.
     
  2. 2rosy

    2rosy

    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
     
    Zwaen likes this.
  3. UVXY20

    UVXY20

    Um, that would mean like 1 day in 5 years, no?
     
  4. SunTrader

    SunTrader

    think 2rosy uses the European way of writing 20% as 0.2%

    If that is the case (?) then 20% of 250 trading days x 5 years would = 250
     
  5. UVXY20

    UVXY20

    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 ...
     
  6. 2rosy

    2rosy

    not 20%. .2%
    3/1259 = .002

    there were 3 days over last 5 years meeting your criteria. Maybe you can make a few bucks
     
  7. SunTrader

    SunTrader

    Check your script, 3 days is not even close.

    edit: some weeks have 3 daily up close never going red, after going green.
     
    UVXY20 likes this.
  8. p0box4

    p0box4

    Could be right, he is talking about day's with 0 ticks below the opening price.
     
    UVXY20 likes this.
  9. 2rosy

    2rosy

    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
     
    punktrader likes this.
  10. rb7

    rb7

    How do you know beforehand that there won't be any tick below the opening price?
    I guess you know it after the close....
     
    #10     Jul 22, 2024