Custom Indicators¶
It is possible to add any custom indicators you create to your local reference library, allowing you to reuse them across any number of other custom indicators.
Follow these steps to reference a custom indicator.
- Click on the 'Manage References' button above the code editor window.
- In the 'Indicators' section of the 'Reference Manager' window, select the required indicators and click 'Apply'. Use the search bar to find the required indicators.
Referenced custom indicators are defined in the Initialize()
method similarly to nested indicators; however, the syntax is slightly different.
Specifically, the name of a custom indicator should be enclosed in angle brackets following the GetIndicator()
directive. Analogously to nested indicators, the parameters of referenced indicators should be enclosed in parentheses as shown in the below snippets.
1 |
|
The GetIndicator()
directive can be integrated into an indicator as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Alternatively, you can reference the indicator project file from your cTrader indicator/cBot project file.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
However, the recommended approach is to use the 'Reference Manager' window.