BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Help by implementing stop-loss strategy
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Help by implementing stop-loss strategy

 Post Reply Post Reply
Author
Message / View First Unread Post
charlie_8 View Drop Down
Regular
Regular


Joined: 06 Apr 2011
Posts: 21
Post Options Post Options   Quote charlie_8 Quote  Post ReplyReply Direct Link To This Post Topic: Help by implementing stop-loss strategy
    Posted: 09 Aug 2011 at 8:28am
Dear forum memebers,

I would be glad if somebody could help me by writing a stop-loss strategy in bullscript. This strategy based on Nth bar lows for longs and Nth bar highs for shorts. 

Short explanation: let us assume, that we took a long position on 3.1.2011. The up pivot bar is let say on 1.1.2001 (so we should have a posibility to decide witch day is our first day for stoploss - like ATR stoploss in Bullcharts). We want to place our stoploss on the level of the low of the pivot bar and then move it higher. We want to see our stop on the lowest low of let us say as example last 9 bars (should be adjustable). 

maby maximo could help me?

Thank you
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: 09 Aug 2011 at 10:13am
Hi Charlie,
 
That indicator has been around for quite a while.  It's known as the Donchian channel, which Richard Donchian so named.   The turtles of Richard dennis reportedly used them.
 
 

[lineStyle=Solid; Target=Price]

n := input("Lookback periods",10,0);

hshift := input("Horizontal shift",0);

[color=steel blue]

hist(HHV(H,n),hshift);

[color=steel blue]

hist(LLV(L,n),hshift);

[linestyle=dotted]

hist(HHV(H,n) + LLV(L,n),hshift)/2;



Edited by maximo - 09 Aug 2011 at 10:14am
Back to Top
charlie_8 View Drop Down
Regular
Regular


Joined: 06 Apr 2011
Posts: 21
Post Options Post Options   Quote charlie_8 Quote  Post ReplyReply Direct Link To This Post Posted: 09 Aug 2011 at 11:24am
thank you maximo, you actually right about donchian channel :) i didnt think this way :D
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