BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Smoothing Trailing Stop Berg?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Smoothing Trailing Stop Berg?

 Post Reply Post Reply
Author
Message
brentjedi View Drop Down
Regular
Regular
Avatar

Joined: 13 Dec 2007
Posts: 34
Post Options Post Options   Quote brentjedi Quote  Post ReplyReply Direct Link To This Post Topic: Smoothing Trailing Stop Berg?
    Posted: 17 Oct 2009 at 11:19pm
Hi guys

I have a question regarding Bergs trailing stop formula and trying to understand it and why it works.

al := input("ATR Length", 10, 1);
am := input("ATR Multiplier", 2, 0);
use15 := input("Combine with P15 1=yes, 0=no", 1, 0, 1);


[name=Stop; color=Black]
ts := hhv(C-am*ATR(al),if(use15,15,1));
ts;

This the stop part of his system, the question is what does  if(use15,15,1)) mean?
the input of use15 is = input("Combine with P15 1=yes, 0=no", 1, 0, 1).
So what does combine with P15 mean? what is P15?. I know that if you don't select P15 then it doesnt smooth the line.

Yes what is P15 its not in the help section of bullcharts.

Cheers

BrentjediTongue
Trading is art of self
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2009 at 2:19am
Hi brent-master-jedi, you could've consulted with yoda on this one :P j/k
 
I translate it as,  if the variable use15 has a value then use 15 as the value else/otherwise use 1 as the value (ie. 1=unsmoothed or the highest of any single price bar)
The IF is also part of the hhv function, which is the HighestHighValue of X number of bars.  The X number in this case is 15, so it will return the HighestHighValue of 15 bars.  The P in P15 probably stands for Pivot.  ie. showing the Highest  pivot in 15 bars.  Thats why it looks flat until the 15 count has passed.      
 
Obiwun-maximo
Back to Top
brentjedi View Drop Down
Regular
Regular
Avatar

Joined: 13 Dec 2007
Posts: 34
Post Options Post Options   Quote brentjedi Quote  Post ReplyReply Direct Link To This Post Posted: 19 Oct 2009 at 12:09am
Thank you Obiwun-maximo

I have tried to get the ' if(use15,15,1))' fuction on a trailing stop that is constructed with two fuctions under a 'if' fucntion. eg if H>prev H use ATR 2 otherwise use ATR 4.
The idea is to let the stop trail at different speeds depending on price action. However I can't get it smooth like Mr Berg's as the use15 part does fit the If formula structure????

Your help would be great
Cheers
Brentjedi
 




Trading is art of self
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 19 Oct 2009 at 3:02pm

Let me define this, so i have an idea.  You want to make an adaptive stoploss based on Volatility?  ie. the larger the range the more distant the stoploss.  or are you looking for it to adapt to trend, by it selecting a more distant stop if price is making new highs?

Some ATR info
 
ATR (2) to (10) is for price volatility. (adaptive)
 
ATR (11) to (30) is for short to medium term trend volatility.
 
ATR > (30) is long term trend volatility.


Edited by maximo - 19 Oct 2009 at 3:17pm
Back to Top
brentjedi View Drop Down
Regular
Regular
Avatar

Joined: 13 Dec 2007
Posts: 34
Post Options Post Options   Quote brentjedi Quote  Post ReplyReply Direct Link To This Post Posted: 19 Oct 2009 at 4:50pm
Maximo

What I am after is the following; when a stock starts trending up and makes new higher highs
I want the trailing stop to be tight and fast. When the stock is going sideways I want the stop to be wide and slow. Eg ATR 2 fast ATR 4 slow.

I hope that helps

Brentjedi
  
Trading is art of self
Back to Top
brentjedi View Drop Down
Regular
Regular
Avatar

Joined: 13 Dec 2007
Posts: 34
Post Options Post Options   Quote brentjedi Quote  Post ReplyReply Direct Link To This Post Posted: 19 Oct 2009 at 5:02pm
here is what I am trying to achieve 
If (close<hist(high,1),low-3*ATR(14),low-1.5*ATR(14))

Brentjedi
Trading is art of self
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 20 Oct 2009 at 2:40am
I made a test indicator of the ATR's you were looking at.
It appears that switching to the larger stop of 3*ATR when
no new high is made would lower your stop.  Is that the
intended idea?
 
 

[target=price]

[color=red]

HH := L-3*ATR(14);

HH;

[color=blue]

HL := L-1.5*ATR(14);

HL;

[color=black; linestyle=solid; width=2]

if(C<ref(H,-1),HH,HL);

  
 
Back to Top
brentjedi View Drop Down
Regular
Regular
Avatar

Joined: 13 Dec 2007
Posts: 34
Post Options Post Options   Quote brentjedi Quote  Post ReplyReply Direct Link To This Post Posted: 20 Oct 2009 at 1:52pm
Maximo

Thanks for the quick reply.

It,s close..........just needs to be non reclining (not going backwards) and smoothed with the Use15 thingy. Its how to slot in the Use15 part that's needs the force.

Cheers
BrentjediTongue




Trading is art of self
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 20 Oct 2009 at 3:41pm
Ah non retreating, except when it closes below the line?  Sounds good.
 

M1:=Input("ATR Multiplier 1",1.5,1);

M2:=Input("ATR Multiplier 2",3,1);

Nb:=Input("Nb Periods",14,1);

[target=price]

[color=red; linestyle=dotted]

HH := L-M2*ATR(Nb);

HH;

[color=blue; linestyle=dotted]

HL := L-M1*ATR(Nb);

HL;

[color=black; linestyle=solid;]

select := if(C<ref(H,-1),HH,HL);

if(select<prev and close>prev,prev,select);

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz