BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > TradeSim discussion
  New Posts New Posts RSS Feed: bullscript for stoploss..
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

bullscript for stoploss..

 Post Reply Post Reply
Author
Message / View First Unread Post
etrader View Drop Down
Regular
Regular
Avatar

Joined: 18 Dec 2004
Posts: 63
Post Options Post Options   Quote etrader Quote  Post ReplyReply Direct Link To This Post Topic: bullscript for stoploss..
    Posted: 11 Dec 2006 at 10:41pm

I am not sure if it can be done this way, but would appreciate any help.

Using a tradesim test I use my entry conditions as required which will trigger at an entry price. I wish to use an atr exit based on this entry price.?? This is where my problem lies confused as how to represent this in bullscript.

Under the Stops tab calculating the Initial Stop I try to use::    Entryprice - 2*ATR(10)

and this does not seem to work. Ideas welcome..

etrader

Back to Top
chart rider View Drop Down
Regular
Regular
Avatar

Joined: 25 Sep 2004
Location: Australia
Posts: 96
Post Options Post Options   Quote chart rider Quote  Post ReplyReply Direct Link To This Post Posted: 18 Dec 2006 at 7:30pm

etrader

The stops tab executes the script once only, on the day of entry.  Try using C - 2*ATR(10), I'm fairly sure this will work.

CR

 

Back to Top
etrader View Drop Down
Regular
Regular
Avatar

Joined: 18 Dec 2004
Posts: 63
Post Options Post Options   Quote etrader Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jan 2007 at 7:41pm

thanks Chartrider, but not exactly what i am after, my explanation not the best.

I was trying to use the entryprice as a reference for my exit if that makes sense. Will try and expand a bit, noting this is entering and exiting on the same daily bar.

I wish to exit at my entryprice (open+0.01) plus 1*ATR(10), and if the high does not reach this figure, my secondary exit will be at the close.

I tried to put these exits into a bullscript exit on the exit tab but does not work for some reason. Further ideas appreciated.

 

Back to Top
chart rider View Drop Down
Regular
Regular
Avatar

Joined: 25 Sep 2004
Location: Australia
Posts: 96
Post Options Post Options   Quote chart rider Quote  Post ReplyReply Direct Link To This Post Posted: 07 Jan 2007 at 8:06pm

etrader

Not sure if it will work, but try the following:

In the exit tab:

ExitTrigger := EntryTrigger;   {sets exit to same day as entry}

In the Exit Price dialog box:

if(H >= O+0.01+ATR(10), O+0.01+ATR(10), C);

I'd be interested in your feedback on whether or not this works.

CR

Back to Top
etrader View Drop Down
Regular
Regular
Avatar

Joined: 18 Dec 2004
Posts: 63
Post Options Post Options   Quote etrader Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jan 2007 at 11:34pm

thanks Chart Rider for your magic,

ExitTrigger and EntryTrigger were not recognised for some reason, programming not being in my forte ! I just used "Volume>0" for my Exit Condition, to be able to exit on the same day as my entry.

The Exit Price section was perfect, and was interesting being able to produce different results. Now going one step further produced another challenge for me. I expanded your working exit example to the one below, which is supposed to read an exit of 3% > Open, or the Open + 1*ATR(10) exit, otherwise exit @ close if these conditions are not met. It seems to be valid in Bullscript formula but comes out "invalid exit price data" in Tradesim. Can you see where my problem lays ??

if(H >= O*1.03 or O+(1*atr(10)), O*1.03 or O+(1*atr(10)), C);

thanks again

etrader

 

Back to Top
chart rider View Drop Down
Regular
Regular
Avatar

Joined: 25 Sep 2004
Location: Australia
Posts: 96
Post Options Post Options   Quote chart rider Quote  Post ReplyReply Direct Link To This Post Posted: 09 Jan 2007 at 7:46pm

et

Presumably you wish to exit at the ATR based profit target, unless it is greater than the 3% level, in which case 3% will do just fine and you will take it and run.

Your usage of the OR statement is ambiguous in this regard and Bullcharts will be unable to resolve the code.

You might find it better to break the code down into smaller statements to make it easier to manage, for example:

profitTarget := min(O*1.03, O+(1*ATR(10)));

if(H >= profitTarget, profitTarget, C);

CR

Back to Top
etrader View Drop Down
Regular
Regular
Avatar

Joined: 18 Dec 2004
Posts: 63
Post Options Post Options   Quote etrader Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jan 2007 at 10:12pm

much appreciated for the help CR

ET

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