Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator question

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

    Indicator question

    I have this indicator that calculates the ratio between two assets (the spread value). When I use this indicator in a strategy (calling the spread value) I get vastly different results from when I use closes[2][0]/closes[1][0] directly in the strategy. I used print statement to find that they return slightly different values. Why is this?
    Attached Files

    #2
    Why such old instruments?

    private string firstInstrument = @"ES 12-19";
    private string secondInstrument = @"NQ 12-19";


    Comment


      #3
      I update them when running

      Comment


        #4
        Thanks, I see they are string properties.

        -=o=-

        Does your Strategy have the same calls to AddDataSeries as the Indicator?

        Remember, when a Strategy references a Indicator using multiple data series,
        the exact same data series must first be loaded by the hosting Strategy in its
        own State.Configure.

        Are you doing that?

        Become an expert on the info here and here.

        -=o=-

        Btw, I recommend you keep the hardcoded values up to date with the current
        contracts. I mean, there is no reason to have 5 year old expired contracts as
        the default string values, right?

        -=o=-

        Also, I'd recommend you change your use of AddDataSeries to simply,

        AddDataSeries(FirstInstrument);
        AddDataSeries(SecondInstrument);


        That assumes your primary chart is already a minute based chart (but I figure
        it probably is since you're using BarsPeriod.Value from the primary chart,
        and using that chart value doesn't make sense if your primary chart is not minute
        based).

        Just my 2˘.



        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        607 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        353 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        560 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        561 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X