Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Getting the First Hour High.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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

    #2
    Welcome

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

    RayNinjaTrader Customer Service

    Comment


      #3
      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

      Comment


        #4
        It will be whatever chart the strategy is applied to.
        RayNinjaTrader Customer Service

        Comment


          #5
          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?

          Comment


            #6
            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...
            RayNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bmartz, 03-12-2024, 06:12 AM
            2 responses
            19 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by funk10101, Today, 12:02 AM
            0 responses
            3 views
            0 likes
            Last Post funk10101  
            Started by gravdigaz6, Yesterday, 11:40 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by MarianApalaghiei, Yesterday, 10:49 PM
            3 responses
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by XXtrader, Yesterday, 11:30 PM
            0 responses
            4 views
            0 likes
            Last Post XXtrader  
            Working...
            X