Why don't you use just the code provided in the User's Guide?
http://www.amibroker.com/guide/h_backtest.html

It's easy to modify profit target to trailing stop working from Low.

Something like that:

Buy = Cross( MACD(), Signal() ); 
Sell=0; 

Lowtrail=0; 

for( i = 0; i < BarCount; i++ ) 
{ 
     if( Lowtrail== 0 && Buy[ i ] ) 
     Lowtrail= Low[ i ]; 

     if( Lowtrail> 0 AND Low[ i ] > Lowtrail ) 
     { 
       Lowtrail = Low[ i ]; // move trailing level higher if current low is 
higher 
     } 

     if( Lowtrail > 0 AND Low[ i ] < Lowtrail ) 
     { 
       Sell[ i ] = 1; 
       SellPrice[ i ] = Lowtrail; 
       Lowtrail = 0; 
     } 
     else 
       Sell[ i ] = 0; 
} 


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Greg" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, July 30, 2007 11:38 AM
Subject: [amibroker] Re: Trailing Stop in AB


> Howard,
> I was told that the trailing stop in the system works off the high 
> and that you need a plug in to work off the LOW.
> 
> Cheers Greg
> 
> --- In [email protected], "Howard B" <[EMAIL PROTECTED]> wrote:
>>
>> Hi Greg --
>> 
>> No plug in is needed.  Information about stops is in the 
> documentation.
>> 
>> When AmiBroker is open, pull down the Help menu, Click Help 
> Contents, type
>> in "Trailing Stop" or "ApplyStop".  It's all there.
>> 
>> Howard
>> 
>> 
>> On 7/20/07, Greg <[EMAIL PROTECTED]> wrote:
>> >
>> >   I am trying to put a trailing stop to a system I am building 
> but had
>> > heard I need a plug in of some kind.Any help would be greatly
>> > appreciated.
>> >
>> > Cheers Greg
>> >
>> >  
>> >
>>
> 
> 
> 
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>

Reply via email to