Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          581 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          338 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X