Code with AI |
In a first of its kind, you can automatically generate sharpScript codes by harnessing the power of artificial intelligence using Ollama client. As such you must download and install the Ollama client in your PC. Please download and install Ollama client from the below link
Ollama provides various models, both offline and cloud and you can use your preferred model. We strongly recommend to use the cloud models.
Please follow the below steps to code
Open the Sharp Script Editor, from Main View menu bar goto New > Sharp Script Editor
In the Sharp Script Editor View, select the top node from the tree view on the right, say, the Indicator node
Right click on the selected node and from the context menu click on the option 'Code with AI'
In the Script Generator View type in the name of the class
Type-in your ideas in the prompt text box
Click Ok
Note : Depending on the models, it can take more than a minute for the AI to generate the code.
Currently AI assisted code can be generated for the following business objects:
ArthaChitra has to pass various params to Ollama along with the user input. This increases the size of the prompt manyfold. The size of the prompt determines how much tokens the AI will use to generate the code. So it is prudent to filter out any un-necessary params while passing the prompt to Ollama.
Please follow the below steps to configure the AI settings
In the Script Generator View click on the properties button on the right
In the properties dialog append the necessary settings
Click Ok to apply the settings
Note : The properties will vary depending on business object. Please find below, the properties for different business objects.
Common properties
Name | Description |
|---|---|
ModelName | Name of the large language model you wish to use |
IsApiCompressed | Is the API compressed or not. It is highly recommended to set this to true |
Indicator properties
Name | Description |
|---|---|
AppendIndicatorExtensions | Append the static methods of the AddOrGetIndicator class as found in the user codes |
AppendReturnTypeProperties | Append the exposed series (ISeries<double>) properties of the return type class (of the AddOrGetMethod methods) |
AppendDrawingExtensions | Append the static methods of the Draw class as found in the user codes |
IsMultiSeries | Append the multi-series API definitions. Set it to true if you call the AddBars method (multi-series indicator). |
There is no guarantee that the codes as generated by AI will work and can have errors, throw exceptions or can have compilation errors.
Besides the user input, the prompt includes the internal API definitions. This can impact the usage policy of Ollama .
AI-generated code is provided 'as-is' without any warranties of any kind, express or implied. The user assumes all risks associated with the functionality, security, and performance of this code. It is highly recommended to independently verify, test, and debug all outputs before using them in any production environment.