Using SMA for Trailing Stops
Author: donnylee888
Creation Date: 8/11/2012 8:05 PM
profile picture

donnylee888

#1
Hi, I am new to WL, and just start to learn to craw!
I tried to drag and drop Trailing Stop (5%) with condition of SMA (20-day)turns down, but it did not work the way I wanted.

It exited immediately when SMA turns down, I wanted it to exit when SMA turns down by 5%!

Can anyone show me how to program trailing stops based on SAM-20day turns down and reach 5%.
I am trying use SMA to avoid the daily volatility problem!
Can anyone help?
Thanks,
Donny Lee
profile picture

Eugene

#2
Hi,

What is "SMA turns down and reach 5%" exactly? A -5% change in SMA from the previous bar? previous day? some peak value?
profile picture

donnylee888

#3
Hi, I was looking for a 5% down from the peak value used in trailing stop. In other words, using the SMA data series to make trailing stop decisions, instead of the daily close. Thanks!!
profile picture

donnylee888

#4
Sorry, computer glitch!
profile picture

Cone

#5
I deleted the duplicate posts. Once you post, make sure to exit the topic before refreshing the page. The way I like to see if someone has responded to a topic is by clicking/refreshing the "Most Recent" link.

It sounds like you "OR'd" the conditions. Either way, you would not want to "AND" them (by stacking) either since that would mean that the 5% condition would have to occur on the same bar as the Turn Down - an instantaneous condition. You simply don't not need the Turn Down rule since the market will be declining if -5% is hit anyway.

First try deleting the Turn Down rule. If that doesn't work for, click the link to view the code and paste it here between the CODE tags. (Just click the "CODE" button above the edit box and paste.)
profile picture

donnylee888

#6
HI: I will try the "AND" feature. Problem is that I am not looking for the classical "Trailing Stop," I am try to activate trailing stops based on SMA data series, not based on the daily OHLC data series. I will report back! Thanks!
profile picture

Cone

#7
Be sure to read the User Guide: Strategy Window > Strategy Builder as well as the subtopics, especially about the Multi-Condition (MC) group. Still, I think you should just remove the Turn Down rule.

If you want to use the SMA as the trailing stop, you'll have to modify the code manually. It's a pretty simple edit once you have the rest of the strategy in place.
profile picture

Eugene

#8
QUOTE:
Hi, I was looking for a 5% down from the peak value used in trailing stop. In other words, using the SMA data series to make trailing stop decisions, instead of the daily close. Thanks!!

If my understanding is correct, it's something like this:
CODE:
Please log in to see this code.

Example:
CODE:
Please log in to see this code.
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).