Hi gang,
I want to share with you this implementation of the Hull Moving Average. This MA is a LWMA of a LWMA difference.
[tex]HMA(n) = LWMA( 2 LWMA(\frac{n^{2}}{2}) - LWMA(n^{2}))[/tex]
I ended up making an indicator because I couldn’t make the composite indicators works. I tried something like:
LinearWeightedMovingAverage slowLWMA;
slowLWMA = LWMA(symbol, slowLWMAPeriod, resolution);
LinearWeightedMovingAverage fastLWMA;
fastLWMA = LWMA(symbol, fastLWMAPeriod, resolution);
LinearWeightedMovingAverage HMA = new LinearWeightedMovingAverage(HMAPeriod);
var hma = HMA.Of(fastLWMA.Times(2).Minus(slowLWMA));
Plus tons of variants until I decided to try it making it as an indicator. And, in the indicator file, I ended up making a method for the LWMA (Yeah, seems silly I know. Now @MichelH will teach us how to make the whole thing in two lines of code).
Finally with this basic strategy, I couldn’t apply a Donchian channel for a composite indicator.
But, at least, works :)
Cheers, JJ
Michael Handschuh
("2", 2)); var interior = twiceFast.Minus(slowLwma); // take the LWMA of all the other stuff HMA = new LinearWeightedMovingAverage(period).Of(interior);
Another way to do this is through the usage of the FunctionalIndicator. The FunctionalIndicator uses functions as inputs, so it's a little more advanced. Here's some references for reading up on anonymous functions/lambda expressions in C#, any questions feel free to ask me! https://msdn.microsoft.com/en-us/library/bb397687.aspx https://en.wikipedia.org/wiki/Anonymous_function#C.23 http://www.codeproject.com/Tips/298963/Understand-Lambda-Expressions-in-minutes Interestingly I got different results than your implementation of the HullMovingAverage. Is there an external data source we can compare results with? We can add the HullMovingAverage to the LEAN engine and I can write some tests against it to verify the implementation is correct :) If you can find an external data source for verification, please write up an issue here to add the HullMovingAverage. As for the reason why channel.Of(signal) doesn't work is because the donchian channels require a trade bar input, but the 'signal' outputs an indicator data point. Maybe what we need is a way to input indicator data points as flat trade bars (OHLC = IndicatorDatePoint.Value). I've added an extension method at the bottom of main which will take an IndicatorBaseJayJayD
Resolution resolution = Resolution.Daily;
to Minute and the results get closer. However there are differences, your implementation is better!! So, most of the difference between your backtest and the mine is because a last second change when sharing (copying from VS and pasting in the platform)... however I attached the last backtest of the last version to the post IDK why the difference. Sorry for my newbiness but, Can simulated data be used as an external data source we can compare the results with?Michael Handschuh
Gene Wildhart
JayJayD
Nicholas Stein
Nicholas Stein
JayJayD
Nicholas Stein
JayJayD
Nicholas Stein
JayJayD
Nicholas Stein
JayJayD
Info
Hi any python implementation for WMA( indicator, period) ?
Louis Szeto
Hi Info
LWMA in this post and Weighted Moving Average, which is commonly known as WMA, are the same thing. The "L" in here is just for easy identification on using linear weighting, as to differentiate from Exponential Moving Average (EMA/EWMA). Implementation could be done by:
For using WMA on an indicator, please refer to IndicatorExtensions for combining them. To get custom weighting, we suggest using IndicatorExtensions.Of with custom FIR_Filter indicator.
Best
Louis Szeto
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.
JayJayD
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!