Hello everyone:
I have setup a basic framework to test daily resolution based trades (much like classes in the file BasicTemplateFrameworkAlgorithm.cs). However, I found that the default resolution is "minute" and it seems hard to do daily resolution based trades in LEAN framework.
For example:
In Alpha Create stage, I use indicators like ADX or MACD to test if there is a trend on daily candles and calculate the stop price to buy the stock. But there is no way to pass these stop prices to the following stages(PortfolioConstruction, RiskManagement, Execution...).
In LEAN examples, I found that most trades are made by MarketOrder. Since most examples are run in minute resolution, it works fine. However in daily resolution based trades I always use StopMarketOrder or StopLimitOrder. I seldom find an example to use such order types and run in daily resolution like in my situation.
Could anyone tell me how can I do it? Thanks!
Varad Kabade
Hi Code quant,
We recommend using higher frequency data(minute,hour) for more accurate filling prices. Refer to this thread to see how to implement a daily signal-based algorithm at minute resolution.
In the algorithm framework, the orders are handled by the Execution model. We can implement our own execution model refer to the following doc. We also recommend taking a look at our built in Execution models-[Standard Deviation Execution model, VWAP Execution model]. Alternatively, we can also modify the Immediate execution model to the following code snippet. In the attached backtest we have created a demo algorithm for your reference.
Best,
Varad Kabade
Code quant
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!