Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator return value

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

    Indicator return value

    Hi,


    I know I have seen this before but cannot find the post. I have an indicator I am calling from a strategy and normally it returns the proper value. However, under as yet to be exactly determined circumstances, it returns Close[0]. This indicator should only return -1, 0 or 1.


    I have no idea why this happens but I do know it is in my strategy code because it works just fine when applied to a stand alone chart.

    Best Regards,
    Scott

    #2
    Hi Scott, which CalculateOnBarClose settings do you run here as this happens? Is enough data available to satisfy BarsRequired for all your series used as needed?

    Comment


      #3
      Bertrand,

      That is what I was thinking it might be. Because I can't add secondary data series dynamically, I have some data series that are not currently used but that are in the indicator that I don't have enough data for.

      I was thinking that if I didn't reference them it would be ok. I will check along those lines to see if I can get to the bottom of things.

      Best Regards,
      Scott

      Comment


        #4
        I feel this will be likely the issue then - a test run with a low BarsRequired would show if the issue is found in this area.

        Comment


          #5
          Bertrand,

          As always, thanks for your excellent help. It appears the issue is fixed and if not, it is likely in that area of the code.

          Best Regards,
          Scott

          Comment


            #6
            I spoke too soon; I have tried every combination of bars required, etc. but to no avail. A print statement in the indicator shows it is calculating the correct value.

            A print statement in the strategy shows the correct value for two bars and then a price (vs. the -1, 0 or1 it printed in the indicator). I have also tried referencing both z[0] and z[1]; both return the same value.

            Any thoughts? I know I have seen this addressed somewhere.

            Best Regards,
            Scott

            Comment


              #7
              Hi Scott, which COBC settings do you use here? Any changes if you remove a potentially hardcoded in COBC statement in the called indicator and then recheck?

              Comment


                #8
                Bertrand,

                I went through all that but it turned out I needed an Update() in the indicator get; that fixed it. Thanks for your help.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                673 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                379 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                111 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                577 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                582 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X