![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Mar 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Mar 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
It will be whatever chart the strategy is applied to.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Mar 2008
Posts: 75
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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...
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |