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 09-07-2011, 03:26 PM   #1
Grasul
Member
 
Join Date: Jul 2011
Posts: 38
Thanks: 15
Thanked 1 time in 1 post
Default The Lowest Low or Highest High for the last X bars

I was wondering if anyone has a clever way to calculate the highest high or lowest low over a number of bars.

The Max and Min functions only accept two values, and I can create a series of statements checking back one bar at a time, but that seems ponderous and like there must be a more clever way.

Any thoughts?
Grasul is offline  
Reply With Quote
Old 09-07-2011, 03:37 PM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Grasul,

The built in indicators MAX() and MIN() offer this. You may be looking at Math.Min and Math.Max which only accept two values.
NinjaTrader_RyanM is offline  
Reply With Quote
The following 2 users say thank you to NinjaTrader_RyanM for this post:
Old 09-07-2011, 04:51 PM   #3
Grasul
Member
 
Join Date: Jul 2011
Posts: 38
Thanks: 15
Thanked 1 time in 1 post
Default

Thanks for your help.
Grasul is offline  
Reply With Quote
Old 09-07-2011, 08:19 PM   #4
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,189
Thanks: 180
Thanked 302 times in 260 posts
Default

Quote:
Originally Posted by Grasul View Post
Thanks for your help.

I was thinking about this recently too... thanks for asking.
sledge is online now  
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
Highest High Lowest Low N bars back Ccowl1 General Programming 6 11-05-2010 01:47 PM
Highest High/Lowest low of last 'n' bars hari_krishna Indicator Development 1 02-15-2010 07:00 AM
Indicator displaying highest/lowest close instead of high/low atxtrader Indicator Development 3 12-14-2009 10:28 AM
Charting Highest High And Lowest Low Of Prior Day pedroprada@bellsouth.net Charting 3 12-29-2008 10:17 AM
highest high / lowest low of first hour of trading velocity General Programming 7 06-16-2008 09:07 AM


All times are GMT -6. The time now is 01:59 PM.