Trying to create a ATR trailing stop in WL5.4
Author: sabino
Creation Date: 8/20/2009 9:35 PM
profile picture

sabino

#1
Found my way to the ATR stop described at the following for WL but the code does not, when pasted into a new WL5.4 Strategy, seem to work as it should (the ATR is created for some stocks but not all and then terminates as soon as a bar penetrates the ATR):

http://www.traders.com/documentation/FEEDbk_docs/2009/06/TradersTips.html (see the code for the Wealth-Lab ATR trailing stops on that same page). (The NinjaTrader version of the code identified on that same page worked just fine in Ninja however).

Also the WLP 5.4 Indicator ATRModified under SC TASC Magazine Indicators produces an Unhandled exception error and will not load.

A visual of what am trying to achieve can be found at:
http://www.invivoanalytics.com/2009/07/20/now-back-to-trading/

Ideally, would like for Active Trader Pro to allow assignment of stops based on ATR (currently use stops based on percent but that does not take into account the equities normal range of variability).


profile picture

Eugene

#2
For starters, take a look at SellAtTrailingStop in the QuickRef. In addition, see ChandelierStop in Community.Components (downloadable from this site -> Extensions).
profile picture

sabino

#3
Tried to use ChandelierStop but got the following error message:

error CS0234 @(22,17): The type or namespace name 'Components' does not exist in the namespace 'Community' (are you missing an assembly reference?)

Not sure what was to be done with all the Chandelier prerequite "checklist" items - would it be possible to list a completed Chandelier code that will run when pasted into a new strategy.
profile picture

Cone

#4
Re: ChandelierStop
Where did you paste the code from?

Chandelier was implemented in the Community.Indicators, so assuming that you've installed that Extension you need to add this at the top -
CODE:
Please log in to see this code.


QUOTE:
Also the WLP 5.4 Indicator ATRModified under SC TASC Magazine Indicators produces an Unhandled exception error and will not load.
ATRModified is not a WLP 5.4 Indicator. It's an indicator recently introduced in TASCMagazine and included in the 1.0.7 TASCIndicators Library update. It loads fine, however, there's a bug for drag and drop, which will be corrected in the next update for TASCIndicators - a few weeks away.

Also, you should have better luck copying code from the TASC Traders' Tips on our Wiki site.
profile picture

sabino

#5
CODE:
Please log in to see this code.
profile picture

Eugene

#6
Code above works.

As usual, we need to know: the tool (Strategy, Strategy Monitor), time frame, symbol, verbose description.

Helpful links:
How to report a Problem?
"It doesn't work."
profile picture

Cone

#7
Whoops, I meant Community.Components, not Community.Indicators. Anyway, the error you identified would occur if you installed at least one of the Community add-ins, but not the Community.Components add-in.

1. Please go to Extensions and get Community.Components.
2. Remove "using Community.Indicators;" (my mistake)
profile picture

sabino

#8
Between chandler and ATR, ATR seems to produce more profitable trades; however, the ATR code seems to work just once e.g. it provides an entry point and if a stop out occurs it is finished (that could have occurred 4 months ago if working on daily charts and sufficient data loaded - see for example profitable trade on Ford (F) with entry on 4/13 and exit on 5/14 - but nothing after that - p.s. using ATR Multiplier of 3.9 and ATR period of 23). Also, does not seem to work on shorter time periods at all (contrary to the same general code [from www.traders.com] applied to NINJA). Also, the traders.com code used in NINJA executes continuously and has a (single) real time support/resistance line and arrows to indicate if currently in a long or short condition. Any suggestions on how to get the ATR code to do similarly in Wealth Lab? ATR code below - added sound to let me know it executed properely:

CODE:
Please log in to see this code.