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

ATR multi-time frame

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

    ATR multi-time frame

    the ATRs return same value when used in multi-time frame, is it an error
    or can I use it this way?

    if (BarsInProgress == 1){
    ATR_s = ATR(ATR_short_term_periods)[
    0];
    Print(ATR_s);
    }
    if (BarsInProgress == 2){
    ATR_l = ATR(ATR_long_term_periods)[
    0];
    Print(
    "----"+ATR_l);
    }

    Thanks
    Last edited by solvmatic; 02-03-2012, 03:09 PM.

    #2
    Hi Solvmatic,

    Yes, ATR will be calculated based on other time frames you've added.

    What are the added series in your script?
    What are the values for these?
    ATR_short_term_periods
    ATR_long_term_periods


    What's some sample output you're seeing based on the above?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3

      privatestring instrName = "ES 03-12";
      privateint kagiPeriodVolume = 100;
      privateint kagiInterval_ATR_short_term = 2;
      privateint kagiInterval_ATR_long_term = 9;
      privateint aTR_short_term_periods = 10;
      privateint aTR_long_term_periods = 10;

      protected
      overridevoid Initialize()
      {
      AddKagi(instrName, PeriodType.Volume, kagiPeriodVolume, kagiInterval_ATR_short_term, ReversalType.Tick, MarketDataType.Last);
      AddKagi(instrName, PeriodType.Volume, kagiPeriodVolume, kagiInterval_ATR_long_term, ReversalType.Tick, MarketDataType.Last);

      }

      protectedoverridevoid OnBarUpdate()
      {
      if (BarsInProgress == 1){
      ATR_s = ATR(ATR_short_term_periods)[
      0];
      Print(ATR_s);
      }
      if (BarsInProgress == 2){
      ATR_l = ATR(ATR_long_term_periods)[
      0];
      Print(
      "----"+ATR_l);
      }
      }
      Last edited by solvmatic; 02-03-2012, 03:39 PM.

      Comment


        #4
        getting these:

        1.14621053700929
        ----1.14621053700929
        1.13890001015883
        ----1.13890001015883
        1.11945500965089
        ----1.11945500965089
        1.12598225916834
        ----1.12598225916834
        1.10718314620992
        ----1.10718314620992
        1.16432398889943
        ----1.16432398889943

        the 2 ticks reversal and 9 ticks reversal kagi series should return different ATR values. right?
        Last edited by solvmatic; 02-03-2012, 03:42 PM.

        Comment


          #5
          Thanks for those details. It would be good to compare what differences you are seeing when you chart these series side by side. Since both charts use the base 100 volume, they could be similar, or have same highs and lows.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            for the secondary and third time frames, I switched them to volume based, and works

            Add(instrName, PeriodType.Volume, 2000);
            Add(instrName, PeriodType.Volume,
            20000);


            Comment


              #7
              I see, then you'l have different base types. Thanks for following up here. Have a great weekend!
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,602 views
              0 likes
              Last Post aligator  
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              8 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              18 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              4 views
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              12 views
              0 likes
              Last Post Javierw.ok  
              Working...
              X