NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 03-19-2008, 02:29 PM   #1
strategy1
Member
 
Join Date: Mar 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
Default Getting the First Hour High.

Hello, I am new to NT. I have programmed before so I am not really new to programming. What I need to do is to get the first hour's high and then trade when that high is breached.
Sounds simple - yet I cannot seem to be able to do this using the strategy wizard.
Also I don't think coding something like :
if ToTime(Time[0]) >= 10300
set FirstHourHigh = CurrentDayOHL().CurrentHigh
Then
If Close[0] > FirstHourHigh
buy

I don't think this will work since it will constantly repopulate the FirstHourHigh every time a new high is reached.
If I change it to If ToTime = 10300 then my computer has to be on at that time to make sure I get a correct value for the first hour high, which is not always possible.
I need to be able to turn my computer at any time and be able to run the strategy which will get the first hour high and generate a trade when that high is breached.

This also means that there will be no trades before 10:30 as the high is unknown yet.

Am I missing something? Is there a way to do this?
Any help would be greatly appreciated.

Thanks
strategy1 is offline  
Reply With Quote
Old 03-19-2008, 02:43 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

Welcome

Please see the following page. Reference sample #4 might provide you some assistance in this area.

http://www.ninjatrader-support.com/v...ead.php?t=3220
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-19-2008, 02:59 PM   #3
strategy1
Member
 
Join Date: Mar 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
Default

if (Bars.BarsSinceSession < 30 && High[0] > highestHigh)
highestHigh = High[0]

In the above how many minute bars are these? 5 Min Bars, 30Min Bars? Is there a way to set it to a specific bar (ie. 5 minute bar)

Thanks
strategy1 is offline  
Reply With Quote
Old 03-19-2008, 03:16 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

It will be whatever chart the strategy is applied to.
NinjaTrader_Ray is offline  
Reply With Quote
Old 03-19-2008, 03:27 PM   #5
strategy1
Member
 
Join Date: Mar 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
Default

Do you mean if I apply it to a chart with 5 min bars then it will be 5 min and if I apply it to 30 min bars it will be 30min.

But what I want to do is backtest this across say the DOW 30 stocks without having the chart for any of them open.
How would the system know in this case how big or small of a bar to work with?
strategy1 is offline  
Reply With Quote
Old 03-19-2008, 03:36 PM   #6
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

The reference sample refers to 30 bars which could be of an interval depending on what your backtest was set to. If you run a basket backtest using 1 min bars, then the reference sample would mark the high of 30 bars etc...
NinjaTrader_Ray 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
How to execute something every hour/half hour etc altrader General Programming 2 03-19-2008 02:52 PM
CrossAbove(High, High, 1) Lost Trader Indicator Development 4 01-11-2008 09:27 AM
Why is hour granularity unsupported? henry.omd Miscellaneous Support 1 12-24-2007 09:53 AM
High greater than Highest High of last 20 Bars SamIam Strategy Development 1 08-19-2007 04:58 PM
1st Hour High/Low pijamatrader Indicator Development 42 07-16-2007 05:31 PM


All times are GMT -6. The time now is 02:52 AM.