ATR Based Stop Loss
Author: ejg
Creation Date: 11/19/2008 10:07 AM
profile picture

ejg

#1
How do I create a code for a stop loss that is based on a multiple of the ATR for the past 10 days? I've seen posts for the script for Wealth Lab 4 but nothing for Wealth Lab 5. Also, are there specific connectors that I need to add to insert this stop loss in with other exits (like the chandelier exit) that I already have in my system?

Thanks
profile picture

Cone

#2
QUOTE:
How do I create a code for a stop loss that is based on a multiple of the ATR for the past 10 days?
Are you asking for a Strategy Builder rule or just the code?

Code snippet -
CODE:
Please log in to see this code.

Connectors? Like a minus sign?
profile picture

ejg

#3
I'm sorry. I am a complete newby at this. If I have written a very simple code for an entry at a 50 day new high and a chandelier exit based on a 3xATR with a code as follows:

CODE:
Please log in to see this code.


How do I insert what you've just provided for me so that I either get stopped out at a 2 times ATR stop loss based on my initial entry, or a 3xATR chandelier trailing exit loss once I've achieved a profit?

Thanks. I really appreciate the help.

profile picture

Cone

#4
The Chandelier stops haven't been converted yet, and it could be a good opportunity to start the Community.Components project. We'll have to put that part of your request on hold until that's ready to go.

Also, you shouldn't used the .Value method unless you really want a single calculation. In general, the .Value method is almost never required and it's much more efficient to calculate the Series only once. (See the WealthScript Programming Guide.)

As for the ATR Stop part -

CODE:
Please log in to see this code.


profile picture

Eugene

#5
To answer the topic starter's question: it occurred to me that the Chandelier exit is already featured in the QuickRef, so please see the examples for HighestHighAsOfBar and LowestLowAsOfBar.
profile picture

Eugene

#6
QUOTE:
The Chandelier stops haven't been converted yet, and it could be a good opportunity to start the Community.Components project.


Community.Components is finally here.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).