Downloading history
Using historical data for indicator or strategy calculations
// Download 15 min bars for august 2018
IHistoricalData historicalData = Symbol.GetHistory(Period.MIN15, HistoryType.Bid, new DateTime(2018, 8, 1, 0, 0, 0, DateTimeKind.Utc), new DateTime(2018, 8, 31, 0, 0, 0, DateTimeKind.Utc));// Download 15 min bars for last day with real time data
IHistoricalData historicalData = Symbol.GetHistory(Period.MIN15, HistoryType.Bid, DateTime.UtcNow.AddDays(-1));// Downloading bars history
IHistoricalData historicalData = Symbol.GetHistory(Period.MIN15, HistoryType.Bid, DateTime.UtcNow.AddDays(-1));
// An example of access data from the bar:
double openPrice = ((HistoryItemBar)historicalData[0]).Open;
double closePrice = ((HistoryItemBar)historicalData[0]).Close;
double volume = ((HistoryItemBar)historicalData[0]).Volume;
DateTime leftBorderOfBar = ((HistoryItemBar)historicalData[0]).TimeLeft;// Downloading ticks history
IHistoricalData historicalData = Symbol.GetHistory(Period.TICK1, HistoryType.Bid, DateTime.UtcNow.AddDays(-1));
// An example of acces data from the tick:
double bidPrice = ((HistoryItemTick)historicalData[0]).Bid;
double askPrice = ((HistoryItemTick)historicalData[0]).Ask;
Last updated