How to create a custom trading indicator
Updated on 2011-10-19 04:55:48
In QuantShare, you can use CSharp or JScript.Net programming languages to create your own trading indicators. The custom indicator tool is very powerful and it allows you to create basic or complex indicators quickly. Once created, a custom indicator can be used in the QuantShare language.
- In the main menu, select "Tools" then "Create Functions"
- Click on "Add" (on the top of the new form)
- Type the indicator name (Example: MyIndicator) then click on "Save Item"
- In the Script panel, type your formula then click on "Save".
At any moment, you can use CONTROL+SPACE shortcut to display the list of available functions and variables.
result = TA.Rsi(14) - TA.Rsi(7);
This will create a custom indicator that returns the difference between the 14-bar RSI and the 7-bar RSI.
The custom indicator returns the variable "result" and therefore you must assign the indicator result to this variable.
After you click on "Save" and make sure that there are no errors in the formula, follow the next steps:
- Close "Create Functions" form.
- Select a chart and create a new pane
- Click on "Add Indicator" icon in the new pane (first icon at the top)
- Select "All Indicators" tab then type your indicator name in the "Search" box
- Select your indicator then click on "OK".
Your indicator is now displayed on the chart.
To see how it was used in the pane's formula:
- Right click on that pane
- Select "Edit formula"
a = MyIndicator();
Plot(a, "MyIndicator", colorBlack, chartLine, StyleSymbolNone);
The custom trading indicator was referenced in QuantShare language by calling the function: MyIndicator().