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

[amibroker] SafeZone Stop Implementation



PureBytes Links

Trading Reference Links

I'm trying to implement a SafeZone Stop.  I'm certain the stop logic 
is coded correctly, but I find the directions for ApplyStop to be 
very confusing.  This stop graphs correctly, but when backtested, 
the stop doesn't behave correctly.  I'm entering on close and would 
like to have the stop placed the next day and when hit the trade 
should be exited at the stop price.  I have "Activate Stops 
Immediately" although I don't fully understand the affect this has.  
I think I'm just a little foggy on the scope of when things happen.

Any help would be very much appreciated as I've gotten to the point 
where I've exhausted all resources and am just getting frustrated.


BuySignal = close > ema(close,20);
Buy = BuySignal;
SellSignal = close < ema(close,20);
Sell = SellSignal;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

//Implement Safezone Stop/////
L1=Ref(L,-1);
Pd=Param("Period",10,1,50,1);
DnPen=IIf(L<L1,L1-L,0);
DnPenSum=Sum(DnPen,Pd);
DnPenCount=Sum(L<L1,Pd);
AvgDnPen=DnPenSum/DnPenCount;
AvgDnPenMult=Param("Multiplier",2,1,4,0.1);
DaysInTrade=BarsSince(Buy);
StopLong=L-(AvgDnPen*AvgDnPenMult);
SafeZoneStopLong=HHV(StopLong,DaysInTrade);

ApplyStop(stopTypeTrailing,stopModePoint,Ref(Low,-1)-
SafeZoneStopLong,1);

Plot(Close,"Close",colorBlack,styleBar);
Plot( SafeZoneStopLong, "Trailing stop", colorBrown, styleThick | 
styleLine  ); 
PositionSize = -15;





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 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/

<*> 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/