Hey Guys!
I am trying to get a deeper understanding of both the historical and live data and how it impacts limit orders.
If I set the equity I want to trade to minute resolution "self.AddEquity(self.ticker, Resolution.Minute)" and then I were to enter into long position with a limit order to take profit. Will this limit order be triggered when the new minute data bar closes on or above the limit order or would it be triggered on tick basis the moment the limit order is touched i.e. I assume with minute resolution, a bar is formed on the minute, every minute. Could the limit order be triggered say, 23seconds into a minute bar if at that point the limit order price is touched or would the limit order only be triggered when the minute bar closes on or above the limit order?
Hopefully that makes sense. Any help is hugely appreciated,
Seb
Rahul Chowdhury
Hey Sebastian,
The sell limit order will only fill if the close of the last bar is at or above the limit price. In order to act on more fine market movements, we need to use higher resolutions. For example, we can use second resolution data, which would allow our algorithm to execute our limit order at 23 seconds into the minute bar.
Best
Rahul
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.
Sebastian Bunney
Hey Rahul,
Thanks a lot for your response. I really appreciate it. So my next question is hypothetically speaking if I were trading this algo live and I put in a limit order would that limit order not sat in the exhange waiting to be fulfilled the moment it is triggered, regardless of when my algo is recieving the updated data. Therefore even though I am running minute data that should be an issue? Or is that limit order only created within the algo itself and therefore is only updated on the resolution set.
Apologies if my question is basic. I am just trying to get to know how the system works.
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.
Sebastian Bunney
Thanks Rahul. I felt like that was the case but thanks for confirming.
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.
Derek Melchin
Day 1: On the Up
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.
Pi..R INVESTOR
Very cool internship project guys, thanks for sharing :)
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.
Jovad Uribe
This is amazing!
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.
Jon Quant
Nice! Good luck with guys.
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.
Derek Melchin
Week One: A Good Start
Hi everyone,
The live deployment has been profitable throughout its first week!

