Programming a Volatility Stop
Author: bephipps
Creation Date: 11/11/2013 7:07 PM
profile picture

bephipps

#1
I am new to Wealth-Lab and have a question on programming indicators. I am able to program my system within Wealth-Lab but am unclear on how to program indicators. It looks like that will require me to obtain a development environment like Visual Studio or SharpScripts. I am willing to learn but don't know where to start programming indicators.

I am interested in programming a indicator in Wealth-Lab that I have been using in another platform.
This indicator is something like the CMCSuperTrend but seems to calculate somewhat different than I am use to. It is called a Volatility Stop. The indicator uses the following logic.

When Up Trend Detected....
VSTOP = CL - MULT * TR
As Up Trend Continues....
VSTOP = MAX(VSTOP.1, MaxCL - MULT * TR)

When Down Trend Detected....
VSTOP = CL + MULT * TR

As Down Trend Continues....
VSTOP = MIN(VSTOP.1, MinCL + MULT * TR)

Where...
CL = Closing Price
MULT = True Range Multiplier
TR = True Range
VSTOP.1 = Volatility Stop Value on Previous Bar
MaxCL = Maximum Closing Price since Up Trend Began
MinCL = Minimum Closing Price since Down Trend Began

Trend reverses between up and down when Closing Price crosses VSTOP.

More info can be found at: http://www.linnsoft.com/tour/techind/vstop.htm

Is the code for the CMCSuperTrend available to view? I would like to take it and understand the difference between it and the VolatilityStop. Then I would like to program the indicator in Wealth-Lab.
profile picture

Eugene

#2
Welcome to Wealth-Lab forums, Blaine.

This Volatility Stop indicator is also known as a trailing reverse indicator (NRTR) and is available on our platform through Community Indicators. You need to install the library and restart WLP for NRTR_WATR to appear on the Indicators list:

NRTR_WATR

Check out the WealthScript example in the Wiki on how to code a trading strategy with this indicator. Also, NRTR_ATR Intraday system is downloadable from within Wealth-Lab's "Open Strategy" dialog (make sure to uncheck "Published since" to get all of them).

The library also has a companion indicator, percentage-based NRTR%, that does the same trailing reverse thing but without volatility. The library's source code, if you're interested, can be accessed by creating a Wiki account and successfully completing verification in support ticket.
profile picture

bephipps

#3
Thanks. I'll try your suggestions and get back with you if there are any questions.
profile picture

bephipps

#4
In the PDF entitled "Creating an Indicator Library in Wealth-Lab Pro" it says that one can also program and plot indicators directly in the Strategy code. Do you have any simple examples of doing that?
profile picture

Eugene

#5
For instance, see the WealthScript Programming Guide > Indicators > Custom Indicators.