Hi,
Here is a low capacity algo for you. It only trades $10,000, and generates some profit. Watch out trading it live, you might want to widen the lowerRatio, upperRatio spread, so that the market doesn't react too much to what you are doing. Use at your own risk.
This one is free, on me.
Regards,
Warren
Jared Broad
Interesting, what effect is it focusing on / harnessing?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Douglas Stridsberg
Couple of words of caution for those looking to trade this live (a.k.a. disclaimers I would have put before posting this online):
- You're relying on very precise and timely fills as you need to trade huge amounts to get any meaningful % return. I don't know how AT trades but I would be extremely wary of anything that backtests at 13 Sharpe and 1500% CAGR and trades only one asset.
- The way this algorithm works, it has no risk management - it relies on the price ticking upwards for your limit sell order to be filled. Let's say you had your buy order filled but then the price tanked - unless it recovered back up, there would be nothing to stop you from losing your entire capital (theoretically), as you're putting it all at risk with each trade. You're risking it all to make a small, incremental profit - this isn't necessarily bad but must be understood properly before trading.
- If you don't get filled at exactly your limit order, you can very quickly incur great losses (owing to the large order sizes needed to generate P&L). This is a textbook example of a strategy with extremely negative skew (many small gains with a few, large losses) and high kurtosis (significant outliers in the distribution of returns). If you're going to trade this, you need to understand what this means for your risk profile.
- The very high frequency of trading (~13 per day) means you will be running up a huge commission and trading fee bill. If you're looking to trade this live, be diligent in understanding exactly how and when your broker will charge you (per trade or at end of month? Actual trading or estimated volume? Fixed charge per stock or % charge on volume?) You do not want to end up owing more than you can afford because you ran into a loss like I described in #2.
- The backtest shown uses a very short lookback (1 year) and shows only one underlier. I suspect this is not a coincidence - this is (very likely) the best possible outcome out of many. Needless to say, before you choose to trade this live, you need to have tested this on multiple underliers and time spans to get a sense of how this performs.
Having said all this, straight lines with positive slopes are always beautiful to look at :) .Yujun Tang
Nice troll algo :)
You're just filling limit orders to buy at the bid and sell at the offer, basically a Godlike backtest Market Maker.
Warren Harding
As Yujun says, it's just a simple market maker. The trick is to screen first for stocks that have both a consistently high spread AND decent dollar volume. It won't work on stocks with a low spread as you get killed by fees. It helps if the stock you are trading is relatively range bound as well.
Yujun Tang
Yeah it'll work under the circumstances like you said, although the algo is too simple to trade live.
It needs more considerations, e.g. If you're holding a position and the market is turning against you, the algo would still be placing limit orders that will not get filled.
Warren Harding
Ya, I'm using market making as just one concept in my latest higher capacity, multi-stock stuff.
Warren Harding
There's a lot of skepticism on this thread. Oh well, I'm still standing by my work. Never surrender!!!
Michael Manus
hehe
still nice work and very good contribution to quantconnect.
one day there will be more people posting their stuff here :) (when the skepticism fades)
some have to see the larger picture :):):):) to see more people contributing to QC
thanks warren for this post!
btw: now i know how to trade AT
Warren Harding
Thanks, Michael! To be sure if everyone starts trading AT it'll lead to a situation where we are all frontrunning each other, and no-one will profit. I actually have a list of stocks that perform well with this type of strategy, but that list is proprietary for the time being. You can do all right if you write your own screener to find instruments with high spread and high dollar volume, I've found that I do even better by combining market maker concepts with ways of predicting which way the stock is going to move.
Yujun Tang
Hey Warren, agologies if i sounded skeptical about the strategy. I was questioning the accuracy of the backtest results; it's unlikely that 1500% CAGR would reflect real world trading. The thing about market making algos is that there is no reliable way to backtest them, not even by paper trading, as it depends on the reactions of other market participants.
The strategy most definitely could work, although the order placement needs to be far more complex than just simple limit orders at the bid and ask.
Anyway, thanks for sharing with the community!
Cheers
Warren Harding
No problem Yujun. There's actually a bunch of stuff that I'm not describing regarding how I conceived of this minimalist script, so it probably looks like I just got lucky. It wasn't all luck. Ya, going live is another thing altogether, any backtested algo should be closely monitored, particularly at the outset, to see if it's behaving as expected.
Nate Betz
Just to echo a few other comments on here, this type of algo is unlikely to produce live trading results as bountiful as the backtest shown. I'm not saying this to be negative; it's great when people share their ideas and experiences, I just want to caution folks who may see a backtest like this and run out to put money at risk like this guy who tried to trade one of the too-good-to-be-true GDAX algos that was posted.
The shorter the timeframe you're trading on, the less accurate backtests are likely to be. Trade execution and risk management becomes as important, if not more important, than your alpha strategy for higher frequency trading scenarios.
I've transitioned my focus from backtesting to live trading in the past year and my whole methodology for algorithm development has evolved. Don't get me wrong--there is still a lot of value in backtesting, particularly on higher timeframe/lower frequency trading/investing, but there are a lot of additional issues in live trading like liquidity, risk management, and operational/technical issues that folks should be aware of.
That said, this is a winner in the backtesting game and thanks for sharing it!
Jared Broad
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Nate Betz
Hi Jared. Yes, I've been wanting to put together a few slides and hope to have time to do that sometime soon. In a nutshell, there's more of an emphasis on tuning based upon live (or paper) trading data. My signals are based upon predictive models, which I refresh regularly with data captured by my algo(s). A lot of code assets around configuration management, reporting, dynamic trade execution/risk management parameters (e.g. stops & targets). Still very much a WIP and of course all built around LEAN.
Warren Harding
IMHO, it seems best to start with good backtesting results, and concepts that have shown promise, then try and see if you can work the bugs out of when trying to trade it live. Starting with mediocre backtesting and concepts will almost certainly lead to mediocre results at best.
Petter Hansson
Adversaries will fill you at the worst possible time in the short term so the assumption that you will get fills is very optimistic. Heck, HFTs can place an order themselves one tick away from your limit order and use your limit as an exit if their trade goes the wrong way. Running this algo on IB's paper account will most likely show this.
Petter Hansson
I should add, the simplest way to ensure an algo even has a chance of working live on the infrastructure we're given by IB is to watch its average win/loss. IMO anything with <0.5% win/trade has a high chance of being fantasy. This also has implications for how long you need to hold positions.
Btw I never want to say never, if someone somehow got a small trade win/loss algo to work on QC/IB I would be interested to hear how they did it.
Stefan
I run market making on crypto exchanges. Backtesting results are usually off. I am quite sceptical of doing it on traditional markets due to it being dominated by HFTs. You will need to account for adversial selection and control inventory risk carefully. Also for market making you would want to acquire actual trade data for backtesting. You can search on Arxiv for some market making models.
Hugo Acuna
How would you apply this to the forex market?
Adeel Anwar
I’m confused, if it trades 13 times per day, how can someone with 10K use it? PDT-rule and all?
Warren Harding
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!