Just because someone says he's "never seen it before" and "has 30 years trading experience" is a basic "false authority/appeal to authority/appeal to accomplishment" logic fallacy.
Oh, but there is a need to do it.
This has happened 7 times in the last 2 years alone which I've determined through about five minutes of coding. Obviously there may be some differences between data sources and I freely admit that my code may contain errors. I post it here for others to test/replicate/critique rather than making sweeping statements about it.
Code:import norgatedata import pandas as pd indexticker = '$COMP' advancingissuesticker = '#NASADV' decliningissuesticker = '#NASDEC' timeseriesformat = 'pandas-dataframe' start_date = pd.Timestamp('2020-01-01') indexdata = norgatedata.price_timeseries(indexticker,start_date=start_date,timeseriesformat=timeseriesformat) # Search for a situation # "Nasdaq was down 137 points yet NAMO was up." indexdata['chg'] = indexdata.Close - indexdata.Close.shift(1) indexdata.drop(columns=['Open','High','Low','Volume'],inplace=True) # Add in A/D data adv = norgatedata.price_timeseries(advancingissuesticker,start_date=start_date,timeseriesformat=timeseriesformat) dec = norgatedata.price_timeseries(decliningissuesticker,start_date=start_date,timeseriesformat=timeseriesformat) # Cleanup colummns adv.drop(columns=['Open','High','Low','Volume'],inplace=True) dec.drop(columns=['Open','High','Low','Volume'],inplace=True) adv.rename(columns={'Close':'adv'},inplace=True) dec.rename(columns={'Close':'dec'},inplace=True) # Merge A/D data into index data indexdata = pd.merge(indexdata, adv, how="left", left_index=True, right_index=True) indexdata = pd.merge(indexdata, dec, how="left", left_index=True, right_index=True) # Calc McOsc for Nasdaq indexdata['mcosccalc'] = 1000 * (indexdata.adv - indexdata.dec) / (indexdata.adv + indexdata.dec) indexdata['mcosc'] = indexdata.mcosccalc.ewm(span=19,adjust=False,min_periods=19).mean() - indexdata.mcosccalc.ewm(span=39,adjust=False,min_periods=39).mean() indexdata['mcoscchg'] = indexdata.mcosc - indexdata.mcosc.shift(1) # Find "Nasdaq was down 137 points yet NAMO (Nasdaq McClellan Oscillator) was up." # To prove/disprove "I have never seen this before." by wmvmw indexdata['wmvmw'] = ((indexdata.chg <= -137) & (indexdata.mcoscchg > 0)) # Show those rows that satisfy the condition print (indexdata[indexdata['wmvmw']])
Output:
Code:Close chg adv dec mcosccalc mcosc mcoscchg wmvmw Date 2020-03-20 6879.520020 -271.060059 1307.0 2017.0 -213.598068 -49.251003 2.724048 True 2020-09-16 11050.469727 -139.850586 2046.0 1358.0 202.115158 10.166898 10.642873 True 2020-11-09 11713.780273 -181.450195 2373.0 1202.0 327.552460 31.498248 13.775218 True 2020-11-10 11553.860352 -159.919922 2133.0 1393.0 209.869537 37.234422 5.736174 True 2021-03-08 12609.160156 -310.990234 2007.0 2080.0 -17.861511 -57.224157 6.734503 True 2021-04-14 13857.839844 -138.259766 2292.0 1885.0 97.438354 -3.683592 6.163399 Trueeve 2021-09-17 15043.969727 -137.950195 2238.0 2209.0 6.521250 -2.064219 2.165337 True
OK, it is good that I have found someone who can code. What were outcomes of these 7 cases? I mean after those 7days market were continuing going down or reverse?
Never mind, I will check them myself later.
Here is my strategy:
1. Short SQQQ with 80% portfolio, the rest is cash.
2. Rebalance every 10 days if:
The account balance on the last day of last 10 days is up compared with the last day of previous 10 days;
3.If account balance on the last day of last 10 days is down compared with the last day of previous 10 days, exit the whole position;
4. If anytime account is hit with 13% drawdown, exit the whole position.
5. Reenter when SQQQ price is lower on the last day of last 10 days compared with the last day of previous 10 days.
6. The 10 days count continuously, does not change as exit or reenter happening.
It was supposed to make like 300% annual profit,and I was trying to backtest it, but I do not know coding.
Last edited: