How to build a Financial Trading Algorithm.
It all starts with an idea… or a little bit of anger.
Chances are pretty good your algorithm strategy wasn’t developed because your bank account is filled with fiat currency or because you really like your day job. Just like blogging, all you need is an internet connection and resentment.
Usually the strategy or algorithm comes from losing a lot of money when making trades from your gut feeling or listening to the advice of a taxi driver. Hopefully this isn’t the case, but possibly you were taking trade ideas from Wall Street Bets or it could come from everybody’s favorite Wall Street clown. More often than not great algorithmic trade strategies don’t just happen because you were clicking around on charts and nothing better to do.
Recently, I was approached by someone to program their algorithm. The idea seemed a little half baked, but possibly could work. Since I have experience in this area and know some of the in and outs of this type of work, I usually put together a brief scope of work. In the end I didn’t get the job but my scope of work turned out to be a pretty good blog post on the basis of build a algorithm. I didn’t get the job because I was probably too expensive and I ask lot of questions, well cause I like to think things thru.
Phase 1: “Let’s see what sticks”
Build a “Scrubber” that would take stocks/options and process them thru your algorithm. The result would be placed in a database / excel sheet for your further analysis.
The goal would be to use significant amounts of stocks/options and data attempting to confirm your algorithm thesis and find any significant trends and capitalize on them. The more stock/options that you can run thru the “scrubber” the stronger your algorithm will be. My current stock algorithm runs over 500 stocks.
What I need to get the project started: Bullet point description of the algorithm. Need a control method, to ensure the algorithm identifies the correct trades.
Phase 2: “What worked, what didn’t and what worked surprisingly well”
Continued development of the algorithm, making changes to the algorithm based on the findings from the data. Such as adding a volatility filter? As this case with most algorithms, and which I believe is the exciting part is discovery. Analysing the data and finding new ways to increase profitability. These would be small changes in the code to “tweak” the algorithm.
Cost: ~hourly basis
Phase 3: “4 weeks of NFL preseason”
I don’t believe in NFL preseason games! Okay, maybe not 4 weeks. But it’s important to set up a paper trading account at Interactive broker. Make sure that slippage isn’t an issue and there are no other execution issues. Do market orders work better than limit orders? Do you have restrictions on your account (margin limits) Are orders backing up in the queue? Slippage? Account limitations… meaning you might not have enough money in the account to make 10 trades, but can make 9 trades?
User requirements: server (AWS or computer connected to the internet)
Phase 4: “Make it Rain”
Live trading and making $$. Set up, training and maintenance. Paper trading will be the major hurdle, but there might be a few unknown items moving into the final phase. From my experience, the difference of paper trading to live trading is pretty much a flick of the switch.
The unknown: Human emotion is the biggest hurdle that I have run across. Currently, my algorithm runs 24 hours a day 5.5 days a week. I only know it is working when I check in on my account or I get the IB reset alert on slack. Otherwise, the algo is just turn out trades, regardless of what the president tweets or what wars or civil war we are currently in. It takes a little bit of time to accept the algo is working and all your hard work is doing what it’s supposed to be and you can kick back a relax.
Most people generally accept that when flying and at a cruising altitude, the pilot has the plane on auto pilot and he is just monitoring controls, not flying the plane. We have a certain faith that the pilot and the autopilot feature are doing what they need to do. The same goes with a financial algorithm, you have to trust that it’s working and that isn’t an easy thing to do at first when money is on the line.
So that is the basic layout of putting an algorithm together, I’m sure I missed a few things and maybe over exaggerated others. Just because one has made a few successful trades on Robinhood, doesn’t mean you are ready for an automated trading. So with that it takes a lot of work and if you want to work with me the starting price is at a minimum $7,000. In the event you are still interested, start the conversation off with my payment of 7,000 M&Ms and make sure they are all green!