We researched some new strategies today but not find anything worth adding this week. Instead, we've decided to increase the allocation ratios of the two current strategies. This adjustment raises the Sharpe ratio of the backtest to 1.95 while maintaining a max drawdown <$1K. The <$1K drawdown is vital as the InternFund is only allowed a $1K drawdown.
Going forward, we are excited to research more strategies to add to our portfolio. We have a few in the pipeline, but are always looking for more. If our readers have anything they would like us to test, feel free to add suggestions to this forum thread.
See the attached backtest for the latest deployment.
Best,
Derek Melchin
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.
HughStryker
Thank you for sharing, I look forward to following this thread.
I'd be very interested to see a QC implementation of Chris Cole's Dragon portfolio, i.e. 20% allocation to equities, bonds, trending commodities, gold and active long volatility. It was created in response to the typical 60/40 split so it would be nice to see how the two strategies compare.
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.
Shile Wen
Hi Hugh,
Thank you for the suggestion, we'll keep it in mind.
Best,
Shile Wen
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.
Ernest Shaggleford
Hi Derek and Shile,
thanks for revealing your strategies that you are trading live.
On the weights used for the 60:40 algo set of tickers:
self.weight_by_ticker = {'SPY': 0.6, 'AGG': 0.4, 'VXX': 0.1}
The total weight for this set is 1.1 which is then scaled by the allocation ratio of 0.5 so it would be 55%.
But as the TLT (treasury proxy) algo allocation ratio is 50% then the total portfolio allocation with both algos could potentially be 55% + 50% = 105% during the Treasury holding period, which doesn't seem correct.
Have I missed something?
Thanks,
ES.
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.
Shile Wen
Week 2: The Hunt for the Next Strategy Addition
Hi Everyone,
This week, we’ve been researching new strategies for the InternFund. One strategy we researched is a Gap Down strategy, where we buy stocks during the day that surpass the previous day’s close if they open down 1% from the previous day’s close. However, the backtest (attached below) was not promising, so it will not make it into the InternFund. We also developed an option spread strategy, however, we deemed that the drawdown was too large, thus, this strategy will not be added either.
Here is the performance of our portfolio for this week.
Ernest Shaggleford pointed out that with our current ratios, we’d have 105% allocation during periods when we hold TLT. We confirmed that our account has access to overnight margin, which means going over 100% allocation will not affect our algorithm.
As for next week, we will implement HughStryker's suggestion and keep researching new strategies.
Best,
Shile Wen
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.
Ernest Shaggleford
Hi Shile,
re: "We confirmed that our account has access to overnight margin, which means going over 100% allocation will not affect our algorithm":
Out of curiousity, won't the cost of margin have some impact on the P&L?
Thanks,
ES.
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.
HughStryker
Thanks for the update, Shile!
Here is another strategy idea, I'm too much of a beginner to accurately describe it, but I'd say it's a L/S portfolio using institutional ownership as a factor. There's a variation which uses long/short interest instead.
BofA version
ZeroHedge variation
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.
Derek Melchin
Hi everyone,
Just a quick update: InternFund closed at a new high today!
Stay tuned for a more comprehensive update this Friday.
Best,
Derek Melchin
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.
Shile Wen
Week 3: Researching More Strategies
Hi Everyone!
This week, we researched more strategies for the InternFund. One strategy we tested this week was HughStryker’s suggestion, Chris Cole’s Dragon Portfolio. Although the drawdown is relatively low compared with other strategies, it is still too high for us, so we decided not to add it. An implementation can be seen in the attached backtest.
Derek implemented a Trailing Breakout Strategy with TSLA. It performs well throughout 2020. However, extending the backtest start date further into the past decreases the performance. For the InternFund we are specifically looking for strategies with a long track record of consistent returns.
As for the InternFund performance, we are at a new equity high! Five days ago, we entered our first TLT trade, and we have exited TLT today, for a gross profit of $76.54. Here is the graph of our equity:
Ernest Shaggleford mentioned that margin will affect our P/L, which is true, however, we have very low margin interest, and we only hold TLT for five days out of the month, so the costs are negligible. HughStryker offered another strategy of incorporating institutional ownership. Unfortunately, we do not have access to this data.
Thanks to everyone for tuning in to our weekly update, and special thanks to HughStryker for the Dragon Portfolio strategy suggestion! Stay tuned for more updates, and feel free to suggest more strategies.
Best,
Shile Wen
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.
Josh M
Interesting; cool discussion and glad to see it's working live!
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.
Tamim Fund
Shile,
The Gap Down strategy seems to be executing at "stale prices," resulting in there being no price gain or loss other than the commission, since you are comparing the current days close to the previous days close and placing a buy order after market closes, instead of comparing intraday minute or hourly price data. Could you look at that?
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.
HughStryker
Thanks for the update!
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.
Derek Melchin
Hi Ernest and Tamim Fund,
We appreciate the constructive feedback. However, the InternFund is limited to only trading equities. Thus, we cannot implement the suggestions #2 & #3 from Ernest above. As for the Dragon portfolio changes, we will take a closer look at this today.
In regards to the stale prices in the Gap Down Strategy, we will work to resolve this today as well.
Best,
Derek Melchin
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.
Derek Melchin
Week 4: Up To Three Strategies!
Hi everyone,
We are excited to announce that the InternFund generated profits for another week. Here's the latest screenshot of our live track record.
Today, we spent some time fixing the "stale price" issue with the Gap Down strategy. The issue surfaced because the universe resolution was set to daily in the original algorithm while the strategy was trading off intraday prices. Here is the backtest of the strategy after fixing the bug. Thank you Tamim Fund for reporting this issue.
This week, we also spent some time implementing the Turnaround Tuesday strategy. As can be seen from this backtest, the strategy has performed quite well over the last few years. Allocation 33% of the portfolio to the strategy generates a 58% win rate, >1 Sharpe, and a mere 1.6% drawdown. We are confident enough in these results that we've decided to deploy this strategy to live-trading within the InternFund algorithm. To incorporate the strategy, we reduced the allocation ratio of the 60/40 strategy to 30%, allowing the Turnaround Tuesday strategy to have a 20% portfolio allocation.
We found out today that the post of our latest live deployment above actually quits early because it reaches our max drawdown limit of $1000. After increasing the max drawdown limit so the backtest completes, the original max drawdown was 6.3%. With the Turnaround Tuesday strategy incorporated into the algorithm, the new combined strategy experiences a 3.8% drawdown. The Sharpe ratio is also increased from 1.64 to 1.93. We will of course only deploy the new strategy with the $1000 max drawdown limit, but a complete backtest of the InternFund algorithm (with an extended drawdown limit) is attached below.
For those readers who may have missed the discussion thread introducing our newest team member, we'd like to introduce Jovad to this thread. He implemented an interesting strategy this week while researching for the InternFund. It's a Fibonacci Option Straddle strategy that sets a retracement at 30% below the 5 day maximum of the underlying security. Every two hours a scheduled event is triggered checking if the nearest expiring and strike price option's bid price has met or crossed the set retracement. If this is true, then we enter a long position. If it's false, we liquidate our position, or we do nothing. Lastly, the universe was selected based on equities that have had a historical Implied Volatility <=35% for the options with the nearest strike price. The strategy performed well but it would cost the fund $400/month for an options data feed in our account and would cancel out returns.
Thank you everyone for following along with our live track record. The support and constructive criticism gets us excited to work on this each Friday. As always, we encourage our readers to stay involved by requesting trading strategies for us to test for the InternFund.
Stay tuned,
Derek Melchin
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.
Tamim Fund
For the option straddle strategy, it only gets the option with the absolute lowest strike price. The expiry doesn't matter since it is sorted by the strike price afterwards.
Could you explain the logic behind this strategy? It seems that it relies on the variety of the underlying options, since only very very deep ITM calls will be worth between .7 and 1.3x the security price, instead of relying on some trading principle.
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.
Tamim Fund
I just ran it, and the reason it works is because 99% of the time, the only call options with a low enough strike price to fit the parameters is apple's and sometimes, GS, V, TGT, and MSFT. Apple has been going up for the past decade. About 80% of the orders over the past 5 years is just Apple. In the past year, there has been more Microsoft, but it is still mostly Apple.
If I am wrong, please correct me.
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!