HOW-TO: C# Scripting using “LvT Trend Indicator” Example
The following example illustrades the usage of the C# scripting engine.
Some years ago, I developed an interesting TREND indicator which is based on a modified Haikin-Ashi coding. Some examples of the old version can be reviewed here:
Review Original Articel on Wave59 Board
To show how to use the WTT Scripting module, I transferred this closed indicator coding into a open C# scripting version to be used within our WTT platform. First, here is an chart showing the indicator in the lower panel.
The final script is available within the LvTTrend.cs file which is attached to this post. To make scripting more easy, you can use and re-use helper functions which might be needed in different indicators. Therefore you can create subfolders within the WTT UserScripts folder. It doesnt matter how these folders are labled – you can choose the name to organize your scripts. All subfolder within the WTT\UserScripts\… folder will be compiled in the platform.
For this example we pre-build smoother functions for
- Exponential Moving Average (EMA.cs)
- Tripple Exponential Moving Average (TEMA.cs)
- Zero-Lag Exponential Moving Average (ZLEMA.cs)
- Zero-Lag Tripple Exponential Moving Average (ZLTEMA.cs)
These functions can now be accesed from any other script. Therefore we stored these scripts in a seperate folder:
Afterwards, in the code, we can access these helper functions quite simple by calling them like any other C# function from the main indicator script (LvTTrend.cs):
This example shows how to code indicators, how to use subfolder and access pre-build functions. Finally, the indicator can be added to the chart via the “Custom Indicator” function:
The .zip file with all code files is attached to this article:
You must have membership level to download the indicator source files.
Please configure your account at whentotrade.com
Leave a ReplyWant to join the discussion?
Feel free to contribute!