3 SuperTrend + Support and Resistance Level Strategy for ThinkorSwim

R

RConner7

Member
VAL Autotrade tuned and completed https://tos.mx/ARocTKB
I'm going to find the best atr combos for 4 other stocks like it and trade all 5 tomorrow. Its insane how good val performs at 60% win with a average win 2 times higher then average loss. I'm going to exploit this while I can.

edit MFA setup https://tos.mx/trIY5P6

very nice. I wish there was a good way to dynamically set the atr settings per stock. It would be ideal to find the answer as to ‘why’ these stocks perform best at these settings. I’m sure the best settings constantly change with market conditions but if we could answer that question, we could have a really promising strategy. I’m sure that question of ‘why’ applies to most other strategies as well.

looks like you are even going as far as even changing the average type per SuperTrend. Interesting. Typically hull should respond quickest and be weighted towards current price action. If that is working for you keep going.

love seeing more eyes and thoughts on it; can only help improve it.
 
wtf_dude

wtf_dude

Active member
@RConner7 The dynamic moving per stock is pretty much exactly what Tradestops.com was developed for. That's pretty much all it does to my knowledge.
 
J

JoshF

New member
I have not dug into the code of this strategy yet, but I am trying to code something very similar based on a MTF TMO, @RConner7 or @YungTraderFromMontana did you have any issues with the higher timeframe repainting when looking at the lower timeframe chart affecting your buy/sell signals and if not, how to overcome this issue? I am running into this issue on mine.
 
YungTraderFromMontana

YungTraderFromMontana

Well-known member
I have not dug into the code of this strategy yet, but I am trying to code something very similar based on a MTF TMO, @RConner7 or @YungTraderFromMontana did you have any issues with the higher timeframe repainting when looking at the lower timeframe chart affecting your buy/sell signals and if not, how to overcome this issue? I am running into this issue on mine.
An mtf will inherently have that issue, no way around it.
 
Midtown Mo

Midtown Mo

New member
This is really good work. I took a look at how this strategy has performed over the last 30 trading days using a 2m time interval for each of the 30 stocks in the DJIA. Boeing (BA) was the best performer by far. The worst was UnitedHealth Group (UNH). 18 stocks showed a profit using the strategy compared to 12 showing a loss. There is a strong correlation between profits and beta. The higher the beta, the higher the profit. Of the 9 stocks with betas >1.2, 7 showed a profit with an average of +$1,800. Of the 10 stocks with a beta <0.9 only 4 were profitable and the average was -$208. Boeing has the highest beta by far of any DJIA stock. Maybe something to consider when screening for other stocks to apply this strategy. When looking at the Boeing trades, the strategy made about the same amount of profit from long and short trades. Boeing stock during this time was -41%. So to turn such a profit from day trading Boeing would have been huge. No position was held for more than 54 minutes.
 
R

RConner7

Member
This is really good work. I took a look at how this strategy has performed over the last 30 trading days using a 2m time interval for each of the 30 stocks in the DJIA. Boeing (BA) was the best performer by far. The worst was UnitedHealth Group (UNH). 18 stocks showed a profit using the strategy compared to 12 showing a loss. There is a strong correlation between profits and beta. The higher the beta, the higher the profit. Of the 9 stocks with betas >1.2, 7 showed a profit with an average of +$1,800. Of the 10 stocks with a beta <0.9 only 4 were profitable and the average was -$208. Boeing has the highest beta by far of any DJIA stock. Maybe something to consider when screening for other stocks to apply this strategy. When looking at the Boeing trades, the strategy made about the same amount of profit from long and short trades. Boeing stock during this time was -41%. So to turn such a profit from day trading Boeing would have been huge. No position was held for more than 54 minutes.

Thank you for that input! thats helpful for sure.
 
Midtown Mo

Midtown Mo

New member
I did more backtesting of the strategy on Boeing to see if the last 30 days were an aberration and to a certain extent it was. I went back almost a full year, to April 26, 2019 using the 2 minute time period. Through the end of trading today the strategy would have resulted in 2,117 trades netting a profit of $12,721. From the start of that time period through Feb 25, the cumulative profit was +$3,253. Since then it has added +$9,468. Overall the strategy netted 128 profitable days to 120 unprofitable days. The average profit day was +$252 and the average loss day was -$163. Across the entire time period the number of long and short trades were nearly equal, but long trades made 50% more per trade than short trades. Also the strategy was most profitable when trades began between 11am and 1:58pm. The strategy was profitable each day of the week except Thursdays. The most profitable day was Wednesday, followed by Tuesday. The first half hour on Mondays was not profitable but Fridays after 2pm were very profitable.
 
R

RConner7

