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
In a LEAN QCAlgorithm, I can request a trade and emit an Insight with either self.SetHoldings() or self.EmitInsights().
In the former method, trades are executed immediately as specified, such that I can monitor the precise points for market entry / exits and position a strategy accordingly.
However, in the latter method, trades are closed after the duration expires, such that they'll often close too soon or too late -- particularly when thinking about a market in terms of volume-bars, dollar-bars, or price-bars rather than time-bars.
Should a strategy first submit a worst-case duration in an insight, then emit a follow-up InsightDirection.Flat at a minimum timedelta duration to try to close out a position at the right time? Or, is it appropriate to use self.SetHoldings?
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.
Rahul Chowdhury
39.9k Pro
,
Hey Ryan,
It is true that SetHoldings gives you more fine control over your positions. However, the skill of a forecast (Insight) is measured by its direction and duration. You should instead focus on making more accurate forecasts/Insights.
If you aren't sure about the trend duration, it's better to use short insights and keep emitting them. We don't recommend emitting flat insights as its kind of misuse of what it was designed for (signally a period of flatness/no volatility)
Best Rahul
0
Edited by Jared Broad
Jared Broad
Pro
,
I think the root of what you're seeking Ryan is a misuse of the framework? Not all algorithms will fit nicely into a framework design, and I wouldn't recommend trying to make it fit. If you're OK with alpha being totally separate from execution then its OK, you can emit predictions about the market and trust the rest of the system to execute them.
If you need trade by trade control, I'd recommend using the classic style algorithms. There you can bind to order events and act as they get filled with micro control on every aspect of the strategy.
1
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.
Ryan Bell
2.6k Pro
,
Initially, I was approaching the alpha design from a more event-driven price-focused mindset. Meaning, streaming market conditions would unfold to trigger order placements of indeterminate length (roughly equal to the average order duration or the average trend length), then later conditions would signal a change in direction or position.
Thinking of the market in terms of quantized blocks of time with confidence-scored directionality predictions looks like a much different, interesting challenge. Now, I'm getting 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.
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!