Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

method returning the same result on different calls

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

    method returning the same result on different calls

    So I made a simple class to calculate ranges. In the indicator script when I run the method on different objects I get the same result, it's like the value from one instance gets transffered into the other ones. I've attached pictures with the code and result. I'm pretty new to programming, in fact ninja brought me to c#. Thank you!
    Attached Files

    #2
    Hello nothingtrader,

    Use prints to understand what is happening.

    It looks like it should be returning the same values, it's using bar data and hard coded time values.

    Why are you expecting the values to be different?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello! the time filters are hard coded but different for every object so i'm expecting different results. Maybe it's something in my method that I haven't done right cause it transfers the first results to the next call of the method. What I expect is to input the time filters and get the range of that time period. I bet it's some c# basics that I missed..
      Attached Files

      Comment


        #4
        Hello nothingtrader,

        What is the object that is different?

        If the time conditions are hard coded, I wouldn't expect these to change. Are you wanting to have inputs for the time variables?

        Below is a link to a forum post that demonstrates using Print() to understand behavior.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        63 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        92 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        48 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        106 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        63 views
        0 likes
        Last Post PaulMohn  
        Working...
        X