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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        72 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        39 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X