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

Re: [amibroker] Re: Trailing Stop in AB



PureBytes Links

Trading Reference Links

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" <crootster@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
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 amibroker@xxxxxxxxxxxxxxx, "Howard B" <howardbandy@xxx> 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 <crootster@xxx> 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
> 
> 
> 
> 
>


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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/