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
Assume a security with last 2 days closing [10, 12]. If my strategy is to trade when price is above 2 day SMA (daily close).
On 3rd day: before market opens 2d SMA is (10+12)/2 = 11. After market opens, first minute, price is 11. The running 2d SMA should be (12+11)/2 = 11.5. second minute, price is 11.5. The running 2d SMA should be (12+11.5)/2 = 11.75.
Now this is very simple case and I could do this manually. But thigs could go complicated. For example, what is I need to consider RSI instead.
What's the most simple/ elegent way to get indicator values based on a different resolution than ticker data, but updated live to consider last available 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.
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.
One approach I found is to use call Update function on indicator. I supplied only date part and closing price of the Slice. Not sure if this is the right approach though.
0
Alexandre Catarino
,
Hi Mukesh Chakravarti ,
When the algorithm creates an indicator with a helper method, it is automatically updated by the engine with the required resolution. No need to use the Update method, just this:
I knew that Alexandre. If the data resolution is minute and indicator rsolution is daily, indicator gets update once per day. Which might be right behaviour in many cases but not something I am looking at. The indicators should use the latest price data available at that point in time.
If I am trading on 200 days SMA crossover, and the price moved significantly intraday, the daily indicator will still be showing the SMA based on yesterday close.
I wanted the minute data to be reflected in the daily indicator calculation.
1
Alexandre Catarino
,
Hi Mukesh Chakravarti ,
Sorry about the wait.
In order to achieve that behavior, you will have to create a custom indicator, since Lean indicators were not designed to recalculate its last value until the resolution frontier is crossed.
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!