Print Page | Close Window

bullscript for stoploss..

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: TradeSim discussion
Forum Discription: For discussions of BullCharts' integration with the TradeSim backtesting product.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=401
Printed Date: 02 May 2024 at 9:42am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: bullscript for stoploss..
Posted By: etrader
Subject: bullscript for stoploss..
Date 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




Replies:
Posted By: chart rider
Date 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

 



Posted By: etrader
Date 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.

 



Posted By: chart rider
Date 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



Posted By: etrader
Date 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

 



Posted By: chart rider
Date 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



Posted By: etrader
Date Posted: 10 Jan 2007 at 10:12pm

much appreciated for the help CR

ET




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