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-21-2009, 05:51 PM   #1
hilltop
Junior Member
 
Join Date: Aug 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Unhappy Highest High of last 10 bars

I am trying to write an indicator to find the Highest High of the past 10 bars. I am not sure whether to use MAX
or
I also tried using the HighestBar and then placing the result in High[barsAgo] where the barsAgo = HighestBar but the data type gets mixed up
Would appreciate some help as I am new to this programming language I understand the logic to use but am unfamiliar with the syntax and commands I can use.

Hilltop
hilltop is offline  
Reply With Quote
Old 08-22-2009, 06:53 AM   #2
RJay
Senior Member
 
Join Date: May 2008
Location: Hartford, CT. USA
Posts: 618
Thanks: 12
Thanked 24 times in 18 posts
Default

Hilltop,

put this in the variables section.
----------------------------------------

private double HH = 0;

-----------------------------------
In the OnBarUpdate() section,
----------------------------------------

HH = High[Bars.HighestBar(10)];

-----------------------------------

OR

You can do something similar with "Max"

Your choice,


RJay
RJay is offline  
Reply With Quote
Old 08-22-2009, 07:26 AM   #3
velocity
Senior Member
 
Join Date: Dec 2007
Posts: 314
Thanks: 0
Thanked 0 times in 0 posts
Default

or something like this

double lowestlow = MIN(Low, 10)[0];
double highesthigh = MAX(High, 10)[0];



then use it like this

if(Low[0] <= lowestlow){ whatever }
velocity is offline  
Reply With Quote
Old 08-25-2009, 02:13 AM   #4
hilltop
Junior Member
 
Join Date: Aug 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Highest High

Thanks rt That's a great help
Quote:
Originally Posted by rt6176 View Post
Hilltop,

put this in the variables section.
----------------------------------------

private double HH = 0;

-----------------------------------
In the OnBarUpdate() section,
----------------------------------------

HH = High[Bars.HighestBar(10)];

-----------------------------------

OR

You can do something similar with "Max"

Your choice,


RJay
hilltop is offline  
Reply With Quote
Old 08-25-2009, 02:18 AM   #5
hilltop
Junior Member
 
Join Date: Aug 2009
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Highest High

Thanks velocity
I will also try this.
Hilltop

Quote:
Originally Posted by velocity View Post
or something like this

double lowestlow = MIN(Low, 10)[0];
double highesthigh = MAX(High, 10)[0];



then use it like this

if(Low[0] <= lowestlow){ whatever }
hilltop 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
Compute Highest High between 9:30 AM and 10:30 AM mgbloomfield Indicator Development 5 03-20-2013 04:26 PM
Highest High jjthetrader General Programming 4 05-14-2009 12:19 PM
alert on Highest High in 7 bars rakeshSharma Miscellaneous Support 13 04-22-2009 07:08 AM
Highest high of a time frame pablo_lasuncion Strategy Development 5 09-04-2007 02:05 PM
High greater than Highest High of last 20 Bars SamIam Strategy Development 1 08-19-2007 04:58 PM


All times are GMT -6. The time now is 06:36 PM.