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

Isolate beginning and ending time for indicator calc

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

    Isolate beginning and ending time for indicator calc

    Hi, any ideas how I can ask the indicator to use only first 30 min of trading day to do the calculations?

    For example. How can I get the ATR for an instrument for the first 30 min. I suppose I can add the atr to a chart and scroll back to see what that value was in the first 30 min. But my goal is to:

    Atr( for only the first 30 min of trading for the past 20 days)

    So now we have two variables:
    One is isolating the intraday trading time (30 min)
    Second is for the past 20 days

    #2
    calhawk01, the indicator will always use the trading hours of your session template specified, you could not point to using another template for example internally for calculations of custom time portions only.

    What you can of course look into is working out the average values for the past 20 sessions via a custom list for example, where you would store the range for your time period and then take the average.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I was very interested to read your reply, Bertrand.

      I'd really like to know how to creat a "custom list" and if you could give some advice and/or point me in the right direction, I'd be very grateful.

      Cheers.

      Comment


        #4
        Sure, closest I think as a working example for such an idea would be the SessionPivots indicator package from our sharing - http://www.ninjatrader.com/support/f...d=4&linkid=343

        It will calculate the noise and range via a list.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks, Bertrand. I imported SessionPivots and it all seemed to go well and I even restarted NT.

          The trouble is, I can find SessionPivots neither in the chart Indicator box nor in 'Edit Indicator'.

          Does it have another name once in the system?

          Thanks for letting me know.

          Comment


            #6
            arbuthnot, please check under anaCurrentDayOHLV42 - that should be the class name of the study.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks, Bertrand - found it under anaCurrentDayOHLV42, as you said.

              There's a mass of code there but I'm sure I'll learn a lot!

              Cheers.

              Comment


                #8
                Code:
                 Plot0.Set(
                            if(CrossAbove(Close, CurrentDayOHL().CurrentOpen[0],1))
                            {
                                ++    1;
                            }
                            
                                          )
                i'm trying to count the above condition everytime it becomes true. the above doesn't even compile.. let alone adding the condition to count. any idea what i should do? i look at the trade limiter example but it seems strategy codes are different that indicator codes

                Comment


                  #9
                  calhawk01, I would not expect that to compile, you're not really having any variable to count with here.

                  I would create an int variable and then increase each time the condition is hit in OnBarUpdate()

                  if (condition)
                  myCounter++;

                  Then you can later plot that variable's content for example.
                  BertrandNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by funk10101, Today, 08:14 AM
                  3 responses
                  5 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by frankthearm, Today, 09:08 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post frankthearm  
                  Started by samish18, Yesterday, 08:57 AM
                  11 responses
                  28 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by yertle, Today, 08:38 AM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by love2code2trade, Yesterday, 01:45 PM
                  3 responses
                  22 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X