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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-14-2009, 06:22 AM   #1
jjthetrader
Member
 
Join Date: Jan 2008
Posts: 71
Thanks: 0
Thanked 0 times in 0 posts
Default Highest High

Hello, I'm basically building off of Ninjas Swing High/Low indicator here and was wondering how to reference that highest high bar or lowest low bars info. I would actually like to get the range of the highest high bar and do some calculations from that. I would also like to reference the bar after that swing low to get it's range as well.

In the attach pic the arrows show the bars to which I'd like to reference. And like the swing high/Low, after a new one is formed, start referencing that new one.

I'm pretty new to Ninja programming coming over from TS. Sorry if this is a really basic inquiry.
Attached Images
File Type: jpg range.jpg (23.2 KB, 31 views)
jjthetrader is offline  
Reply With Quote
Old 05-14-2009, 07:08 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,382
Thanks: 252
Thanked 967 times in 950 posts
Default

Hi jjthetrader, the swing indicator gives you two methods to work with -

1. access how many bars ago the swing point occured with SwingHighBar / SwingLowBar

or

2. access the current swing value with SwingHigh / SwingLow

An example call and the needed syntax can be found here - http://www.ninjatrader-support.com/H...eV6/Swing.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-14-2009, 12:11 PM   #3
jjthetrader
Member
 
Join Date: Jan 2008
Posts: 71
Thanks: 0
Thanked 0 times in 0 posts
Default

Should this condition work to only print if the current hugh is greater than the high of the last 4 bars?

if (High[0] > (MAX(High,4)[0]))


DrawDiamond( "Buy",false, 0, High[0] + TickSize, Color.ForestGreen);

Regarding my drawing of the diamond, is there any way to set the size. I may have the wrong input in the initialize section?:
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Dot, "Buy"));

thanks
Last edited by jjthetrader; 05-14-2009 at 12:15 PM.
jjthetrader is offline  
Reply With Quote
Old 05-14-2009, 12:13 PM   #4
roonius
Certified NinjaScript Consultant
 
Join Date: Oct 2008
Location: Chicago, IL
Posts: 523
Thanks: 0
Thanked 3 times in 3 posts
Send a message via Skype™ to roonius
Default

Quote:
Originally Posted by jjthetrader View Post
Should this condition work to only print if the current hugh is greater than the high of the last 4 bars?

if (High[0] > (MAX(High,4)[0]))

thanks
It will never work since MAX includes current. It will work if you change it to:

if (High[0] > (MAX(High,4)[1]))
roonius is offline  
Reply With Quote
Old 05-14-2009, 12:19 PM   #5
jjthetrader
Member
 
Join Date: Jan 2008
Posts: 71
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by roonius View Post
It will never work since MAX includes current. It will work if you change it to:

if (High[0] > (MAX(High,4)[1]))
much appreciated, that worked!
jjthetrader 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
alert on Highest High in 7 bars rakeshSharma Miscellaneous Support 13 04-22-2009 07:08 AM
Retrieving Highest High for today 1reason Indicator Development 1 01-12-2008 01:59 PM
Highest High in a LookBack Period daven Indicator Development 2 09-28-2007 12:39 PM
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 10:40 AM.