Member
I did more backtesting of the strategy on Boeing to see if the last 30 days were an aberration and to a certain extent it was. I went back almost a full year, to April 26, 2019 using the 2 minute time period. Through the end of trading today the strategy would have resulted in 2,117 trades netting a profit of $12,721. From the start of that time period through Feb 25, the cumulative profit was +$3,253. Since then it has added +$9,468. Overall the strategy netted 128 profitable days to 120 unprofitable days. The average profit day was +$252 and the average loss day was -$163. Across the entire time period the number of long and short trades were nearly equal, but long trades made 50% more per trade than short trades. Also the strategy was most profitable when trades began between 11am and 1:58pm. The strategy was profitable each day of the week except Thursdays. The most profitable day was Wednesday, followed by Tuesday. The first half hour on Mondays was not profitable but Fridays after 2pm were very profitable.

Wow - what are you using to get these stats? pulling the backtesting data for each 30day section, uploading it into a dataset for analysis in PowerBI or something?
 
R

RConner7

Member
@Midtown Mo - when you did you analysis on the BETA were you using the running intraday beta value or just using the beta posted at the beginning of the trading day?

I'm seeing a similar correlation that you were able to uncover. When beta is higher than like 1.2 gains are more realized. sub 1... nearly nothing but losses.

Did you use anything to come up with this correlation or just trial and error?
 
Midtown Mo

Midtown Mo

New member
@RConner7 - Yes, I pulled day for each 30day section and created a database in Excel after running a macro to clean it up. On the Beta, I found a site that published the beta for leading stocks. I thought about Beta after watching how the strategy worked during the trading day today. Since orders are triggered after a number of consecutive up or down candles, it seemed to me that the more variation in the stock price, the more successful the strategy could play out. I thought about intraday Beta but haven't run it yet. Also, since your strategy essentially stops trades after 3pm, it would be better to use an intraday beta that matches that time period. But right now that would take me a lot of effort and I'm not sure the juice is worth the squeeze. What I did though was to look at a proxy for beta over the last year, 30 trading days and 10 trading days by determining the standard deviation of the % change of the daily closing prices across each of the 30 stocks in the DJIA. For the past 30 days, there is very strong correlation between higher standard deviation (i.e. beta) and strategy profitability. However when I just looked at the last 10 days, it broke down a bit (two of the five stocks with the highest standard deviation had a loss). I want to expand this to the S&P 500 to see how this works on a larger number of stocks.
 
L

LenTrading

New member
I am kind of new to using ToS and familiar with loading scripts in the studies, but when I enter your code in and save it, it is not loading when I add it to my studies for that screen. I copied all of the text you had entered. Can you please advise if I did something incorrect? Thank you
 
R

RConner7

Member
I am kind of new to using ToS and familiar with loading scripts in the studies, but when I enter your code in and save it, it is not loading when I add it to my studies for that screen. I copied all of the text you had entered. Can you please advise if I did something incorrect? Thank you

welcome aboard.

When you add the code, make sure you add it to a strategy and not as a study. The strategy tab is on the same window as the edit studies but it's the 2nd tab over. Strategies have AddOrder code lines that will not function as just a study. Hope this helps.
 
Midtown Mo

Midtown Mo

New member
Just ran the strategy for each of the stocks in the S&P 500 based on the 2 minute time period for today's trading, April 21. Only 28% of the stocks had a profit using the strategy (but that was alot better than the market overall since only 6% of the S&P 500 stocks closed higher on the day). I was able to get today's high and low prices for each stock over the full day of regular trading. By dividing the high into the low you get the percentage range for each, which I am using as a proxy for beta. The 100 stocks that had the highest "beta" were more likely to be profitable. Here is how each group of 100 stocks fared ranked on the "beta": 1-100 (highest beta) = 46% profitable, 101-200 = 39%, 201-300 = 21%, 301-400 = 20%, 401-500 (lowest beta) = 14%. The correlation of profits to "beta" was positive, but only +0.17, which is not that strong. I actually used the strategy myself today paper trading six stocks. I was able to post a profit and actually did a little better than the strategy by locking in some profits earlier than the strategy allows.
 
R

RConner7

Member
@Midtown Mo This is beyond impressive work. Based on your paper trading... did you trade stocks that were in that 1-100 beta range? Were all of those green? Any recommendations that you could see based on your paper trading?

Which 6 did you trade? what was your over win rate?

Sorry for all the questions but sounds like you are on to something here.
 
Last edited by a moderator:
Midtown Mo

Midtown Mo

