Back

Possible bug, or just my misunderstanding while using Composite Indicator SMA.Of(someindicator)

Hi and thank you all for the fantastic work so far!

First of all I must say I’m not that familiar of C# or Lean so please excuse me for the noobishness.
I’m currently porting my trading strategy from another platform into Lean using Framework implementation. The alphamodel uses multiple standard, custom and functional indicators as the base and also their composites with some multi-level deep nesting of indicators. 
I was trying to use SMA.Of(EMA) – type of indicator, but the results just didn’t add up in terms of algorithm signal and indicator values. I went and did a basic snippet example of the implementation using the ”RSIAlphaModel” as the basis, while trying to mimic my implementation where applicable.

So here’s the problem: for example let’s make a ConstantIndicator of 1000 and then do SMA(name, 4).Of(ConstantIndicator), and then pass it into a separate RollingWindow and then get its rw[0]. Shouldn’t its value be 1000, since a SMA is basically just an average of values for a given period? I wonder what's going on...

If someone more versed on C#/Lean could point out where the problem in the implementation or in my understanding of Lean might be or if it indeed is a bug it would be greatly appreciated. Thank you in advance!

Here are some results and the implementation:

2012-04-01 00:00:00 : Launching analysis for 84b40a4ef6cc72eecc35906efba791b7 with LEAN Engine v2.4.0.0.4303
2012-04-03 00:00:00 : insights = new List<Insight>();
2012-04-03 00:00:00 : Slice data timestamp: 4/3/2012 12:00:00 AM)
2012-04-03 00:00:00 : RW of SMA not ready
2012-04-04 00:00:00 : insights = new List<Insight>();
2012-04-04 00:00:00 : Slice data timestamp: 4/4/2012 12:00:00 AM)
2012-04-04 00:00:00 : RW of SMA not ready
2012-04-05 00:00:00 : insights = new List<Insight>();
2012-04-05 00:00:00 : Slice data timestamp: 4/5/2012 12:00:00 AM)
2012-04-05 00:00:00 : RW_SMA[0] 2012-04-05T00:00:00 - 561.92172245600)
2012-04-05 00:00:00 : RW_SMA[1] 2012-04-04T00:00:00 - 562.34457672800)
2012-04-06 00:00:00 : insights = new List<Insight>();
2012-04-06 00:00:00 : Slice data timestamp: 4/6/2012 12:00:00 AM)
2012-04-06 00:00:00 : RW_SMA[0] 2012-04-06T00:00:00 - 561.59577228800)
2012-04-06 00:00:00 : RW_SMA[1] 2012-04-05T00:00:00 - 561.92172245600)
Update Backtest








Update Backtest





0

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...

This discussion is closed