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

RE: [amibroker] Priority of regular selling condition and applystop



PureBytes Links

Trading Reference Links

Bill
It seems that you canâ??t change to priority of the built in function stops in AFL  (i.e. Applystop). 
The priority is 
 
1 â?? regular exit
2 â?? max. loss
3 â?? profit target
4 â?? trailing
5 â?? nâ??bar stop
6 â?? ruin stop
 
You have more control by using some lower level type code using a for( i = 0; i < BarCount; i++ ) type loop. 
If you can get your head around coding this you can do mostly anything in AFL and you have better control of your system. Below is an example of a max loss exit loop I got from support. You would have to insert your regular sell condition in the loop. By doing this you control if your profit exit is triggered before the stop loss. You canâ??t mix using a loop exit as well as using an Applystop function stop, itâ??s either one or the other.
Hope this is some help.
Peter
 
 
 
 
 /* a sample low-level implementation of max-loss stop in AFL: */ 
priceatbuy=0; 
for( i = 0; i < BarCount; i++ ) 
{ 
      if( priceatbuy > 0 && Low[ i ] < 0.98 * priceatbuy ) 
     { 
       Sell[ i ] = 1; 
       SellPrice[ i ] = 0.98 * priceatbuy; 
       priceatbuy = 0; 
     } 
     else 
       Sell[ i ] = 0; 
 
      if( priceatbuy == 0 && Buy[ i ] ) 
           priceatbuy = BuyPrice[ i ]; 
 
} 
 
 
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of fox97us
Sent: Sunday, 13 August 2006 6:02 p.m.
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Priority of regular selling condition and applystop
 
Hello, all

I got a question about the priority of regular sell condition 
and stoploss using Applystop. It seems the Applystop has higher 
priority than regular selling condition. If selling condition and 
applystop happen on a same bar, the exit price will be calculated using 
applystop. 

How can I change it? I like to set the priority of selling 
condition higher than the applystop. Because my regular selling 
condition is set at open of each bar, which occurs earlier than 
applystop. 

Any comments are highly appreciated.

Bill