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 08-20-2012, 02:52 AM   #1
savekad
Senior Member
 
Join Date: Jul 2012
Posts: 158
Thanks: 28
Thanked 4 times in 4 posts
Default Historical is a liar

Historical returns true when using Zen-Fire demo connection in real-time. Why is that?

Until now, I have managed to get a false out of it only by using the Market Replay and deleting data history prior to the stream.
savekad is offline  
Reply With Quote
Old 08-20-2012, 02:56 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Do you test from an indicator or strategy?

Single series or MultiSeries setup?

Thanks,
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 08-20-2012, 03:28 AM   #3
savekad
Senior Member
 
Join Date: Jul 2012
Posts: 158
Thanks: 28
Thanked 4 times in 4 posts
Default

Single series indicator.

I put the if (Historical) return; at the OBU so when I load the indicator it won't have to iterate all existing bars and instead it will call OBU at each close of a present bar.
savekad is offline  
Reply With Quote
Old 08-20-2012, 03:32 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Quote:
Originally Posted by savekad View Post
Single series indicator.

I put the if (Historical) return; at the OBU so when I load the indicator it won't have to iterate all existing bars and instead it will call OBU at each close of a present bar.
Correct, this would then call OBU only on realtime bars as it returns out on historical ones.

How do you check for the historical condition in your code?
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 08-20-2012, 03:42 AM   #5
savekad
Senior Member
 
Join Date: Jul 2012
Posts: 158
Thanks: 28
Thanked 4 times in 4 posts
Default

OnBarUpdate()
{
if (Historical)
{
ClearOutputWindow();
Print("Historical data found.");
return;
}
*rest of the code*
}
savekad is offline  
Reply With Quote
Old 08-20-2012, 03:45 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

You will see then prints for Historical data of course with this setup. As the OnBarUpdate() runs through the historical chart portion as well before hitting live data.

Try something like -

if (Historical)
return;

Print(Historical);
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 08-20-2012, 03:51 AM   #7
savekad
Senior Member
 
Join Date: Jul 2012
Posts: 158
Thanks: 28
Thanked 4 times in 4 posts
Default

Of course. The thing is that when reaching the real-time bar, it keeps printing and it doesn't executes the code. I waited more for than 3 new bars to be created.
savekad is offline  
Reply With Quote
Old 08-20-2012, 03:55 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

So what does it print then? True or false?
NinjaTrader_Bertrand is online now  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Old 08-20-2012, 05:52 AM   #9
savekad
Senior Member
 
Join Date: Jul 2012
Posts: 158
Thanks: 28
Thanked 4 times in 4 posts
Default

Damn...

Never mind, you were right. It's working now.
savekad is offline  
Reply With Quote
The following user says thank you to savekad for this post:
Reply

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
Historical data persists after deleting from historical data manager? llstelle Miscellaneous Support 1 03-25-2012 06:35 PM
Differences in data: GAIN live, GAIN historical, NT historical terenyi Connecting 2 01-12-2010 06:15 PM


All times are GMT -6. The time now is 08:46 AM.