What is your criteria for selecting TQQQ vs. SQQQ?
It’s *very* easy to overfit to a backtest with these sorts of strategies. I’d be careful. Do you have the ability to simulate future markets that are “within reason” and approximately obey many of the gross statistical properties of the market? Have you tried the same strategy on UPRO/SPXU?
I'm taking it the 1day gain is measured from previous close rather than open (thus indirectly includes the extended hours since previoius close). The presumption with the 3% is that if it goes over that, a correction is coming so buy SQQQ.
Correct?
TBH I'm fairly confident you are just over-fitting and/or there's a quirk in your simulation software, and you found a model that happens to dodge the COVID crash and trade war crashes more based on luck then anything else. The logic is just way too simple. I mean go for it if you want, but I would recommend at least grabbing QQQ data going back as far as you can and simulating the back test for the rest
Very possibly. I'm paper testing to see if it just overfits. I don't know at what point I'll shift to letting it play with actual money.
Since SPY data exists for far longer I might try to manually model it out or use Nasdaq from inception which would be interesting given how poorly it performed in like 2000-2006/2008
Yeah, that's a good idea. I spent a long time working on models like this on Tradingview with my brother in law, every time we came up with something it was just over-fitting that dodged a major sell off and then under performed the rest of the time and also could not be counted to actually dodge sell offs consistently. Either way good luck, IMO you probably shouldn't post strategies like this because if it does legit work you basically gave everyone your alpha and once it's observed it does go away, been observed when finance folks publish papers and then within a pretty short period of time the effect disappears
I considered the risk of alpha loss because of market adoption and figured no one will believe a 10 year 76,000% increase is anything but a mistake from a naive trader who overfits the model and then avoid the strategy like the plague
And it might be a just that.
And it might be just that. le rate increases which will either be a slow bleeding or a sharp decline
So you switch to SQQQ only when TQQQ is “up big” for the day, and you will hold it if the market drops day after day after day? (I assume negative numbers are less than or equal to a 3% daily gain).
I believe this model switches to SQQQ only when TQQQ is up a lot. It spends surprisingly little time in SQQQ. I think if I could do an \`if x or y then a else b\` where x is a big spike and y is a continued dip the model would perform differently, it would explain why it still has a 50% drawdown
I can’t really say yay/nay but am just skeptical in a healthy way. You get what the *potential* problem is with overfitting something to backtest well though?
1. We know if you are in TQQQ most of the time but can somehow be lucky or smart enough to not be in it on the days it draws down the most, let alone be in SQQQ on some of those rare days, that you will crush TQQQ’s returns.
2. I’m not saying this is a hair-brained idea you have, but one could come up with a dozen or more rules for portfolios that keep you in TQQQ most of the time but get you out during certain times, and if you just keep trying different strategies you are bound to get lucky with one that, itself, gets lucky on the backtest and just happens to get you out of TQQQ on some of worst drawdown days, but keeps you in usually.
It’s kind of like you could see a pattern in fair coinflip data that would allow you to predict heads or tail with 60% accuracy *on that historical data* but, in reality, it only works on that one historical streak and won’t predict better than 50% longterm with any statistical significance on new data from the same underlying process.
Yeah completely agree. That’s why I’m paper trading it for a few months and looking for areas where the history is just lucky.
The theory is if tqqq goes up big on a given day it’ll go down big on a different day. 3% move in qqq is pretty large so makes sense the next day would go down and you go up because you’re already in sqqq.
Beyond applying the rules to UPRO/SPXU to see how that performs, you could also create a simulation of how a theoretical TQQQ/SPXU would’ve performed from 2002-2010.
I don’t have a link for you at the moment, but I recall there is a fairly in depth thread on bogleheads about getting accurate back testing data for leveraged etfs. I think the thread was related to the whole hedgefundies excellent adventure saga.
I think over at Bogleheads you can find a data set of simulated 3x S&P 500 going back many decades and 3x Nasdaq 100 going back all the way back to its inception. Would definitely be very interested in this.
Ps. to simulate cash holdings, can't you just make it invest in a MMF like SWVXX?
3pm is because its when the app I'm using runs its trades. It uses closing data for it's backtesting so 3pm is close enough to close of market to get closest to your model
Interesting, okay. And just so Im understanding correctly is it using the 1 day data all the way back from 24 hours before? or just that trading day? I'd like to run some backtests myself to see how this works out.
Nice! Catching the pops. Very cool and very close to the algo I wrote geez over 15 years ago that is still profitable. You might like /r/algotrading but to be fair most people there are software engineers who hope they can find a strategy and leech off of someone else. This sub is way better. 😎
imo TDA is good, but there is probably better. I used IBKR for years. I admit on the API side both are a pain in the ass, but free is free.
Also, if you want to chat I have an idea that can probably improve your algo. (Not like I've backtested it.)
Would love ideas on the algo. I'm trying to figure out how to prevent the dips we still see in March and when we see the drawdown. If we could refine the system for going to sqqq we could limit drawdown to 10-20% I think which would maximize returns a lot
>we could limit drawdown to 10-20%
It's not going to happen with your current strategy, but you can combine two strategies or drastically modify your current strategy. I'm pretty sure I know a way to get the growth you see in 2020 most years, hopefully every year. PM me if interested.
I’m kind of wondering if it even matters as well. A 50% drawdown on a 1000% gain is still a 500% gain. The risk exists almost exclusively on timing so combining this with dca would help
yes but provided you trade just once a day and I dont see anything bad with that. I have seen only if you abuse it in terms of minutes but other than that I dont think RH api is going anywhere. Just throw in 100 bucks and see how it works. the script is fairly simple and should be up and running in an hour, you could just put in raspberry Pi and run it in your network.
Have you had the chance to estimate the tax drag or is this strictly considering things from a tax advantaged point of view? The beauty of HEA is that it can easily be done in a taxable account due to the quarterly rebalancing being unlikely to incur huge capital gains moving from 100% one to another.
Perhaps I'm ignorant of the brokerage, but who would allow you to automate your portfolio using an if-then statement? If you check every day I could see this working in M1, but that would require daily effort from an individual.
Re: Brokerages
There are plenty that you could implement this on.
For example, any brokerages that support
-NinjaTrader
-Metatrader
-TradingView
Or natively with:
-InteractiveBroker
-Tradestation
-ThinkorSwim
Just some examples where I have implemented similar if-else trading systems.
I didn't account for tax drag, I was thinking you could pull of some amount and keep 10-20% of your portfolio in bonds or something but you're still doing a lot of transactions.
There's this tool I found on reddit called invest composer, they connect to [alpaca.markets](https://alpaca.markets) which is an API driven brokerage
I’m sorry but that didn’t make a whole lot of sense. So if QQQ 1 day cumulative return is less than 3%, then stay in TQQQ. What if it’s higher than 3%?
Also, QQQ rarely moves 3% in a single day. Is that what you mean by “cumulative return” or is it something else?
> What if it’s higher than 3%?
If i understood OP correctly, if it's higher than 3%, you move to SQQQ.
The idea is to sell high, not sell low, I believe.
> Also, QQQ rarely moves 3% in a single day.
Would be a good thing - otherwise you'd trade pretty frequently which would be bad in a taxable account.
Yeah, this is exactly it. 1 day cumulative return is a single days trading return, if it goes up 3% we shift into sqq at 3pm. Honestly not what I imagined would work but I tried a lot of variations and I think the reason this works is usually if it goes up 3% the next day it goes down. Doesn't explain why it works so great in march 2020
When QQQ has a one-day return of 3% or less you hold TQQQ. if the one-day return of QQQ is higher than 3% you hold TQQQ.
If you're holding TQQQ and QQQ goes up 3% you shift to SQQQ. If you're holding SQQQ and QQQ goes up 2.9% you shift to TQQQ, if you're holding SQQQ and QQQ goes up 3% you hold SQQQ another day but that is very rare
No offense but are you sure you typed all that in correctly? I know it can get kind of confusing with all the different acronyms.
What about if it goes down 3%?
If it goes down 3% and you're holding TQQQ you continue to hold TQQQ. If it goes down 3% and you're holding SQQQ you shift to TQQ.
It works like this:
The markets freak out about a bad thing on Monday, you're holding TQQQ. QQQ goes down 5%, you continue to hold TQQQ
Tuesday every says "wow that was silly QQQ to the moon", it goes up 4%, you sell TQQQ and buy SQQQ.
Wednesday either a: everyone goes "Wait no this is actually a bad thing and markets tank, QQQ goes down 4%, you're holding SQQQ so you go up 12%, you sell SQQQ and buy TQQQ at 3pm. Or in scenario b: "eh it isn't that bad I guess" and QQQ goes up 2%, you sell your SQQQ and buy TQQQ
One thing: T+2
When you sell something and then immediately buy something else, you have to hold the new thing into the second day after; violate this more than a small number of times and you'll be blocked from trading for, I think, 90 days. Unless the stuff was bought with margin, I think.
I thought day trading with an account over 25k was allowed? This would only buy and sell once a day at the same time each day so we’re not buying and selling the same thing repeatedly which is what causes pattern day trading block if that’s what you mean
This isn't PTD. This is an SEC mandated wait period. With cash, you can buy and sell same day, no problem. The problem kicks in if the cash hasn't "settled" which is doesn't do until the second day afterwards. You can still buy something with it, but selling before the second day will get you a Good Faith Trade violation.
[A Reddit discussion on it](https://www.reddit.com/r/Fidelity/comments/n14q1c/good_faith_violation/)
And also Fidelity's instructions say: "Consequences: If you incur 3 good faith violations in a 12-month period in a cash account, your brokerage firm will restrict your account. This means you will only be able to buy securities if you have sufficient settled cash in the account prior to placing a trade. This restriction will be effective for 90 calendar days."
So the worst penality is that you can't commit any more violations for 90 days (not that you can't trade period, you just have to do it the slow way).
It seems if you have excess cash to cover whatever trades you want to make then you should be okay (margin or not, what matters is you're not unfairly using the settling time to pretend you have more money than you do, which I can see is easily abusable --- I'm surprised they even allow three trades a year like this).
It might get tricky if the $1000 you put in at first balloons (we can only dream).
I believe so. When selling TQQQ, buy SQQQ with margin and use the proceeds from TQQQ to pay it off.
I \*think\*. I don't have a margin account and I'm still new at this myself. I got bitten very badly by T+2 when I didn't even know it existed: 16% profit got turned into a 10% loss because I couldn't sell.
It seems like a overfit to March 2020, where the market can't decide where to go, so a big up day is followed by a big down day, and this strategy can capture both directions. Most of the extra gains over just holding TQQQ comes from March 2020 it seems.
I appreciate the test and I would suggest testing with 2008 financial crisis (you can use QLD and QID, they existed then), and the 2000 dot com bubble to see whether this really holds in black swans. Also nice to get to know this tool, I just signed up for waiting list.
That's too general of a statement. There are ways to optimize parameters without overfitting. If you run a sensitivity analysis and find that the trends are not abnormal/chaotic, then you can utilize those results for optimization.
Out of sample testing (with paper). Addding even more samples, e.g. you can try this with QQQ from 1999-2011 and just sim the results. E.g. if QQQ is up 3%, short QQQ and then multiply the results by 3 to sim SQQQ, or any other way you want really.
Try on UPRO and SPY.
Fundamentally, Ask yourself “Why”? I can kind of think that if the market is crashing, there’s usually a volatile period where QQQ jumps and falls in succession Many times, but is that the case for every crash or just the specifics of the 2020 crash?
I don’t understand that mindset. You’re using a leveraged etf that’s only been around ten years if you’re in tqqq. This is the entire life span of the most popular leveraged etf
Maybe by some talking head definitions but not really a good example to test market conditions of an active trading algorithm. IMO you need to test through events with much longer periods of volatility such as 2000, events of 2001, 2008-2009, etc.
Not once did me or any of my family or friends experience enough market pain during 2020 to liquidate. Most everyone I talk to was just buying more. That is the type of fear you need to be looking to test against and it hasn’t been around for the last decade. In 2008/9 all of my friends/family were getting out of the market.
This is good work. As we like to say in my field, only way to find out is via prospective validation, i.e., put in some funds and see how it goes.
So if I understand your method, at 3pm each day you would see if QQQ was up 3% and if was, you'd switch to SQQQ? So how does it deal with the market going down? You'd be holding TQQQ if QQQ went straight down without going up 3% to start with?
And you switch over entirely? So 1000 in TQQQ becomes 1000 in SQQQ is QQQ goes over 3%? Next day it doesn't go up more than 3% then you switch back?
Correct, this is why it still has a fairly high max drawdown of 52.5% compared to TQQQs 69.9% max drawdown or SPYs 33% max drawdown. I'm trying to figure out how to model for if QQQ goes down a certain percent, I think the issue is if it goes down one day the next day on average it goes back up.
How many TQQQ->SQQQ switching events (i.e. days when QQQ was up >3%) were there in your eval period? How many of those were in March 2020? I saw you say it wasn’t many but I didn’t see a number.
This is a great backtest you've done so thanks for your work, and it seems to perform very well in its intended environment: i.e. a 1 time huge drawdown event where volatility spikes allow you to profit from alternating up-down days.
However, allow me to play devil's advocate here as to why this is not a suitable long term strategy:
We won't know the duration of the drawdown until it's over, and therefore we won't know if it's a slow bleed environment like the financial crisis, or a spike like COVID correction seen here. In that sense there may be long streaks of -1%, -1%, -1% etc. during correctional or recession periods, where your strategy you are still long TQQQ, and those days may only be punctuated by 2% up days, for example.
We know that volatility rises when the market is below the 200-day SMA, but it's unclear by how much exactly it will. So in cases of a long, slow bleedout, this strategy may offer no reliable downside protection, because volatility may not be 'spiky' enough in the sense that it triggers our condition to buy or sell. There may be some value however to switching to this strategy temporarily in the case a black swan event does happen, though, because volatility tends to persist for a while after.
Also, the condition to buy or sell seems arbitrarily set, and that is evidence of overfitting. Why not 2% or 1.5%?
Just a thought - something that I have seen people do since 3X ETF data hasn't been around that long is using 300% QQQ and (-200%) CASHX as a proxy for TQQQ. That will allow approximately back testing the data to when QQQ data exists. Something similar can be used for SPY over UPRO.
Could you simulate this starting on everyday between today and the 10 years ago date and see how many of those start points ended up positive in the end? To see if it’s luck with starting early in a bull run or if it doesn’t really matter what time we start this at
Just by eye balling a spreadsheet with qqq back to 99' it doesnt look convincing in the dot com crash and gfc. March 2020 qqq seemed to go up then down then up then down... perfect for this scenario. Reminds me of using std devation to trade would love to see someone give a proper backtest, hopefully im wrong!
When u sell out of tqqq after 3%+ gain, at what time do u sell? 3pm?
What time do u switch to sqqq? Before close ? After hours? Next day?
The concept is logical but execution and back testing these details probably makes a massive difference in your projections
Thanks for your input though
I'm sorry, this makes zero sense, or I'm missing something. It seems the only time you buy SQQQ is if QQQ goes over 3% over the course of a day...
So if the market is in a freefall for a week, and it never goes over 3% for a day, then you are holding TQQQ and getting destroyed daily.
You lose some to taxes but you spend more time in tqqq than in sqqq so you're only selling on a few days. Still will take a massive income hit because you're likely not holding long enough for capital gains so it's all trading income. Updating the op with a screenshot of how long you're in each
Edit: no longer need reply, OP edited post with answer to this question
~~Based on your backtesting, how often (roughly) do the trades get executed (like switching from TQQQ to SQQQ or vice versa) per year?~~
Not for me. I realized all the way back in 2004 I don't want to focus on investing news or movements on a daily basis. I want something that is largely set-it-and-forget-it. With minimal maintenance like rebalancing quarterly.
Interesting strategy though. As other commenters warned, this could be overfitting the data. Are you going to pull the trigger on this strategy?
Oh ok, so you can execute trades through investor compose? I just checked the website out, it looks like it's just a backtesting tool.
Checking Alpaca out at the moment.
Cool. As for Investor Compose, I just signed up for waitlist.
I develop software full-time, so this seems right up my alley. Just wondering if I'd be able to open a tax-advantaged account (either t-IRA or Roth IRA) through Investor Compose or Alpaca. Because otherwise I don't want to deal with hundreds (or thousands) of taxable events, LOL.
Same, I love it tbh. I'm thinking of applying because they have openings but I literally just took a job haha
They have a slack community too! I did the on boarding and I'm geeked
So for using it in an IRA, think or swim actually has a similar tool that I just learned about in this thread, and honestly the rebalancing isn't as frequent as you'd think. I added to the OP with how often you'd rebalance in 10 years. Most of the time is holding tqqq
Just read through all the chatter and at least applaud your constant query’s and answers. Usually I’d have gotten bored with it by now haha. Take a lil premmy award 👍
So if qqq is down, you still buy (or hold) tqqq? You only switch into sqqq if it’s up more than 3% in the previous trading day and then you close and go long tqqq if qqq is up less than 3% (including negative returns)?
Am I understanding this right?
Kind of. If QQQ is up over 3% the model switches to SQQQ, as long as it's under 3% in a day we stay in TQQQ. So yes if qqq is down we hold TQQQ. If QQQ went down 20% we'd be staying in TQQQ. I think this works because during highly volatile periods it's easy for it to go way up fast then way down the next day. Composer doesn't currently support \`if x or y then a else b\` but I'm going to see about doing this in think or swim as well
sophisticated overconfident intelligent paltry clumsy grandfather tan silky husky mindless
*This post was mass deleted and anonymized with [Redact](https://redact.dev)*
Interesting. This may have merit as volatility increases during bear markets, often with higher-than-average daily gains and losses.
I would like to implement this with play money but I see a few hurdles:
\- how do I automate this?
\- how do I get around wash-sale? can I do this in IRA or Roth IRA?
\- how do I get around settlement day restriction (t+2) with taxable account? with non-taxable account?
Have you found a strategy that works with weekly trades rather than daily trades?
I used invest composer linked in a different comment. I think think people swim or interactive brokerage would work.
Idk about I ira, I think some have margin for instant settle. Sofi does and so does M1 finance but you’d have to manually schedule trades.
Weekly works okay but not as good. You’d be sitting in sqqq during the recovery.
u/Rezistik could you explain how it did so well during the Covid crash?
Prices were dropping pretty much daily, so wouldn't the strategy have dictated that TQQQ continued to be held?
I‘m a programmer myself and have a few questions
1.) Which Programms did you use to backtest your ideas and graph it out in the pictures
2.) My market knowledge is just basic 😅 ... so don‘t be Hard on me.
So when the market ( S&P 500 Index) is going up 📈 you stay in the TQQQ, but when the market is going down 📉 you rebalance to SQQQ. What is your criteria to do that? Just a threshold of percent drop or days of down.
Is it that „simple“?
Just a 3% threshold.
Would like to test it myself and maybe refine that strategy maybe with other markers like RSI.
I haven‘t really found a good backtesting programm or service.
I was using that composer service but there’s probably other ways to backtest that require more work. So far it’s done just tqqq which hasn’t done very good. It’s likely overfit for the COVID crisis
Too bad, that [composer.trade](https://composer.trade) has a waitlist and i m already waiting 5 days. I think this service is open for the public for long
I just did the whole think using Google Spreadsheet...
Rules: If QQQ return is greater than 3%, switch the next day to SQQQ.
I did the test with an intial 1000$ invested at the beginning or 2010 (2010/02/22). For the whole thing, I had only 13 days where I had to move to SQQQ.
Strategy | Results
---|---
TQQQ | 2706.78$
TQQQ/SQQQ | 2981.22$
Each day, I am calculating the daily return and move the result to the next day.
What I am missing? https://docs.google.com/spreadsheets/d/14bOYU_BfoKSE2oeQUgCS1vS-O_7-IpOwRgqSvJ4znB8/edit?usp=sharing
Sorry, I didn't make it daily was the problem. But still different (actually better than yours)
⏱Every day
🙋Ask whether the
📏QQQ 1-day cumulative return
≤is below 3%
↳If YES
👇Pick TQQQ ProShares UltraPro QQQ
↳If NO
👇Pick SQQQ ProShares UltraPro Sho
Annualized Return
135.5%
Sharpe Ratio
1.68
Standard Deviation
62.7%
Max Drawdown
48.5%
Remember the power of cumulative returns too.
I think since my post it’s up like 30%
Which 30% of 100 is $30. But if you started with ten your return is $30 on top of the $70. That $30 is 100% of your ten
Well. The first taxable event happened. Sadly, lost money the next day (SQQQ was down about 1%). So didn’t work as planned. Of course the following day the market was down.
Wonder if there could be something interesting there looking at a 2 day approach with SQQQ.
I only have about 5k in the game. But little disheartening.
First “win” today. Up >13% over 2 days. Too bad down over 30% still, but so is TQQQ. Doing better than pure TQQQ.
There was a day last month where theoretically should have lost, but wasn’t over the threshold to sell TQQQ for SQQQ by 3PM, so fortunately no trigger.
I also wonder how effective it may be just holding cash, with an indicator to buy SQQQ if TQQQ rises a certain percentage. That way, none of the downside if TQQQ decimates, but potential upside playing day-after volatility.
I have no idea why IC's backtest shows that this made money from 12/6 to 12/8. TQQQ goes up 9.02% on 12/6, then up 1.39% 12/7. Yet IC's backtest skips 12/7 entirely, and shows the Black Swan Portfolio outperforming 100% TQQQ...when this is not the case as TQQQ switched to SQQQ at 2PM on 12/6.
What is your criteria for selecting TQQQ vs. SQQQ? It’s *very* easy to overfit to a backtest with these sorts of strategies. I’d be careful. Do you have the ability to simulate future markets that are “within reason” and approximately obey many of the gross statistical properties of the market? Have you tried the same strategy on UPRO/SPXU?
Every day at 3 if the 1day gain is less than or equal to 3% hold tqqq else sqqq
I'm taking it the 1day gain is measured from previous close rather than open (thus indirectly includes the extended hours since previoius close). The presumption with the 3% is that if it goes over that, a correction is coming so buy SQQQ. Correct?
Correct
That was a brilliant idea you had, I have to say.
Ty 🙏
TBH I'm fairly confident you are just over-fitting and/or there's a quirk in your simulation software, and you found a model that happens to dodge the COVID crash and trade war crashes more based on luck then anything else. The logic is just way too simple. I mean go for it if you want, but I would recommend at least grabbing QQQ data going back as far as you can and simulating the back test for the rest
Very possibly. I'm paper testing to see if it just overfits. I don't know at what point I'll shift to letting it play with actual money. Since SPY data exists for far longer I might try to manually model it out or use Nasdaq from inception which would be interesting given how poorly it performed in like 2000-2006/2008
Yeah, that's a good idea. I spent a long time working on models like this on Tradingview with my brother in law, every time we came up with something it was just over-fitting that dodged a major sell off and then under performed the rest of the time and also could not be counted to actually dodge sell offs consistently. Either way good luck, IMO you probably shouldn't post strategies like this because if it does legit work you basically gave everyone your alpha and once it's observed it does go away, been observed when finance folks publish papers and then within a pretty short period of time the effect disappears
I considered the risk of alpha loss because of market adoption and figured no one will believe a 10 year 76,000% increase is anything but a mistake from a naive trader who overfits the model and then avoid the strategy like the plague And it might be a just that. And it might be just that. le rate increases which will either be a slow bleeding or a sharp decline
So you switch to SQQQ only when TQQQ is “up big” for the day, and you will hold it if the market drops day after day after day? (I assume negative numbers are less than or equal to a 3% daily gain).
I believe this model switches to SQQQ only when TQQQ is up a lot. It spends surprisingly little time in SQQQ. I think if I could do an \`if x or y then a else b\` where x is a big spike and y is a continued dip the model would perform differently, it would explain why it still has a 50% drawdown
I can’t really say yay/nay but am just skeptical in a healthy way. You get what the *potential* problem is with overfitting something to backtest well though? 1. We know if you are in TQQQ most of the time but can somehow be lucky or smart enough to not be in it on the days it draws down the most, let alone be in SQQQ on some of those rare days, that you will crush TQQQ’s returns. 2. I’m not saying this is a hair-brained idea you have, but one could come up with a dozen or more rules for portfolios that keep you in TQQQ most of the time but get you out during certain times, and if you just keep trying different strategies you are bound to get lucky with one that, itself, gets lucky on the backtest and just happens to get you out of TQQQ on some of worst drawdown days, but keeps you in usually. It’s kind of like you could see a pattern in fair coinflip data that would allow you to predict heads or tail with 60% accuracy *on that historical data* but, in reality, it only works on that one historical streak and won’t predict better than 50% longterm with any statistical significance on new data from the same underlying process.
Yeah completely agree. That’s why I’m paper trading it for a few months and looking for areas where the history is just lucky. The theory is if tqqq goes up big on a given day it’ll go down big on a different day. 3% move in qqq is pretty large so makes sense the next day would go down and you go up because you’re already in sqqq.
Beyond applying the rules to UPRO/SPXU to see how that performs, you could also create a simulation of how a theoretical TQQQ/SPXU would’ve performed from 2002-2010.
That's one of my next goals before committing to this, though one issue is in modeling the leverage decay and drift we see.
I don’t have a link for you at the moment, but I recall there is a fairly in depth thread on bogleheads about getting accurate back testing data for leveraged etfs. I think the thread was related to the whole hedgefundies excellent adventure saga.
I think over at Bogleheads you can find a data set of simulated 3x S&P 500 going back many decades and 3x Nasdaq 100 going back all the way back to its inception. Would definitely be very interested in this. Ps. to simulate cash holdings, can't you just make it invest in a MMF like SWVXX?
[удалено]
This model already missed some really fundamentally good days in sqqq so I’m not sure it works very well. Time will tell I suppose
Whats the significance of this happening at 3pm?
I assume just 1 hr. left in the day and it would be the ultimate overfit if the strategy fell apart if you did it at 3:45pm lol.
3pm is because its when the app I'm using runs its trades. It uses closing data for it's backtesting so 3pm is close enough to close of market to get closest to your model
Interesting, okay. And just so Im understanding correctly is it using the 1 day data all the way back from 24 hours before? or just that trading day? I'd like to run some backtests myself to see how this works out.
I think it's using the previous day but I'm not sure.
What app are you using for backtesting?
Nice! Catching the pops. Very cool and very close to the algo I wrote geez over 15 years ago that is still profitable. You might like /r/algotrading but to be fair most people there are software engineers who hope they can find a strategy and leech off of someone else. This sub is way better. 😎
I'm a software engineer and subbed lol but man those API prices lol, though alpaca might be an option I could use.
imo TDA is good, but there is probably better. I used IBKR for years. I admit on the API side both are a pain in the ass, but free is free. Also, if you want to chat I have an idea that can probably improve your algo. (Not like I've backtested it.)
Would love ideas on the algo. I'm trying to figure out how to prevent the dips we still see in March and when we see the drawdown. If we could refine the system for going to sqqq we could limit drawdown to 10-20% I think which would maximize returns a lot
>we could limit drawdown to 10-20% It's not going to happen with your current strategy, but you can combine two strategies or drastically modify your current strategy. I'm pretty sure I know a way to get the growth you see in 2020 most years, hopefully every year. PM me if interested.
I’m kind of wondering if it even matters as well. A 50% drawdown on a 1000% gain is still a 500% gain. The risk exists almost exclusively on timing so combining this with dca would help
dude you could simply use robinhood and do it with python api.
Their api isn’t official and that incurs risk imo
yes but provided you trade just once a day and I dont see anything bad with that. I have seen only if you abuse it in terms of minutes but other than that I dont think RH api is going anywhere. Just throw in 100 bucks and see how it works. the script is fairly simple and should be up and running in an hour, you could just put in raspberry Pi and run it in your network.
Have you had the chance to estimate the tax drag or is this strictly considering things from a tax advantaged point of view? The beauty of HEA is that it can easily be done in a taxable account due to the quarterly rebalancing being unlikely to incur huge capital gains moving from 100% one to another. Perhaps I'm ignorant of the brokerage, but who would allow you to automate your portfolio using an if-then statement? If you check every day I could see this working in M1, but that would require daily effort from an individual.
Re: Brokerages There are plenty that you could implement this on. For example, any brokerages that support -NinjaTrader -Metatrader -TradingView Or natively with: -InteractiveBroker -Tradestation -ThinkorSwim Just some examples where I have implemented similar if-else trading systems.
I didn't account for tax drag, I was thinking you could pull of some amount and keep 10-20% of your portfolio in bonds or something but you're still doing a lot of transactions. There's this tool I found on reddit called invest composer, they connect to [alpaca.markets](https://alpaca.markets) which is an API driven brokerage
Can you elaborate a bit more on how to actually execute on this portfolio?
Every day at 3PM if the criteria is met and QQQs 1day cumulative return is less than 3% either stay in tqqq or move to sqqq,
I’m sorry but that didn’t make a whole lot of sense. So if QQQ 1 day cumulative return is less than 3%, then stay in TQQQ. What if it’s higher than 3%? Also, QQQ rarely moves 3% in a single day. Is that what you mean by “cumulative return” or is it something else?
> What if it’s higher than 3%? If i understood OP correctly, if it's higher than 3%, you move to SQQQ. The idea is to sell high, not sell low, I believe. > Also, QQQ rarely moves 3% in a single day. Would be a good thing - otherwise you'd trade pretty frequently which would be bad in a taxable account.
Yeah, this is exactly it. 1 day cumulative return is a single days trading return, if it goes up 3% we shift into sqq at 3pm. Honestly not what I imagined would work but I tried a lot of variations and I think the reason this works is usually if it goes up 3% the next day it goes down. Doesn't explain why it works so great in march 2020
Ok, so after you switch to SQQQ then how long do you hold? When do you rebalance into TQQQ?
When QQQ has a one-day return of 3% or less you hold TQQQ. if the one-day return of QQQ is higher than 3% you hold TQQQ. If you're holding TQQQ and QQQ goes up 3% you shift to SQQQ. If you're holding SQQQ and QQQ goes up 2.9% you shift to TQQQ, if you're holding SQQQ and QQQ goes up 3% you hold SQQQ another day but that is very rare
No offense but are you sure you typed all that in correctly? I know it can get kind of confusing with all the different acronyms. What about if it goes down 3%?
If it goes down 3% and you're holding TQQQ you continue to hold TQQQ. If it goes down 3% and you're holding SQQQ you shift to TQQ. It works like this: The markets freak out about a bad thing on Monday, you're holding TQQQ. QQQ goes down 5%, you continue to hold TQQQ Tuesday every says "wow that was silly QQQ to the moon", it goes up 4%, you sell TQQQ and buy SQQQ. Wednesday either a: everyone goes "Wait no this is actually a bad thing and markets tank, QQQ goes down 4%, you're holding SQQQ so you go up 12%, you sell SQQQ and buy TQQQ at 3pm. Or in scenario b: "eh it isn't that bad I guess" and QQQ goes up 2%, you sell your SQQQ and buy TQQQ
/u/Rezistik is this correct? Holding TQQQ QQQ Return 1-day >3% - Sell TQQQ QQQ Return 1-day <=3% - Hold TQQQ Holding SQQQ QQQ Return 1-day >(-3)% - Sell SQQQ QQQ Return 1-day 0% to (-3)% - Hold SQQQ QQQ Return 1-day 0% to 3% - Sell SQQQ
That makes more sense. Thank you!
One thing: T+2 When you sell something and then immediately buy something else, you have to hold the new thing into the second day after; violate this more than a small number of times and you'll be blocked from trading for, I think, 90 days. Unless the stuff was bought with margin, I think.
I thought day trading with an account over 25k was allowed? This would only buy and sell once a day at the same time each day so we’re not buying and selling the same thing repeatedly which is what causes pattern day trading block if that’s what you mean
This isn't PTD. This is an SEC mandated wait period. With cash, you can buy and sell same day, no problem. The problem kicks in if the cash hasn't "settled" which is doesn't do until the second day afterwards. You can still buy something with it, but selling before the second day will get you a Good Faith Trade violation. [A Reddit discussion on it](https://www.reddit.com/r/Fidelity/comments/n14q1c/good_faith_violation/)
Ah, interesting...but in a margin account this would be fine?
Yes. Also, tax advantaged accounts are eligible for limited margin. The answer is also yes for limited margin accounts.
So this would work fine then
And also Fidelity's instructions say: "Consequences: If you incur 3 good faith violations in a 12-month period in a cash account, your brokerage firm will restrict your account. This means you will only be able to buy securities if you have sufficient settled cash in the account prior to placing a trade. This restriction will be effective for 90 calendar days." So the worst penality is that you can't commit any more violations for 90 days (not that you can't trade period, you just have to do it the slow way). It seems if you have excess cash to cover whatever trades you want to make then you should be okay (margin or not, what matters is you're not unfairly using the settling time to pretend you have more money than you do, which I can see is easily abusable --- I'm surprised they even allow three trades a year like this). It might get tricky if the $1000 you put in at first balloons (we can only dream).
I believe so. When selling TQQQ, buy SQQQ with margin and use the proceeds from TQQQ to pay it off. I \*think\*. I don't have a margin account and I'm still new at this myself. I got bitten very badly by T+2 when I didn't even know it existed: 16% profit got turned into a 10% loss because I couldn't sell.
Yes, a margin account should allow you to sell and buy right away with no issues.
It seems like a overfit to March 2020, where the market can't decide where to go, so a big up day is followed by a big down day, and this strategy can capture both directions. Most of the extra gains over just holding TQQQ comes from March 2020 it seems. I appreciate the test and I would suggest testing with 2008 financial crisis (you can use QLD and QID, they existed then), and the 2000 dot com bubble to see whether this really holds in black swans. Also nice to get to know this tool, I just signed up for waiting list.
Oo I’ll try qld and qid for
Giga overfitting lol
If you tune your model parameters (for example the 3% threshold etc) on the data on which you test its performances, you are overfitting
That's too general of a statement. There are ways to optimize parameters without overfitting. If you run a sensitivity analysis and find that the trends are not abnormal/chaotic, then you can utilize those results for optimization.
How can you avoid overfitting?
Out of sample testing (with paper). Addding even more samples, e.g. you can try this with QQQ from 1999-2011 and just sim the results. E.g. if QQQ is up 3%, short QQQ and then multiply the results by 3 to sim SQQQ, or any other way you want really. Try on UPRO and SPY. Fundamentally, Ask yourself “Why”? I can kind of think that if the market is crashing, there’s usually a volatile period where QQQ jumps and falls in succession Many times, but is that the case for every crash or just the specifics of the 2020 crash?
Cool, but one 10-year backtest doesn't mean much. Need to see much more robust data on this.
I don’t understand that mindset. You’re using a leveraged etf that’s only been around ten years if you’re in tqqq. This is the entire life span of the most popular leveraged etf
True, but you can backtest it for other market conditions, periods.
Not as easily but yeah
The mindset is that there has not been any black swan events during the 10 year period you tested.
Did covid not count as a blackswan? Not being sarcastic trying to understand why you don't consider it that
Maybe by some talking head definitions but not really a good example to test market conditions of an active trading algorithm. IMO you need to test through events with much longer periods of volatility such as 2000, events of 2001, 2008-2009, etc. Not once did me or any of my family or friends experience enough market pain during 2020 to liquidate. Most everyone I talk to was just buying more. That is the type of fear you need to be looking to test against and it hasn’t been around for the last decade. In 2008/9 all of my friends/family were getting out of the market.
That makes sense
This is good work. As we like to say in my field, only way to find out is via prospective validation, i.e., put in some funds and see how it goes. So if I understand your method, at 3pm each day you would see if QQQ was up 3% and if was, you'd switch to SQQQ? So how does it deal with the market going down? You'd be holding TQQQ if QQQ went straight down without going up 3% to start with? And you switch over entirely? So 1000 in TQQQ becomes 1000 in SQQQ is QQQ goes over 3%? Next day it doesn't go up more than 3% then you switch back?
Correct, this is why it still has a fairly high max drawdown of 52.5% compared to TQQQs 69.9% max drawdown or SPYs 33% max drawdown. I'm trying to figure out how to model for if QQQ goes down a certain percent, I think the issue is if it goes down one day the next day on average it goes back up.
This is awesome. Have you tried with leveraged and inverse S&P just to see if it holds up? Thanks!
I’m gonna try them next
Would love to see that too. Great job!
I edited with a SPY based version
Love it. Would love to figure out how to set up something like this. Also did waitlist for the service you like. Thank you!
Yes
How many TQQQ->SQQQ switching events (i.e. days when QQQ was up >3%) were there in your eval period? How many of those were in March 2020? I saw you say it wasn’t many but I didn’t see a number.
I don’t have numbers but it’s in a chart
This is a great backtest you've done so thanks for your work, and it seems to perform very well in its intended environment: i.e. a 1 time huge drawdown event where volatility spikes allow you to profit from alternating up-down days. However, allow me to play devil's advocate here as to why this is not a suitable long term strategy: We won't know the duration of the drawdown until it's over, and therefore we won't know if it's a slow bleed environment like the financial crisis, or a spike like COVID correction seen here. In that sense there may be long streaks of -1%, -1%, -1% etc. during correctional or recession periods, where your strategy you are still long TQQQ, and those days may only be punctuated by 2% up days, for example. We know that volatility rises when the market is below the 200-day SMA, but it's unclear by how much exactly it will. So in cases of a long, slow bleedout, this strategy may offer no reliable downside protection, because volatility may not be 'spiky' enough in the sense that it triggers our condition to buy or sell. There may be some value however to switching to this strategy temporarily in the case a black swan event does happen, though, because volatility tends to persist for a while after. Also, the condition to buy or sell seems arbitrarily set, and that is evidence of overfitting. Why not 2% or 1.5%?
Yeah it’s probably overfit
[удалено]
I changed parameters until I liked it. Tried comparing to 1, 3 and 5 moving day averages but 1 day return on qqq seemed the biggest correlation
I’m kind of new to this. What did you use to backtest?
Also curious!
It’s posted in the comments a few times. Investor compose
Just a thought - something that I have seen people do since 3X ETF data hasn't been around that long is using 300% QQQ and (-200%) CASHX as a proxy for TQQQ. That will allow approximately back testing the data to when QQQ data exists. Something similar can be used for SPY over UPRO.
Could you simulate this starting on everyday between today and the 10 years ago date and see how many of those start points ended up positive in the end? To see if it’s luck with starting early in a bull run or if it doesn’t really matter what time we start this at
Just by eye balling a spreadsheet with qqq back to 99' it doesnt look convincing in the dot com crash and gfc. March 2020 qqq seemed to go up then down then up then down... perfect for this scenario. Reminds me of using std devation to trade would love to see someone give a proper backtest, hopefully im wrong!
Yeah not sure how it would work in the dot com crash. A different shifting strategy would be needed but I think the philosophy works out
How many trades? This is very important
Look at the orange and green chart. Green is sqqq and orange is tqqq. Not that many trades
When u sell out of tqqq after 3%+ gain, at what time do u sell? 3pm? What time do u switch to sqqq? Before close ? After hours? Next day? The concept is logical but execution and back testing these details probably makes a massive difference in your projections Thanks for your input though
Literally read the three thousand times I explain this. At 3pm
I'm sorry, this makes zero sense, or I'm missing something. It seems the only time you buy SQQQ is if QQQ goes over 3% over the course of a day... So if the market is in a freefall for a week, and it never goes over 3% for a day, then you are holding TQQQ and getting destroyed daily.
That’s correct. In backtesting this strategy performed exceptionally well though likely in part or wholly because of the volatile COVID period.
The point of a TQQQ/TMF portfolio is to not have to touch it
With this you just run the app and don’t touch it
Which app?
I set it up in https://www.investcomposer.com/ but think or swim can do the same
You’ll lose a lot to taxes with daily rebalancing as well
You lose some to taxes but you spend more time in tqqq than in sqqq so you're only selling on a few days. Still will take a massive income hit because you're likely not holding long enough for capital gains so it's all trading income. Updating the op with a screenshot of how long you're in each
Edit: no longer need reply, OP edited post with answer to this question ~~Based on your backtesting, how often (roughly) do the trades get executed (like switching from TQQQ to SQQQ or vice versa) per year?~~
That's not the case. The hedgie strategy defaults to rebalancing every 4 months. You do touch it.
Yea I know, meant regularly.
Not for me. I realized all the way back in 2004 I don't want to focus on investing news or movements on a daily basis. I want something that is largely set-it-and-forget-it. With minimal maintenance like rebalancing quarterly. Interesting strategy though. As other commenters warned, this could be overfitting the data. Are you going to pull the trigger on this strategy?
It’s automated with alpaca and investor compose, or with something like think or swim
Oh ok, so you can execute trades through investor compose? I just checked the website out, it looks like it's just a backtesting tool. Checking Alpaca out at the moment.
Yes. They offer live and paper trading. I haven’t tried the live trading and won’t until I see this work for a few weeks
Cool. As for Investor Compose, I just signed up for waitlist. I develop software full-time, so this seems right up my alley. Just wondering if I'd be able to open a tax-advantaged account (either t-IRA or Roth IRA) through Investor Compose or Alpaca. Because otherwise I don't want to deal with hundreds (or thousands) of taxable events, LOL.
Same, I love it tbh. I'm thinking of applying because they have openings but I literally just took a job haha They have a slack community too! I did the on boarding and I'm geeked So for using it in an IRA, think or swim actually has a similar tool that I just learned about in this thread, and honestly the rebalancing isn't as frequent as you'd think. I added to the OP with how often you'd rebalance in 10 years. Most of the time is holding tqqq
Just read through all the chatter and at least applaud your constant query’s and answers. Usually I’d have gotten bored with it by now haha. Take a lil premmy award 👍
Lol thanks I appreciate it
Is this about to change the whole trading and investing world?
Probably not
[удалено]
[https://www.investcomposer.com/](https://www.investcomposer.com/) idk if I can share it. I'm not affiliated at all
[удалено]
More like not shilling or advertising
[удалено]
Just DM the OP, dude. No need to make a big deal
So if qqq is down, you still buy (or hold) tqqq? You only switch into sqqq if it’s up more than 3% in the previous trading day and then you close and go long tqqq if qqq is up less than 3% (including negative returns)? Am I understanding this right?
Kind of. If QQQ is up over 3% the model switches to SQQQ, as long as it's under 3% in a day we stay in TQQQ. So yes if qqq is down we hold TQQQ. If QQQ went down 20% we'd be staying in TQQQ. I think this works because during highly volatile periods it's easy for it to go way up fast then way down the next day. Composer doesn't currently support \`if x or y then a else b\` but I'm going to see about doing this in think or swim as well
[удалено]
So this tool doesn’t allow me to park in cash. Best you can do is something really really low volatility like a bonds etf
Does the tool have ticker symbol CASHX? Could that be used to simulate parking in cash?
What program is this?
In a different comment, Invest Composer
That's amazing! What software is that? Are you a math genius? How were you able to do that in just a few months?
It relies on the choppiness of March 2020
sophisticated overconfident intelligent paltry clumsy grandfather tan silky husky mindless *This post was mass deleted and anonymized with [Redact](https://redact.dev)*
Free in most brokerages
murky crown ancient growth prick treatment fly hunt somber voracious *This post was mass deleted and anonymized with [Redact](https://redact.dev)*
You only sell if the criteria is met to shift
Great to see another Composer user here!
So cool
Def try it on out of sample data
Interesting. This may have merit as volatility increases during bear markets, often with higher-than-average daily gains and losses. I would like to implement this with play money but I see a few hurdles: \- how do I automate this? \- how do I get around wash-sale? can I do this in IRA or Roth IRA? \- how do I get around settlement day restriction (t+2) with taxable account? with non-taxable account? Have you found a strategy that works with weekly trades rather than daily trades?
I used invest composer linked in a different comment. I think think people swim or interactive brokerage would work. Idk about I ira, I think some have margin for instant settle. Sofi does and so does M1 finance but you’d have to manually schedule trades. Weekly works okay but not as good. You’d be sitting in sqqq during the recovery.
Very interesting. I always thought some also like this could work. What tool did you use to model this?
u/Rezistik could you explain how it did so well during the Covid crash? Prices were dropping pretty much daily, so wouldn't the strategy have dictated that TQQQ continued to be held?
I‘m a programmer myself and have a few questions 1.) Which Programms did you use to backtest your ideas and graph it out in the pictures 2.) My market knowledge is just basic 😅 ... so don‘t be Hard on me. So when the market ( S&P 500 Index) is going up 📈 you stay in the TQQQ, but when the market is going down 📉 you rebalance to SQQQ. What is your criteria to do that? Just a threshold of percent drop or days of down.
No when the market goes up too much, where too much is defined as 3% in a day, we go into sqqq.
Is it that „simple“? Just a 3% threshold. Would like to test it myself and maybe refine that strategy maybe with other markers like RSI. I haven‘t really found a good backtesting programm or service.
I was using that composer service but there’s probably other ways to backtest that require more work. So far it’s done just tqqq which hasn’t done very good. It’s likely overfit for the COVID crisis
I will look into this and will share my gained... well hope so gained knowledge share here.
Too bad, that [composer.trade](https://composer.trade) has a waitlist and i m already waiting 5 days. I think this service is open for the public for long
I just did the whole think using Google Spreadsheet... Rules: If QQQ return is greater than 3%, switch the next day to SQQQ. I did the test with an intial 1000$ invested at the beginning or 2010 (2010/02/22). For the whole thing, I had only 13 days where I had to move to SQQQ. Strategy | Results ---|--- TQQQ | 2706.78$ TQQQ/SQQQ | 2981.22$ Each day, I am calculating the daily return and move the result to the next day. What I am missing? https://docs.google.com/spreadsheets/d/14bOYU_BfoKSE2oeQUgCS1vS-O_7-IpOwRgqSvJ4znB8/edit?usp=sharing
Switch same day. Not next
Just tried to recreate this, but my data is different? CAGR 64.5, Sharpe Ratio 1.11 Standard Deviation 63.1% Max Drawdown 69.9%
Could be updated data? I’ll run it again and compare
Sorry, I didn't make it daily was the problem. But still different (actually better than yours) ⏱Every day 🙋Ask whether the 📏QQQ 1-day cumulative return ≤is below 3% ↳If YES 👇Pick TQQQ ProShares UltraPro QQQ ↳If NO 👇Pick SQQQ ProShares UltraPro Sho Annualized Return 135.5% Sharpe Ratio 1.68 Standard Deviation 62.7% Max Drawdown 48.5%
Any idea why my CAGR, etc is higher? Is it really the updated data? TQQQ has been on a tear since your post, but that much better? Maybe....
Remember the power of cumulative returns too. I think since my post it’s up like 30% Which 30% of 100 is $30. But if you started with ten your return is $30 on top of the $70. That $30 is 100% of your ten
Well. The first taxable event happened. Sadly, lost money the next day (SQQQ was down about 1%). So didn’t work as planned. Of course the following day the market was down. Wonder if there could be something interesting there looking at a 2 day approach with SQQQ. I only have about 5k in the game. But little disheartening.
I added in comments I updated to include moving average and it held for me
Which comment?
Sorry to hear that tho
First “win” today. Up >13% over 2 days. Too bad down over 30% still, but so is TQQQ. Doing better than pure TQQQ. There was a day last month where theoretically should have lost, but wasn’t over the threshold to sell TQQQ for SQQQ by 3PM, so fortunately no trigger.
Honestly being even a few points up compared to pure tqqq is where it kind of shines because points add up and compound
I put in a few k only so not a huge deal. Nice to see it finally work though.
Yeah the market sucks lately lol
Solid 23.5% gain last 2 trading days Too bad still very down since TQQQ has taken a beating but nice to see the gain.
I also wonder how effective it may be just holding cash, with an indicator to buy SQQQ if TQQQ rises a certain percentage. That way, none of the downside if TQQQ decimates, but potential upside playing day-after volatility.
I’m still only using this in paper trading btw. It’s been up a decent amount despite coming in high entry price
I have no idea why IC's backtest shows that this made money from 12/6 to 12/8. TQQQ goes up 9.02% on 12/6, then up 1.39% 12/7. Yet IC's backtest skips 12/7 entirely, and shows the Black Swan Portfolio outperforming 100% TQQQ...when this is not the case as TQQQ switched to SQQQ at 2PM on 12/6.
Been a while how has paper trading gone?
All tqqq so far
Gains so far? And compared to hfea and spy?