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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        57 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        78 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        39 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        101 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        61 views
        0 likes
        Last Post PaulMohn  
        Working...
        X