Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need to find difference in Indicator

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

    Need to find difference in Indicator

    I have strategies that use this indicator, I get very different results when I use this indicator's "Spread" value vs just using the same ratio (Closes[2][0]/Closes[1][0]) in the strategy. Can anyone tell me why?

    #2
    Hello samish18,

    Because math is involved you would need to use a Print to see what values are used in each case, by doing that you can manually do the math for a bar to see why the calculation is different. Different equations will result in different answers. The code you commented out is doing additional math that you are not doing with the uncommented code.

    //double FirstValue = (Closes[1][0] * Instruments[1].MasterInstrument.PointValue); <-- additional math
    //double SecondValue = (Closes[2][0] * Instruments[2].MasterInstrument.PointValue); <-- additional math
    //Spread[0] = (((FirstValue - SecondValue) / (FirstValue + SecondValue)) * 100); <-- additional math

    Spread[0] = Closes[2][0]/Closes[1][0]; <-- only division between two numbers ​

    Comment


      #3
      I do not use the commented out code, just use the uncommented code. When using the exact same line (Spread[0] = Closes[2][0]/Closes[1][0] in the strategy code itself, I get slightly different printed values and vastly different results in the strategy analyzer.

      Comment


        #4
        Hello samish18,

        That may relate to the dataseries index in the strategy, again you would need to use Prints for this type of question because math is involved. You need to know what numbers you are using the the equation to be able to answer this question.

        Comment


          #5
          It is very odd. When I run the strategy live using the attached indicator, it yields the results when backtesting over the same period using the Closes[2][0]/Closes[1][0]. It seems that there is no difference in whether or not I'm using the indicator or calculating directly in the strategy for the live environment, but very different results when backtesting - any idea why this may be?

          Comment


            #6
            Hello samish18,

            Unfortunately I wouldn't be able to say, that is something you would need to check by using a print in both of those use cases to see what specifically is different.

            Comment

            Latest Posts

            Collapse

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