![]() |
Smoothing Trailing Stop Berg? |
Post Reply ![]() |
Author | |
brentjedi ![]() Regular ![]() ![]() Joined: 13 Dec 2007 Posts: 34 |
![]() ![]() ![]() ![]() 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 Brentjedi ![]() |
|
Trading is art of self
|
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
brentjedi ![]() Regular ![]() ![]() Joined: 13 Dec 2007 Posts: 34 |
![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
brentjedi ![]() Regular ![]() ![]() Joined: 13 Dec 2007 Posts: 34 |
![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
brentjedi ![]() Regular ![]() ![]() Joined: 13 Dec 2007 Posts: 34 |
![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
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); |
|
![]() |
|
brentjedi ![]() Regular ![]() ![]() Joined: 13 Dec 2007 Posts: 34 |
![]() ![]() ![]() ![]() |
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 Brentjedi ![]() |
|
Trading is art of self
|
|
![]() |
|
maximo ![]() BullCharts Guru ![]() ![]() Joined: 02 Sep 2006 Location: Australia Posts: 232 |
![]() ![]() ![]() ![]() |
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); |
|
![]() |
Post Reply ![]() |
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |