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 burtoninlondon, Today, 12:38 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post burtoninlondon  
                  Started by AaronKoRn, Yesterday, 09:49 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post AaronKoRn  
                  Started by carnitron, Yesterday, 08:42 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post carnitron  
                  Started by strategist007, Yesterday, 07:51 PM
                  0 responses
                  13 views
                  0 likes
                  Last Post strategist007  
                  Started by StockTrader88, 03-06-2021, 08:58 AM
                  44 responses
                  3,982 views
                  3 likes
                  Last Post jhudas88  
                  Working...
                  X