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 11-18-2010, 06:06 AM   #1
adamus
Senior Member
 
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
Default Writing indicator for MarketAnalyzer - 60min bars and CalculateOnBarClose=false

I want to display how far an instrument moved in the last bar, e.g. 60 min time frame.

I thought the easiest way to do this would be:

Code:
Value.Set(Close[0] - Close[1]);
and then to choose the time frame when adding the indicator as a column to the Market Analyzer.

I would like it to display how far it moved in the last 60 mins at any instant in time, not just the last 60 min bar on a chart i.e. 11:00 to 11:59. So I set CalculateOnBarClose to false.

However this doesn't show the results I am expecting. I think this shows how far it moved since the close of the last bar.

How should I achieve what I want? Shall I forget about trying to use 60 mins bars and use 10 second bars and just calculate the number of bars in a 60 min interval? Or is there a simpler way?

Thanks
adamus is offline  
Reply With Quote
Old 11-18-2010, 06:24 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

adamus, correct this would show you how much the instrument moved since the Close[1].

What were you looking for? The Range of the bar instead?

Perhaps the High[0] - Close[1] and Low[0] - Close[1] difference taken as absolute would do?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-18-2010, 06:59 AM   #3
adamus
Senior Member
 
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
Default

It's difficult to be totally unambiguous about what I want, but i'll try.

I want the column in Market Analyzer to show how far the instrument has moved in the last x time periods at any instant in time.

i.e. if I choose 1 day, I want to see how far it has moved in the last 24 hours from now.

if I choose 1 hour and it's 13:45, I want to see how far it's moved since 12:45.

I initially thought it would be easiest to use the dataseries time frame to define what I want to see, but this isn't working the way I'm doing it - as you described.
adamus is offline  
Reply With Quote
Old 11-18-2010, 07:14 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

adamus, I see what you're saying - then you would need to custom calculate your hour reaching back from current time on a finer series.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-18-2010, 08:20 AM   #5
adamus
Senior Member
 
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
Default

OK, I've done it like that. It works well, although I restricted the parameters to just the number of minutes, instead of allowing a choice of time frame units.
adamus is offline  
Reply With Quote
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
Strategy.CalculateOnBarClose=true vs. Indicator.CalculateOnBarClose=false karimatka Strategy Development 7 05-23-2011 03:39 AM
CalculateOnBarClose = false\true nkonkov Strategy Development 3 06-17-2010 03:28 AM
CalculateOnBarClose = false; Rhyshaelkan Indicator Development 1 11-19-2009 03:42 PM
DataSeries as Input for Indicator with CalculateOnBarClose = false cbaer Indicator Development 1 01-14-2009 03:56 AM
what really happens when calculateonbarclose = false verge Strategy Development 9 07-28-2008 01:50 AM


All times are GMT -6. The time now is 01:26 AM.