DIY Trading Bot Part 2: More strategies, more results and Portfolio backtesting

BZOwl
5 min readApr 10, 2023

--

This is a follow up of Part 1: Turn Trading View alerts into trading bots. In my last article. I laid out next steps :

  • run the existing strategies for longer to ensure good walk forward results
  • find more good performing symbols and strategies
  • run the strategies through a simple portfolio analyzer

Walk Forward Test result

This experiment has made me 10% in 5 weeks thus far. Not bad for letting my little bots do all the work, and I didn’t have to watch the market. See below for screen shots from my TDA Account.

March 20 Two weeks live trade result
April 7 Five weeks live trade results

Finding additional symbols

Here are the criteria I use to select stocks to trade:

  • Liquidity: Since this is a scalping strategy and the order execution goes through multiple hops, I look for issues with high liquidity (daily average volume > 500k) to minimize slippage. Look for tight spreads between bid and ask. Max 2–5 cents.
  • High Beta: There’s a tendency to have better performance stats among high beta stocks. I look for Beta > 2.0
  • Strategy stats: The rest is seeing if I can find a combination of Lux Algo indicators that produce good results with the symbols. Here’s how I decide which symbols to include on my watchlist:
    - Profitable % above 65%
    - Profit Factor above 1.8
    - Drawdown below 15%. I will entertain drawdown being +10% more IF the Profits is high.

If you are interested in doing your own research to find new stocks to trade, the list above is a good template to start you off. Feedback on my criteria is very much appreciated!

In my last article, I showed 6 symbols that live.

This is current set of 9 symbols with live test result: AGQ, TQQQ, SOXS, SPXU, MARA, SQQQ, UPRO, TMV, TSLA

Additional symbols still under backtest: BOIL, MNQ, MES futures, NIFTY/BANKFITY futures

I decided to replace NVDA with TSLA, and RIOT with MARA because the latter hadbetter profit factor. The LuxAlgo strategy and result of each of these symbols are are available for free in my “DIY Trading Bots etc.” discord channel. There’s also a small group of folks optimizing and sharing their strategies.

Portfolio backtest

There was a concern on performance at a portfolio level. A member of the Traderspost.io Discord shared a “free” Excel sheet in which I can see the profit curve of all the trades across my entire portfolio. I wrote a little program to enter all my trades into the template and generated the results for the past 1 year.

First thing to notice is even though this is a scalping strategy, it has only done 600 trades in a year which is equivalent to an average of trades a day. There is rarely more than 4 positions open concurrently.

Recall the timeframe of my strategies range from 2 min to 15 min. Some of the 15 minute strategies had trades dated 1 year back. The 2 minute ones had trades for 4 months. I was amazed to see an excellent “upward” curve with very little “flat” periods. What’s even more surprising is the max portfolio drawdown for was 2.62% for the entire back tested period. Check out more details on the portfolio backtest here https://docs.google.com/spreadsheets/d/1ufdIh4-S8g29jcGaXxcWHyXN80PiqyNwQSqLvkpGUNI/edit?usp=sharing

How the portfolio performed from March 2022 to March 2023

How well the portfolio backtested may not have been a total fluke. The 9 stocks I am trading live had gone through some preliminary diversification sector wise based on my “instinct” to generally include commodities, tech, general index sectors. Because this is not a buy and hold, the true correlation isn’t judge by sector, but the trades made by the strategy, which is what is confirmed by the portfolio analysis Excel exercise above. However, it is worth while to dive into the “sectors” of the portfolio that might have made the portfolio “diversified” for the past 12 months.

  • AGQ — Silver 3x ETF. Traded long and short. Unfortunately the bear ETF did not test well
  • TQQQ, SQQQ — Nasdaq 100 3x ETF. Traded long-only so this pair represents both sides of Nasdaq. They rarely trade on the same day.
  • SOXS — 3x Bear Semi-Conductor ETF. Traded long-only. This is an interesting symbol, it backtests well in both up and down months. Its counter part SOXL does not have high enough profit factor.
  • UPRO, SPXU — S&P500 3x ETF. Traded long-only so this pair represents both sides of Nasdaq
  • TMV — 20+ Year Treasury Bear 3x ETF
  • MARA — Bitcoin proxy. Traded long and short
  • TSLA — One of the few high beta stocks that shows decent profit factor

I plan to run the portfolio analysis on this subset: UPRO, SPXU, TQQQ, SQQQ, SOXS, TSLA, MARA as I suspect they are likely correlated. I will omit some of them if they are not contributing enough to profits or reducing risk.

There has been a few lessons learnt from this exercise that I will share in a future article. I thank you the members of “DIY Trading Bots etc.” server for giving me ideas and continued encouragement. Special thanks to Shawn M. for creating a cool looking OwlBot avatar for the server

If you enjoyed this article, be generous with your claps and comments

Disclaimer: This article should NOT be considered investment advice and the content should be taken as informational and for entertainment purposes only. I am NOT a financial adviser and only present my personal experiences with experiments in investments.

Contact Me:

Telegram: https://t.me/BZOwl

Discord: nimble#3925

--

--

BZOwl

Research passive income opportunities in the peace of the night. Main focus on US index option spreads and futures. New ventures into Crypto bots and and DeFi.