I want to use HMA indicator on, say 30, mins bars. I have copied the HMA class from Opening Breakout Algo and the consolidator from the Indicator Examples (BB, MACD, SMA, EMA, RSI, ATR) example. I thought the attached code would work but the trades are not evaluated on the consolidated bar I specified. I have verified the HMA logic using purely Hourly resolution and it worked.

//Add as many securities as you like. All the data will be passed into the event handler:

AddSecurity(SecurityType.Equity, Symbol, Resolution.Hour);

HMA = new HullMovingAverage(Symbol+"_HMA_",40);

RegisterIndicator(Symbol,HMA,Resolution.Hour,Field.Close);

but I do not know what went wrong with this consolidator codes. Actually I was trying to use

AddSecurity(SecurityType.Equity, Symbol, Resolution.Minute);

HMA = new HullMovingAverage(Symbol+"_HMA_",40);

RegisterIndicator(Symbol,HMA,Resolution.Hour,Field.Close);

which I thought would be a system based on Hourly price but placing trade on the next minute as I have used on built-in indicators before. And that is why I switched to consolidator to see if could solve the problem

If I use the same consolidator with built-in indicator like SMA in the following style I can see all the trades evaluated every 30 mins and executed at every 31 and 01 minute as I wanted. I do not know what went wrong with my use of consolidators in the HMA case. Any suggestion is appreciated. Thanks.

private SimpleMovingAverage fast;

private SimpleMovingAverage slow;

TradeBar _spyMinutes;

public override void Initialize()

{

SetStartDate(2015, 01, 01);

SetEndDate(2015, 12, 31);

SetCash(10000);

AddSecurity(SecurityType.Equity, Symbol, Resolution.Minute);

// define our daily trade bar consolidator. we can access the daily bar

// from the DataConsolidated events, this consolidator can only be used

// for a single symbol!

var minConsolidator = new TradeBarConsolidator(TimeSpan.FromMinutes(30));

// attach our event handler. the event handler is a function that will be called each time we produce

// a new consolidated piece of data.

minConsolidator.DataConsolidated += OnFiveMinutes;

// this call adds our daily consolidator to the manager to receive updates from the engine

SubscriptionManager.AddConsolidator(Symbol, minConsolidator);

int fastPeriod = 2;

int slowPeriod = 16;

fast = new SimpleMovingAverage(Symbol + "_SMA_" + fastPeriod, fastPeriod);

slow = new SimpleMovingAverage(Symbol + "_SMA_" + slowPeriod, slowPeriod);

// we need to manually register these indicators for automatic updates

RegisterIndicator(Symbol, fast, minConsolidator);

RegisterIndicator(Symbol, slow, minConsolidator);

}

private void OnFiveMinutes(object sender, TradeBar consolidated)

{

_spyMinutes = consolidated;

//Log(consolidated.Time.ToString("o") + " >> " + Symbol + ">> LONG >> 100 >> " + Portfolio[Symbol].Quantity);

// if you want code to run every five minutes then you can run it inside of here

}