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

Multi-TimeFrame ATR Not Working

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

    Multi-TimeFrame ATR Not Working

    1. Hey guys, I'm trying to add 5minute ATR to my script but am getting Compiling error: "Only assignment, call, increment, etc...)

    Code:
    Add(PeriodType.Minute, 5)  
    
    //OnBarUpdate
    
    ATR(BarsArray[1], 14)[0];

    2. ALSO. How do I set the Period to Go Back to Beginning of Day. I tried ATR(CurrentBar) didn't work.

    any thoughts?
    Last edited by ginx10k; 02-25-2015, 03:24 AM.

    #2
    ginx10k, having ATR(BarsArray[1], 14)[0]; as statement in OnBarUpdate() as is would not be meaningful, do you have this part of some condition or do you assign it to a variable for example to work later with?

    The # of bars since the session start would be given Bars.BarsSinceSession
    BertrandNinjaTrader Customer Service

    Comment


      #3
      So How do I make it meaningful?

      I'm just trying to print it for now. but getting compiling error. how is this fixed?

      Comment


        #4
        Well, you would need to do something with it, for example the print you mentioned.

        What statement did you exactly try to run for the print command?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Maybe I stated this wrong. The code
          Code:
          ATR(BarsArray[1], 14)[0];
          is Giving a COMPILING error.

          What do I have to write so that it Compiles properly. if it's a Print statement. what should it look like?

          I tried
          Code:
          Print(ATR(BarsArray[1], 10)[0].ToString);
          I tried
          Code:
          ATR(BarsArray[1], 10)[0];
          I tried
          Code:
          ATR(10, 0)[1];

          HOW DO I MAKE a MultiTimeFrame ATR. if BarsArray is Not the answer, than what is?

          Comment


            #6
            ginx10k, my point simply was this statement alone does not provide any sort of meaning -

            ATR(BarsArray[1], 14)[0];

            I've attached a little example for you that will

            a) print the 5 min ATR
            b) plot the 5 min ATR
            Attached Files
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Got it now. thanks !

              Comment


                #8
                Hi NT Support,

                I'm new to the forum and just finding this post, which is similar to what I'd like to accomplish as well. Do you think it's possible to replicate this is exact logic into a strategy? Meaning, if I have a tick chart and would like to use this MTF data (15 minute) in my strategy, is that possible? (strategy will also be placed on tick chart)

                Comment


                  #9
                  Hello successfulmike,

                  Thank you for writing in.

                  This logic can be replicated from a strategy as well.

                  Do note, however, that you will not be able to add plots to a strategy, so you won't want to use the Add() method on line 32.

                  Please, let us know if we may be of further assistance.
                  Zachary G.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by f.saeidi, Today, 10:19 AM
                  1 response
                  4 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by kujista, Today, 06:23 AM
                  5 responses
                  15 views
                  0 likes
                  Last Post kujista
                  by kujista
                   
                  Started by traderqz, Yesterday, 09:06 AM
                  2 responses
                  17 views
                  0 likes
                  Last Post traderqz  
                  Started by traderqz, Today, 12:06 AM
                  3 responses
                  6 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by RideMe, 04-07-2024, 04:54 PM
                  5 responses
                  28 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X