As of this writing this algo is ranked #1 and is in the top 1% of the community.
It's a crypto algo. GDAX charges high fees for 'takers', and there is no fee modelling. It will have to be appropriately converted to limit orders in order to take advantage of GDAX's zero fee for 'makers' fee model in order to actually be useful. Slippage is low on GDAX for the instruments in question so that shouldn't have too much of an impact.
Warren Harding
Framework Description
The framework allows experimentation with, and utilization of, two fundamental properties. Those properties are trend and curvature of price. For example you may wish to select instruments that have been trending downwards and curving upwards, or some other mix of trend and curvature. The changes1Ratio variable determines the influence of trend. A positive changes1Ratio will increase the tendency to select instruments that have been trending upwards, a negative changes1Ratio will increase the tendency to select instruments that have been trending downwards. The changes2Ratio variable determines the influence of curvature. A positive changes2Ratio variable will increase the tendency to select instruments with a price that has been curving upwards. A negative changes2Ratio will increase the tendency to select instruments with a price that has been curving downwards. You can also set either the changes1Ratio or changes2Ratio variable to zero. This will eliminate the influence of that variable. So if you just want to select based upon trend with no regards to the curvature you would set the changes2Ratio to zero. Magnitude has the obvious effect. A large magnitude of changes1Ratio combined with a small magnitude of changes2Ratio will produce an algorithm that mostly considers trend with regards to instrument selection. Both the trend and curvature considerations are exponential in nature. So more recent events will have a higher influence upon selection than older events.
The emaOfChanges1Indicator indicator is the primary indicator of trend. It holds an exponential moving average of the changes in price. You can change it's length by adjusting the emaOfChanges1Length variable. The emaOfChanges2Indicator indicator is the primary indicator of curvature. It holds an exponential moving average of the change in change of price. You can change it's length by adjusting the emaOfChanges2Length variable.
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.
Jack Pizza
Hey Warren,
Have you tried trading the strategy with other instruments? Just wondering it's robustness, I have another strategy that works great on crypto but not so well on other instruments. Meaning the crypto community might be naive and technical indicators and strategies still have high impact.
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
Hi Elsid,
Ya, crypto is a newer space for algo developers so I've been looking at it as an opportunity before it's swamped with more refined analysis. I do have a volatility algo that operates on similar principles as the framework here, It profits well. Results with equities might be less than stellar. Fundamentals seem to do well there.
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
Hi Jared,
I see you changed the headline for me. Thanks, except that it's not an EMA cross. It might be better described as a buy the dip algo. Or, as I've called it, 'the framework'. Or simply a 'crypto algo'.
Hello everyone,
I'll explain more thorughly how the algo operates. It doesn't really have a name because it operates on principles that I invented myself. I may not be the original inventor but I haven't seen these principles in common use. The primary trend indicator calculates the ema of the percentage changes in price. Note that it's an ema of percentage change in price, not the usual ema of price. This allows one to assign a single number to 'trend'. This number is based upon percentage change in price, so you can readily compare with other instruments to find the instruments with highest or lowest trend. Because it's an ema, more recent changes have a greater influence than less recent changes. The primary curvature indicator operates in similar fashion, but it takes an ema of the change in change of price.
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
How's that? ;) Fixed 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.
Warren Harding
Excellent. Thanks Jared!
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.
Nick Georgiadis
Hey Warden,
I converted it to limit order but the return has a significant drop compared to the initial one. Any idea what might have affected the algo?
Thanks
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
Hi Nick,
A few things come to mind, though I haven't examined your algo in detail. The Liquidate call will have to go as well, it uses market orders as I understand it. You might want to cancel the limit orders if they don't go through, possibly after some amount of time. This could be why the returns have come down so much, though I haven't checked thoroughly. I'ld have just used the bid price for purchases and the ask for sales given the behavior of the instruments on GDAX. If you go to the GDAX exchange you'll see that there is practically no spread. If you set a limit order at the ask for a purchase I'm not sure if you'll meet the 'maker' requirement for fees on GDAX, which is going to be critical for this algo.
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.
John Schwartz
Has anyone figured out a good algo for GDAX maker orders for this algo?
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.
Skyfold
Hello everyone,
I attempted to launch the code "live" at OANDA, but it gives the following werrror. Could any one tell me what is missing in the code to go live?...Thank you!
Failed to initialize algorithm: System.Exception: No default market set for security type: Crypto at QuantConnect.Algorithm.QCAlgorithm.AddSecurity[T] (QuantConnect.SecurityType securityType, System.String ticker, QuantConnect.Resolution resolution, System.String market, System.Boolean fillDataForward, System.Decimal leverage, System.Boolean extendedMarketHours) [0x00036] in <321054ea1e964454bc0d403925dda91a>:0 at QuantConnect.Algorithm.QCAlgorithm.AddCrypto (System.String ticker, QuantConnect.Resolution resolution, System.String market, System.Boolean fillDataForward, System.Decimal leverage) [0x00001] in <321054ea1e964454bc0d403925dda91a>:0 at QuantConnect.MultiCoinFramework.Initialize () [0x00067] in <0e4d1f8fc06a43f2a3bc45c24a3f6958>:0 at QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler+<>c__DisplayClass24_0.b__1 () [0x000fb] in <7a802d713401490dbae6b34efb125c68>:0
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.
Casey Barclay
Has anyone had any success live trading this on GDAX? I'd be curious to see how the actual results pan out with a market order or even a limit order.
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
hi Alexandre Catarino & Jared Broad
i wanted to play around with warrens code and see how it behaves with stocks but got a runtime error.
1) could you please help me find it? IT DIES ON
2017-03-21 00:00:00 :Runtime Error: Cannot perform runtime binding on a null reference
edit the date first!!!!!!!!!
2) where did the VRX data go? :)
thx
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.
Samuel Cutler
I have tried to run a similar stragety live, and it buys the sells the first order great, but when it goes to buy the second it says invalid because of insufficient buying power, Does anyone have any ideas?
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.
Thushara Silva
As of this afternoon, the strategy does not work if more than 1 crypto is in the string. Was working fine from yesterday through this afternoon. If 2 only are on the list, ETHUSD, BTCUSD or BTCUSD, ETHUSD, the 2nd listed pair will fail with this error:
Runtime Error: 'BTCUSD' wasn't found in the Slice object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("BTCUSD") (Open Stacktrace)
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
This algo now fails! I hacked in a quick 'data.ContainsKey' and 'continue' thinking that would solve the problem and the returns dropped dramatically. Anyone at Quantconnect know what happened? Sounds like odd behavior given Thushara's report.
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
Warren i think Jeremy might found the problem.
data is null so the indicator and everything might be dead?
you could of course write to support@quantconnect :)
my english is really bad :):) hehe
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.
Johannes Mauritzson
Some temporary data issue? seemed to impact the algos which subscribed to more than one pair.
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
It seems to be working again.
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.
Johannes Mauritzson
Nevermind OP's code works if you add the actual ticker string instead of the Symbol:
Symbol symbol = QuantConnect.Symbol.Create(ticker, SecurityType.Crypto, Market.GDAX); AddCrypto(symbol, resolution); //Change to: AddCrypto(ticker, resolution); //You also need to set the brokerage model to GDAX in init: SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
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.
Nathan Swenson
I'm thinking to set up the live trading, but to use it with paper trading just to get the signals in real time. I guess it would be better if it alerts ahead of time, like at open that there will be a trade at 2 hours after open. Because this strategy has so few trades, it's easy enough to just do the trades manually. I'm thinking I'll use a small amount in futures to trade NQ and ZB pair and my TD Ameritrade self managed 401k with a more conservative setup.
Regarding the Alpha Competition, this version qualifies with 84% PSR (Alpha score). Peter, you should think about entering it. You did all the work. I'm just playing around with for consideration of using for my own accounts.
Regarding the high results above, that was without any Margin. So if you wanted to go crazy, you could add some margin to it, or simply trade non-Leverage funds but lean more on margin.
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.
Nathan Swenson
Screen shot of the end result.
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.
Nathan Swenson
Sorry for all the posts. Having trouble posting screen shots when working from an IPAD.
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.
Mateusz Pulka
Tien Duy Vo Peter Guenther
I have spotted this bug also, the problem is here (the loop is run outside the if statement):
if not self.be_in:
# Close 'In' holdings
#for asset, weight in self.HLD_IN.items():
# self.SetHoldings(asset, 0)
#for asset, weight in self.HLD_OUT.items():
# self.SetHoldings(asset, weight)
wt[self.STKS] = 0
wt[self.TLT] = .5
wt[self.IEF] = .5
# Thomas's reducing unnecessary trades
for sec, weight in wt.items():
cond1 = (self.Portfolio[sec].Quantity > 0) and (weight == 0)
cond2 = (self.Portfolio[sec].Quantity == 0) and (weight > 0)
if cond1 or cond2:
self.SetHoldings(sec, weight)
The for loop will be fire every time even if we set self.be_in to false. The correct version is:
if not self.be_in:
# Close 'In' holdings
#for asset, weight in self.HLD_IN.items():
# self.SetHoldings(asset, 0)
#for asset, weight in self.HLD_OUT.items():
# self.SetHoldings(asset, weight)
wt[self.STKS] = 0
wt[self.TLT] = .5
wt[self.IEF] = .5
# Thomas's reducing unnecessary trades
for sec, weight in wt.items():
cond1 = (self.Portfolio[sec].Quantity > 0) and (weight == 0)
cond2 = (self.Portfolio[sec].Quantity == 0) and (weight > 0)
if cond1 or cond2:
self.SetHoldings(sec, weight)
The same should be applied in second if statement.
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.
Mateusz Pulka
Sorry some kind of formatting problem. Generally the for loop should be move inside the if statement as Tien Duy Vo pointed out when algo starts and be_in paramter is true we will buy long and short at the same time.
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.
Nathan Swenson
I'm sorry, I don't know Python. I don't see any difference between your code blocks. Is this mistake resulting in inflated results due to margin usage?
Edit: Didn't see your last response. I will wait for a Python coder to update it. I only know C#.
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.
Mateusz Pulka
Sorry for formating problem. The code should look like this:
https://pastebin.com/cnKm9BVYinstead of this:
https://pastebin.com/pPcGFKR0The 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.
Nathan Swenson
So the issue pointed out by Gpw radar and Tien Duy Vo only occurs if "be_in = true" at the time of start. I don't see any issues with my order when ran from 2008 to 2020. It would seem that the results for mine are correct. I was worried that the results were invalid.
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.
Tien Duy Vo
gpw radar : Thanks for pointing out. Great job. Unfortunately, the backtesting framework on Quantconnect seems to be much slower than on Quantopian. It is quite difficult to debug that way.
There is another issue related to this part of the code:
self.Schedule.On(
self.DateRules.EveryDay(),
self.TimeRules.AfterMarketOpen('SPY', 120),
self.rebalance_when_out_of_the_market
)
self.Schedule.On(
self.DateRules.WeekEnd(),
self.TimeRules.AfterMarketOpen('SPY', 120),
self.rebalance_when_in_the_market
)
Here, the algo is firing the two functions rebalance_when_out_of_the_market and self.rebalance_when_in_the_market, which is responsible to get "in" and "out". However, you can see that one is started every day and the other one at weekend. I wonder, whether this is done on purpose.
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.
Mateusz Pulka
You are right Nathan Swenson it only occures once at the begining when you start algo and when flag in is set to true. For example check out your orders when you set the star date at 1st January 2018. It is not a big deal but worh to fix 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.
Mark hatlan
Great work! This market timer does a really nice job.
However TQQQ does do way better than SPXL. SPXL starts on 11/03/2008. UPRO starts on 6/28/2009. TQQQ starts on 2/7/2010. When switching the start date to 2/7/2010 here are the returns:
SPXL +7,552%
UPRO +7,180%
TQQQ +19,859%
I think SPXL only looked better because of the earlier first trade date.
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.
Nathan Swenson
Thanks Mark! Good point!
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.
Aalap Sharma
Relativily new to all this and I would really like to know are these returns realistic in the real markets? Has anyone deployed such algos to the market and seen healthy returns. Just curious...
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.
Nathan Swenson
Aalap, I just turned the algo on and entered TMF. We shall see soon enough. I'm going very aggressive with leveraged products. It should be very realistic as it only trades about 10 times a year with trades just 2 hours after RTH market open. Algo is entirely in treasury bonds at the moment.
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.
Aalap Sharma
Cool! I was thinking the same :)
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.
Mateusz Pulka
Hi Guys,
I have added some improvments to the code and please noticed the result. So first algo has improvment in terms of open the trade at the begning of the cycle when we start the algo. The return for 2010-2020 is: 16 772%
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.
Mateusz Pulka
The second run contains the following improvement. I just want to generate a signal about in/out just right after the open market. But open position just in the same way as the original algo. What is surprising the result is 21 011%. I am a little bit surprised about this, to be honest. Any idea where this difference comes from?
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.
Nathan Swenson
Gpw Radar, I see it takes more trades when you check signal at open. Perhaps it's due to increased volatility at open which is more likely to trigger needed deviation. The 2 hours after close is actually European market close for which there is often a ramp up in index price. I had thought about messing around with that as even 5 minutes makes a difference in that period. I know 2hrs and 5 min is significant. The timing of entry vs exit and asset type all matter. Bonds seem affected more at open, mid day, and close, while 2hr after open seems more significant for equities. Lots of opportunity for improvement I believe with timing alone.
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.
Mateusz Pulka
please notice that I only generate a signal in/out 1min after the market is open and then after 120min I open the position base on the signal. I have noticed that as I used IB with the cash parameter some of the orders were not filled (lack of money) and the order was later sometimes even 5 days later.
Peter Guenther Have you tried to use futures instead of etf to generate the in/out signal?
https://finance.yahoo.com/commodities?.tsrc=fin-srch
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.
Nathan Swenson
Gpw, perhaps the delayed order in due to transaction order. I often see that the buy order is executed before the sell order for prior holdings. This probably needs to be fixed.
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!