![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jan 2008
Posts: 257
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
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 |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Access daily ATR from intraday chart | sunnyrain | Indicator Development | 8 | 11-12-2008 01:39 PM |
| historical data, daily charts... | funk101 | Miscellaneous Support | 4 | 11-15-2007 06:06 AM |
| Daily Charts with IB Data Feed | MichaelB | Charting | 4 | 11-05-2007 01:13 AM |
| Referencing daily data within an intraday script | jonesr227 | Strategy Development | 2 | 08-20-2007 10:42 PM |
| Daily charts ..using tradestation data | riccja | Charting | 5 | 06-13-2007 11:36 AM |