CS1503

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Editor > Compile Error Codes >

CS1503

Previous page Return to chapter overview Next page

The following CS1503 error code information is provided within the context of NinjaScript. The examples provided are only a subset of potential problems that this error code may reflect. In any case, the examples below provide a reference of coding flaw possibilities.

 

Error Code Explanation

This error can occur when you try to assign a value to a Series<T> that is not of the correct value type.

 

Series<double> objects can only contain double values. Series<bool> objects can only contain bool values. Etc.

 

Error Description #1
Cannot implicity convert type from 'string' to 'double'

 

// Erroneous Sample Code - Cannot pass in a string to a Series<double>

Value[0] = "Close[0]";

 

// Resolution Sample Code - Sets Series<double> to the current bar's Close value

Value[0] = Close[0];

 

Error Description #2
Cannot implicitly convert type 'NinjaTrader.NinjaScript.Indicators.SMA' to 'double'

 

// Erroneous Sample Code - Cannot pass in a Series<double> object to a Series<double> Set() method

Values[0] = SMA(20);

 

// Resolution Sample Code - Sets Series<double> to the current bar's SMA(20) value

Values[0] = SMA(20)[0];