protected override void OnRun()
// check is symbol is null
Log("Symbol is null", StrategyLoggingLevel.Error);
// Download history (use Renko aggregation)
renkoHistoricalData = Symbol.GetHistory(new HistoryRequestParameters()
HistoryType = Symbol.HistoryType,
FromTime = Core.Instance.TimeUtils.DateTimeUtcNow.AddHours(-6),
Aggregation = new HistoryAggregationRenko(RenkoPeriod, BrickSize, RenkoStyle)
// Subscribe to 'NewHistoryItem' event
renkoHistoricalData.NewHistoryItem += RenkoHistoricalData_NewHistoryItem;
// Create Fast/Slow SMA indicators
fastSmaIndicator = Core.Instance.Indicators.BuiltIn.SMA(FastSmaPeriod, PriceType.Close);
slowSmaIndicator = Core.Instance.Indicators.BuiltIn.SMA(SlowSmaPeriod, PriceType.Close);
// Attach our indicators to downloaded HistoricalData
renkoHistoricalData.AddIndicator(fastSmaIndicator);
renkoHistoricalData.AddIndicator(slowSmaIndicator);
Log(ex.Message, StrategyLoggingLevel.Error);
private void RenkoHistoricalData_NewHistoryItem(object sender, HistoryEventArgs e)
// get high price for new brick
var highPrice = e.HistoryItem[PriceType.High];
// get low price for new brick
var lowPrice = e.HistoryItem[PriceType.Low];
Log(quot;New brick -- High: {highPrice} | Low: {lowPrice}", StrategyLoggingLevel.Info);