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 CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      52 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      29 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      194 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      355 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      274 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X