New member
@RConner7 On Tuesday I traded MPC, CFG, PVH, BA, CMA and HES. Those had a higher 'beta' over a recent time period. I also paper-traded six today but the results weren't so good. Today I traded HCA, AMD, HP, CMA, PXD and FTNT because they were the six highest 'beta's during Tuesday's session. Only 2 were profitable per the strategy today and not enough to overcome the losses on the other four. But I ran the strategy on all the S&P 500 again after today's trading. Only 27% were profitable per the strategy, compared to 82% that closed higher today vs. yesterday). But, like yesterday, today's highest-beta stocks were more likely to be profitable. Here is how each group of 100 stocks fared ranked on the "beta": 1-100 (highest beta) = 51% profitable, 101-200 = 27%, 201-300 = 26%, 301-400 = 22%, 401-500 (lowest beta) = 8%. In fact, each of the nine highest-beta stocks on the day were profitable (and 16 of the top 20). So the trick may be to find stocks with the largest change in the first 30-60 minutes and try to use the strategy against them the rest of the day. I may backtest that and see how it turns out.
 
E

ext99k

Member
Hey thanks for sharing this. I tried to add it as a strategy and indicator but the FloatingPL isn't updating for backtesting, any help? Thanks a lot
 
D

diazlaz

Well-known member
2019 Donor
VIP
@RConner7 On Tuesday I traded MPC, CFG, PVH, BA, CMA and HES. Those had a higher 'beta' over a recent time period. I also paper-traded six today but the results weren't so good. Today I traded HCA, AMD, HP, CMA, PXD and FTNT because they were the six highest 'beta's during Tuesday's session. Only 2 were profitable per the strategy today and not enough to overcome the losses on the other four. But I ran the strategy on all the S&P 500 again after today's trading. Only 27% were profitable per the strategy, compared to 82% that closed higher today vs. yesterday). But, like yesterday, today's highest-beta stocks were more likely to be profitable. Here is how each group of 100 stocks fared ranked on the "beta": 1-100 (highest beta) = 51% profitable, 101-200 = 27%, 201-300 = 26%, 301-400 = 22%, 401-500 (lowest beta) = 8%. In fact, each of the nine highest-beta stocks on the day were profitable (and 16 of the top 20). So the trick may be to find stocks with the largest change in the first 30-60 minutes and try to use the strategy against them the rest of the day. I may backtest that and see how it turns out.
thanks @Midtown Mo, very cool; can you write a post/tutorial on how you are approaching this backtest, I am sure the members of this forum will appreciate it and will spark a discussion on backtesting and system testing approaches. thanks again!
 
Midtown Mo

Midtown Mo

New member
Right now OnDemand is updated through Monday, April 20. I backtested the strategy for that day. 57% of the S&P 500 stocks that day were profitable using the strategy. We've seen that stocks with higher betas performed better using the strategy. I have yet to see a strong correlation between the stocks with the highest variation yesterday carry over to strong performance using the strategy the next trading day. So I tested if you could evaluate the performance of the strategy on stocks that had the biggest move in the first hour of the trading day, to see how the strategy performs for the remainder of the day. So far I've only done this for the S&P 500 for April 20. The good news is there is evidence that this approach helps to find profitable stocks. Remember 57% of the S&P 500 stocks were profitable using the strategy on April 20. But that number rises to 80% if you used the strategy on the 20 stocks that had the greatest absolute percentage change from that day's open to the close at 10:30am. Of the 16 profitable stocks in that group, only four had a profitable trade using the strategy before 10:30am. Now this is just for one day and I would want to do more research but if you can increase your odds of success from a 57% probability to 80% using this technique, that should help you increase your overall profits. To answer @diazlaz, my methodology is a bit of a grind. I literally update a single-day 2 minute chart for each of the S&P 500 stocks one at a time and record the daily Total Profit figure and save it in an Excel file. I'm sure there are others who can figure out to write code to do this more quickly. I am good at Excel macros but have no experience with Python, R, SPSS or SAS (and have limited thinkscript skills). I then import each stock's price downloaded from thinkorswim (for intraday data) or http://finance.jasonstrimpel.com/bulk-stock-download/ for end of day data (also good for open, high and low). Tomorrow I will try paper trading six stocks that have the greatest change from the open until 10:30am and see how I do and will share the results.
 
Midtown Mo

Midtown Mo

New member
For today, Thursday, April 23, the strategy was profitable on 27% of the S&P 500 stocks (54% of the stocks were up in price on the day). Again, those with the largest percentage difference between their intraday highs and lows performed better: 1-100 (highest variance) = 50% profitable, 101-200 = 36%, 201-300 = 21%, 301-400 = 16%, 401-500 (lowest beta) = 13%. Today I paper traded six stocks that were among the most variable in the first hour of the session. Half were profitable. Unfortunately the losses outweighed the gains. I am finding it very difficult to rely on this as a profitable strategy. As some have mentioned in this thread, some tinkering of the settings may be needed to find more success. Even with fictious money the wins just aren't adding up. Any suggestions?
 

Similar threads

Top