Could you help me on how to access daily data series from an indicator running on intraday charts?
The Add() function only works in strategies not indicators.
By modifying the pivot indicator source code I came up with the following code, which seems working to
some extend. However I am not quite understand how the Data class and Bars class are defined, thus
I donot quite understand the following code. the dailyBars supposely should be from 40 calendar day ago to present, but why is the oldest daily bar is of less index so that I have to use dailyBars.Get(dailyBars.Count-1) to access
the last daily bar? Also where are Bars.From and Bars.To defined? Where can I find more information about these classes?
What is the best way to convert the function getValue() and getValueAbsolute() in eSignal EFS APIs into NinjaScript,
especially when accessing the data of other time frame and/or symbol? For example,
var C = getValueAbsolute("Close", 0, -8, "ES M8,D")
creates an eight element array, in which C[0] is the most recent daily close price of "ES M8" and C[7] is the daily
close price seven days ago.
protected override void OnBarUpdate()
{
if ( ! isDailyDataLoaded && ! isInitializing )
{
isInitializing = true;
dailyBars = Data.Bars.GetBars(Bars.Instrument, new Period(PeriodType.Day, 1), Bars.To.AddDays(-40), Bars.To, (Session) Bars.Session.Clone(), Data.Bars.SplitAdjust, Data.Bars.DividendAdjust);
existsHistDailyData = (dailyBars.Count <= 1) ? false : true;
isInitializing = false;
isDailyDataLoaded = true;
}
if (existsHistDailyData)
{
if ( ( Count -1 - CurrentBar ) == 0 ) {
yesterdayDailyBar = dailyBars.Get(dailyBars.Count-1);
if ( yesterdayDailyBar.Time != D1 || FirstTickOfBar ) {
D1 = yesterdayDailyBar.Time;
double YC = yesterdayDailyBar.Close;
......
}
}
}
}
- Clearpicks

Comment