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

Re: [amibroker] Re: Trailingstop & applystop



PureBytes Links

Trading Reference Links

Hello,

> Thanks for the answer, but I figure that the 'amount' is a value to 
> be substrated from the hightest high the trade has reached earlier.

This is how trailing stop works. 

> Is there a way to calculate a fixed price level that stays the same 
> without changing at all.

Yes. Use max. loss stop (type = 1).

> For example, I had a trigger value to go long at 10 1/8 at the same 
> time I want to place a maximum loss stop of 8 7/8 and this level 
> stays the same throughout the trade, no changes regardless of other 
> target stops or trailing stops that might be used later.
> 

There are 3 kinds of stops in AMiBroker: max. loss, profit target
and trailing. You can mix all of them in the same formula. 
The one you need is simply max. loss stop (type = 1 ) as described
in the User's Guide:

SYNTAX applystop( type, mode, amount, exitatstop ) 
RETURNS nothing 
FUNCTION controls built-in stops from the formula level (allows optimization of stops)


Parameters: 
type = 0 - maximum loss stop, 1 - profit target stop, 2 - trailing stop 
mode = 0 - disable stop, 1 - amount in percent, 2 - amount in points, 3 - amount in percent of profit (risk)
amount = percent/point loss/profit trigger/risk amount. this could be a number (static stop level) or an array (dynamic stop level)
exitatstop = 0 - exits at defined price field, 1 - exits at stop level 

EXAMPLE applystop( 0, 2, max_loss_in_points, 1 );

Best regards,
Tomasz Janeczko
amibroker.com