CS0428

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Editor > Compile Error Codes >

CS0428

Previous page Return to chapter overview Next page

The following CS0428 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 miscall a method such as indicator methods.

 

If you are calling an indicator please ensure that you have both the parameters '()' and the indexing value '[]' set. For other methods please ensure you pass all required parameters through the parameters set '()'.

 

Error Description #1
Cannot convert method group 'SMA' to non-delegate type 'double'. Did you intend to invoke the method?

 

Example #1

// Erroneous Sample Code - SMA() indicator method is improperly called

double myValue = SMA;

 

// Resolution Sample Code - SMA() indicator method is properly called

double myValue = SMA(5)[0];

 

Example #2

// Erroneous Sample Code - ToString is a method and requires round brackets () to be properly called

string str = Close[5].ToString;

 

// Resolution Sample Code - ToString() is properly called

string str = Close[5].ToString();