Print Page | Close Window

Help by implementing stop-loss strategy

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: BullScript
Forum Discription: Technical discussion related specifically to the BullScript programming language.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=723
Printed Date: 06 Apr 2025 at 3:00am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: Help by implementing stop-loss strategy
Posted By: charlie_8
Subject: Help by implementing stop-loss strategy
Date 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



Replies:
Posted By: maximo
Date 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;



Posted By: charlie_8
Date Posted: 09 Aug 2011 at 11:24am
thank you maximo, you actually right about donchian channel :) i didnt think this way :D



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.69 - http://www.webwizforums.com
Copyright ©2001-2010 Web Wiz - http://www.webwiz.co.uk