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 NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X