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 :) .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.
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.
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.
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.
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.
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.
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.
Warren Harding
Ya, I'm using market making as just one concept in my latest higher capacity, multi-stock stuff.
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.
Warren Harding
There's a lot of skepticism on this thread. Oh well, I'm still standing by my work. Never surrender!!!
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.
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
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.
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.
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.
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
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.
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.
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
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!
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Hugo Acuna
How would you apply this to the forex market?
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.
Adeel Anwar
I’m confused, if it trades 13 times per day, how can someone with 10K use it? PDT-rule and all?
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.
Boris Sachakov
@Jared,
Would you please show me the code how to make it happen. Thanks in advance.
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.
Boris Sachakov
How should I adjust the following formula for 5-min Period?
public new TimeSpan Period { get { return QuantConnect.Time.OneDay; } }
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.
Alexandre Catarino
QuantConnect.Time Helper has the following "aliases":
QuantConnect.Time.OneDay = TimeSpan.FromDays(1); QuantConnect.Time.OneHour = TimeSpan.FromHours(1); QuantConnect.Time.OneMinute = TimeSpan.FromMinutes(1); QuantConnect.Time.OneSecond = TimeSpan.FromSeconds(1); QuantConnect.Time.OneMillisecond = TimeSpan.FromMilliseconds(1);
For other periods, we need to rely on TimeSpan.From* functions.
In this particular case, please adjust it with:
public new TimeSpan Period { get { return TimeSpan.FromMinutes(5); } }
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.
Boris Sachakov
@Alexandre,
Thanks for your advice. However, the time is still reported by 1-min off: e.g. 11:16 instead of 11:15.
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.
Jared Broad
public override DateTime EndTime { get { return Time + TimeSpan.FromMinutes(5); } }
The default resolution length is 1 minute which makes it appear 1 minute past the start time (which is infact looking into the future since your bars are 5 minutes long). If you set your bar length to 5 minutes (like above) it'll appear on the 5 minute boundary.
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.
Alexandre Catarino
Boris, you got a different result, because you removed the part we override EndTime. The complete solution would be:
public override DateTime EndTime { get { return Time + Period; } set { Time = value - Period; } } public new TimeSpan Period { get { return TimeSpam.FromMinutes(5); } }
Since Jared's solution is 5 lines shorter, we can considered it better.
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.
Boris Sachakov
Jared and Alexandre,
Thank you both for your suggestions. Both codes brought the time of events to the end of the bar. However, the time that 'Logs' and 'Trades' after Backtest show is 5 minutes later than the actual event. For example, by looking at the chart, 1st Bearish Closing Marubozu ends at 10:55, whereas the Logs record it at 11:00. Also the 'Trades' show that its price was 1988.50 USD at 11:00; but if you look at the actual records (see the link to Dropbox in GetSource), the price 1988.50 corresponds to Close at 10:55.
Basically, the candlestick pattern and the trade in reality occur at 10:55, but the records (Logs & Trades) show 11:00. Similar situation happens with the rest of patterns.
How can we fix this situation? Thanks in advance
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.
Jared Broad
That is the intended behaviour; the bars close on the end time (i.e. start + period).
20160104 10.55 ...$1988.50 + 5 minute period bar means the bar is available (closing) at 10.59.9999 and appearing in your algorithm at 11am.
If the bar was available at 10.55 you'd see into the future (as the closing price is at 10.59.99999)
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.
Boris Sachakov
Jared,
Thanks for your response. Still, there is some confusion. But I am beginning to understand the problem, possibly. When I downloaded my data, I set the time of candle correspond to Close. So in my data 10:55 is the bar's close. In your case, probably, the time corresponds to the beginning of the candle.
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.
Phillip Espina
Hi Everyone, Is there a way to do this on python?
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.
Phillip Espina
Hello everyone, I'm using candlesticks to compare if it goes beyond my Upper Bollinger Bands. To get this I need the value of the CandleStick indicator that I am using right? But it only return 1 or -1 as in detecting Bull or Bear patterns. How should I be able to do this using CandleSticks?
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.
Rene Ordosgoitia
Hello guys, I´m trying to take access to the candlestick patterns libraries that are in the GitHub LEAN documentation, but there is not too much information related to how to calculate it in a universe selection approach.
In the next code, I want to use for the moment a simple condition to filter the stock that has an RSI value lower than 40 and the DojiStar built-in CandlestickPatterns library, but I don´t know how to use it in a universe selection approach:
import typing import QuantConnect.Indicators.CandlestickPatterns import datetime class EMAMomentumUniverse(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 10, 11) self.SetEndDate(2020, 11, 11) self.SetCash(1000) self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse(self.CoarseSelectionFunction) self.averages = { } def CoarseSelectionFunction(self, universe): selected = [] universe = sorted(universe, key=lambda c: c.DollarVolume, reverse=True) universe = [c for c in universe if (c.Price > 10)][:100] for coarse in universe: symbol = coarse.Symbol if symbol not in self.averages: # 1. Call history to get an array of 200 days of history data history = self.History(symbol, 200, Resolution.Daily) #2. Adjust SelectionData to pass in the history result self.averages[symbol] = SelectionData(history) #here is where im trying to create the bool variable. self.hammer = self.CandlestickPatterns.DojiStar(symbol) self.averages[symbol].update(self.Time, coarse.AdjustedPrice) if self.averages[symbol].is_ready() and (self.averages[symbol].rsi.Current.Value < 40): selected.append(symbol) return selected[:10] def OnSecuritiesChanged(self, changes): for security in changes.RemovedSecurities: self.Liquidate(security.Symbol) for security in changes.AddedSecurities: self.SetHoldings(security.Symbol, 0.10) class SelectionData(): #3. Update the constructor to accept a history array def __init__(self, history ): self.rsi = RelativeStrengthIndex(14) #4. Loop over the history data and update the indicators for data in history.itertuples(): self.rsi.Update(data.Index[1], data.close) def is_ready(self): return self.rsi.IsReady def update(self, time, price): self.rsi.Update(time, price)
Thanks a lot for any clue!
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!