[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Apply Stop



PureBytes Links

Trading Reference Links

Applystop works differently fomr nrmal sell condtions as it does not give a yes/no answer bt controls the trade exits directly
 
provided you do not get any additional buy signals before an exit occurs the code below should give you what you want. Any subsequent buy signals after entry will reset the conditions, you will need to use loops to define the exits and not use applystop at all.
 
buy = A or B;
condA = valuewhen( buy, A );
condB = valuewhen( buy, B );
 
Sell = 0;
If(CondB) ApplyStop( 1, 1, 4.5, True);
If(condA) ApplyStop( 1, 1, 2, True);
 
 
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm

 
On 3/1/06, lapilia <lapilia@xxxxxxxxxxxx> wrote:
Hi
 
I have one trading system that contains two entries. The name of the first one is A, the name of the second one is B. 
 
I would like to exit A when a 4.5% profit is reached, and exit B when a 2.0% profit is reached.
 
Here's the formula I use.

Buy

= A OR B;

Sell = IIf(B, ApplyStop( 1, 1, 4.5 , True), IIf(A, ApplyStop( 1, 1, 2, True), 0));

Unfortunately, this formula doesn't work.  The exit always happens when a 4.5% profit is reached, whatever the entry is (A or B).

Could someone tells me the correct formula or where I can find info in order to resolve this problem ?

Thanks a lot

Claude Marc-Aurčle



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS








Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS