Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Loading weekly data for indicator on daily chart strategy

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

    Loading weekly data for indicator on daily chart strategy

    I have the following:
    Code:
    else if (State == State.Configure)
                {
                    AddDataSeries("6E 03-24", Data.BarsPeriodType.Week, 1);
                    AddDataSeries("6B 03-24", Data.BarsPeriodType.Week, 1);
                    
                }​
    and am using this as the input series for 2 custom indicators:

    Code:
    else if (State == State.DataLoaded)
                {                
                    COTIndex1                = COTIndex(Closes[1], true, true, true, true, IdxPeriod, 80, 20);
                    COTIndex2                = COTIndex(Closes[2], true, true, true, true, IdxPeriod, 80, 20);​
    I then run the strategy script on a daily chart of EURGBP. I get the error: COTIndex tried to load additional data. All data must first be loaded by the hosting NinjaScript in it's configure state. Attempted to load EURGBP Default: Weekly.

    Why is it attempting to load EURGBP when I added the 6E and 6B data series in the configure state? The hosting strategy script should be running on a daily EURGBP chart.

    #2
    Hello Lance El Camino,

    That message would indicate that the custom indicator that you are using also has its own AddDataSeries statements in its code. The strategy also needs to add the same series that the indicator does in its code. If the indicator loads a EURGBP Default: Weekly bar series you also need the same AddDataSeries for that series in the strategy so the indicator can use it.

    Comment


      #3
      That's exactly what I did in the configure state as shown. I found the problem, I had AddChartIndicator in the data loaded state and it wasn't set to Closes[1] or Closes[2]. That is what was trying to reference EURGBP but COTIndex won't work with that data series.

      Comment

      Latest Posts

      Collapse

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