Hey @Juan!
The code you tried will work on the next deploy we do. I meant to add that feature long ago. As it stands currently, the Times (and Add, Minus, Over) functions require an indicator as input, so the value of '2' doesn't work. I'm going to add overloads today to accepts decimal values.
Here's a snippet that does work, and I've attached the updated code with the snippet :)
int slow = (int) Math.Pow(period, 2);
int fast = slow/2;
// create our two 'source' indicators that feed into the hull moving average
var slowLwma = LWMA("SPY", slow);
var fastLwma = LWMA("SPY", fast);
// create an indicator that is twice the 'fastLwma' -- I'll add code to remove the
// need to specify the ConstantIndicator noise, so in the future you'll be able to say
// fastLwma.Times(2); :)
var twiceFast = fastLwma.Times(new ConstantIndicator
("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 IndicatorBase and return an IndicatorBase, it basically just maps an indicator data points into OHLC so it can be consumed by the Donchian Channels. Not the prettiest but it gets the job done :)
As always Juan, thanks for sharing!!