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

Error Calling Indi from other TF

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

    Error Calling Indi from other TF

    Hi,

    I have created a Custom ATR.

    If I load it in a daily chart gives a certain value.

    I need to use this daily value in a multi time frame strategy. However, when I call the indicator from a 60 min time frame:

    protectedoverridevoid Initialize()
    {
    Add(PeriodType.Day, 1);
    }
    protectedoverridevoid OnBarUpdate()
    {
    double Atr = MyATR(BarsArray[1],ATRAveragingPeriod)[0];
    PrintWithTimeStamp("Atr: "+Atr.ToString());

    }

    It prints a similar but a diferent value to the value calculated directly by the indi loaded in the daily chart.

    Why is this happening?

    Thanks in advanced.




    #2
    Originally posted by "CJS" View Post
    Hi,

    I have created a Custom ATR.

    If I load it in a daily chart gives a certain value.

    I need to use this daily value in a multi time frame strategy. However, when I call the indicator from a 60 min time frame:

    protectedoverridevoid Initialize()
    {
    Add(PeriodType.Day, 1);
    }
    protectedoverridevoid OnBarUpdate()
    {
    double Atr = MyATR(BarsArray[1],ATRAveragingPeriod)[0];
    PrintWithTimeStamp("Atr: "+Atr.ToString());

    }

    It prints a similar but a diferent value to the value calculated directly by the indi loaded in the daily chart.

    Why is this happening?

    Thanks in advanced.


    Do you have enough days loaded on your chart; more than ATRAveragingPeriod number of days?

    Comment


      #3
      Hi Koganam,

      Thanks a lot for your reply.

      I am sure that this is not the problem.

      I have made the same test with the normal ATR and also exists this issue.


      Thankas,

      Comment


        #4
        Originally posted by "CJS" View Post
        Hi Koganam,

        Thanks a lot for your reply.

        I am sure that this is not the problem.

        I have made the same test with the normal ATR and also exists this issue.


        Thankas,
        Another thought. Are your different timeframe bars synchronized? (Think of the effect of the COBC value on each BarsArray member). One way to find out would be to use more PrintWithTimeStamp() commands, each using a different hard-coded value for the period of the MyATR. That way you can compare what you expect to see to what is returned. That should probably isolate the disconnect.

        Comment


          #5
          Hi Koganam,

          I found out that the reason was causing the issue is that I use bid data. I have test it with Last type data and the problem is solved

          Thanks a lot for your help.

          Comment

          Latest Posts

          Collapse

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