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.

LvTTrend Indicator Example

LvTTrend Indicator Example

 

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:

User script folder structure

User script folder structure

 

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):

Usage of helper functions

Usage of helper functions

 

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:

Cunstom Indicator Activation

Cunstom Indicator Activation

 

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

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply