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

[amibroker] Two trailing stops possible - 7% and ATR(10)?



PureBytes Links

Trading Reference Links

Does Amibroker allow two trailing stops?

I've been trying to code two trailing stops with different criteria in Amibroker 5.10.  
Why do this:  Some, but not all, of the ATR-based trailing stops allow too big of a loss when the 7% stop seems to catch them earlier. 

Here is what I've tried:
The first criterion is for a 7% trailing stop.
The second criterion is for an ATR-based trailing stop.  
They are in this order in the code.
When running the code, it displays on a chart the two trailing stops as expected.  However, when I look at the resulting table in the Automatic  Analysis window, it doesn't show the 7% trailing stop data.  However, the ATR-based stop does show in the table.

>From the settings button and then the Backtester window, and then the Stops tab, I disabled the trailing stops.  I did this because the software code by the user overrides the backtester settings as I understand it.

My backtest mode:  
SetBacktestMode(backtestRegular);
Here is the 7% trailing stop code:

ApplyStop(2,1,7,1,False,1);
Equity(1,0);  //ThIS EVALUATES STOPS. 
Plot(Sell==4,"7% Loss",colorBlue,styleArea|styleOwnScale);//4 is for trailing stops

For the ATR-based trailing stop:

TrailStop = 0;
TrailStop = HHV( C - 3* ATR(10),15);
Sell = C < TrailStop OR Open < TrailStop OR Low < TrailStop; //must tell it when to sell 
ApplyStop(2, 2, TrailStop, 1, False, 1) ;
Equity(1,0);  //ThIS EVALUATES STOPS
Plot(Sell,"Trlng Stop 3*atr(10)",colorOrange,styleArea|styleOwnScale);

So, either the application won't recognize two trailing stops criteria or I have overlooked something. I think it is the latter, but I just don't know where.

My test cases were Powershares ETFs from 1 Sep 08 through 4 Apr 09.

Will anyone point me to a solution?

Regards








------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/