Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

implicitly convert type 'double' Error

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

    implicitly convert type 'double' Error

    I am converting an NTv7 strategy to v8 and am getting an, "Cannot implicitly convert type 'double' to 'NinjaTrader.NinjaScript.Series<double>'" error.

    I don't know what is wrong and am looking for help. The relevant code is below.

    Thanks, Tim


    v7
    public class <name> : Strategy
    private DataSeries haClose = null;

    protected override void Initialize()
    haClose = new DataSeries(this);

    protected override void OnBarUpdate()
    haClose.Set((Open[0] + High[0] + Low[0] + Close[0]) * 0.25);

    v8
    public class <name> : Strategy
    private Series<double> haClose = null;

    protected override void OnStateChange()
    haClose = new Series<double>(this, MaximumBarsLookBack.Infinite);

    protected override void OnBarUpdate()
    haClose = (Open[0] + High[0] + Low[0] + Close[0]) * 0.25; <-- Error: Cannot implicitly convert type 'double' to 'NinjaTrader.NinjaScript.Series<double>'

    #2
    Hello NinexTim,

    Series are collections like arrays that are indexed.

    Try haClose[0] =

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      That did it! Thank you.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 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
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X