LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
Hi, I'm new to this site, I've been using Quantopian mostly. I had a question regarding syntax/how to approach my algorithm within the structure of QuantConnect. So what I'm trying to do is buy a stock, let's say "IBM" at open and keep track of that price. Then throughout the day sell all my shares in IBM if the current price rises by 30 cents or so, and buy as much as I can if the price drops by 20 cents or so. Then at the end of the day just sell all shares. Very simple but my implementation is throwing lots of errors :(
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.
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
1.8k
,
Hi Michael, I'd suggest checking out the algo examples. You will likely find something that could be used as a base for your algo. -E
0
Michael John
49
,
0
Edited by Michael John
Michael John
49
,
Thanks for the advice :) I'm now curious why my returns are so horrid based on the backtest above, I was expecting around 30 percent return or so. Any obvious/trivial reason that you see why my returns are this way?
0
Gurumeher Sawhney
16.5k
,
Welcome to the QuantConnect community! It looks like the algorithm is doing exactly what was intended. If we walk through the trading logic, AAPL is bought at market open and then we decide to either invest in AAPL if the price is going down by 20 cents, or sell AAPL if the price is going up by 30 cents. So we set a limit on the daily profit to 30 cents per share, and have an unlimited loss until the end of trading day.
0
Michael John
49
,
Awesome, thanks Gurumeher! Was the choice of OnTick rather than OnData the correct move if you don't mind me asking your opinion? Thanks 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.
Loading...
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!