NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-18-2011, 08:59 PM   #1
saltminer
Senior Member
 
Join Date: Apr 2008
Posts: 164
Thanks: 2
Thanked 3 times in 3 posts
Default Multi timeframe indicator DataSeries forgets values

Hi,
I have a multi timeframe indicator, the Bars are 5m, 30m, 60m.
Most of the calculation is done on the 5m.
I have a custom DataSeries synced to the 5m (BarsArray[0]).

If I set a value into the DataSeries (for a signal for example) in BarsInProgress==0, it is remembered just fine UNLESS this bar's timestamp coincides with a bar in another timeframe. So on the half hour and on the hour, the DataSeries forgets its value.
I programmed a variable to remember the value and set it again from the higher timeframes, (which are executed after BarsArray[0]) however DataSeries.Set(value) doesn't seem to work from a timeframe other than the one the DataSeries is synced to.

So I currently have no workaround for this problem.

Suggestions please?
Thanks,
saltminer
saltminer is offline  
Reply With Quote
Old 01-19-2011, 07:31 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

Hi saltminer, what do you mean by 'forget' it's value - what value are you getting printed for this 'conflict' bar then?

Would you have a sample of code I could check into here?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 01-25-2011, 06:41 PM   #3
saltminer
Senior Member
 
Join Date: Apr 2008
Posts: 164
Thanks: 2
Thanked 3 times in 3 posts
Default

HI Bertrand,
I have emailed you some code.
The value is 'forgotten' by being set to the bar's Close price, which is what happens for a DataSeries if Set() is not used during an OnBarsUpdate().
Cheers,
saltminer
saltminer is offline  
Reply With Quote
Old 01-26-2011, 10:00 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

Ok got it Saltminer, will take a look shortly.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 01-26-2011, 02:13 PM   #5
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

Replied via email directly saltminer.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 01-28-2011, 12:52 AM   #6
saltminer
Senior Member
 
Join Date: Apr 2008
Posts: 164
Thanks: 2
Thanked 3 times in 3 posts
Default

Hi Bertrand,
thank you for taking the time to run my code. Yes, the signal remains only for a single bar. However, the signal at ten minutes past the hour is not a test of the problem.
If the signal occurs at a time when there is also a bar on another timeframe, for instance at the hour or the half-hour, then the value in the signals dataseries does not remain. it gets changed to the Closing price of the bar.

I have gotten around it by creating a public double value, which will remember a value I set to it, but the overall principle of multi-timeframe indicators is going to be very difficult to use if a simultaneous OnBarsUpdate from another timeframe is going to obliterate any data generated in the principle timeframe.

Cheers,
saltminer

Quote:

Here's what I get running your code on 5 min ES Replay for yesterday -

1/25/2011 7:10:00 PM found setup bar but it ADX is beneath required
level of 25
1/25/2011 7:10:00 PM indicator: BIP 0 signals[0] = 1
1/25/2011 7:15:00 PM indicator: BIP 0 signals[0] = 0

This looks like the signal is really only set for the signal bar.
saltminer is offline  
Reply With Quote
Reply

Tags
dataseries, indicator, multitimeframe

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing DataSeries with multi timeframe indicators trader2be General Programming 5 01-06-2011 06:35 AM
Dataseries problem in Multi-timeframe strategy bridenour Automated Trading 2 07-25-2009 05:06 AM
Multi timeframe dataseries astrolobe Strategy Development 1 06-17-2009 05:47 AM
Accessing Multi Timeframe Indicator Values TAJTrades Indicator Development 11 03-02-2009 07:11 AM
indicator values multi vs single timeframe ceesvh Strategy Development 3 09-19-2007 09:11 PM


All times are GMT -6. The time now is 07:02 PM.