PureBytes Links
Trading Reference Links
|
I tried this. I duplicated it exactly, except for testing I used
Stop=2 instead of 2*ATR.
It triggers both max stops and trailing stops (as identified in the
backtest window). In actuality it is just triggering trailing
stops. This is the problem I keep having with MaxSTopLoss. It
triggers a trailing stop and doesn't hold a static value.
Either I am doing something wrong (likely), or MaxStopLoss is doing
what it is supposed to do. I've tried it a hundred different ways.
What I want is to set a stop at, say, 10 Points. Then the stock can
go up to 100 and all the way back down to 10 before it would stop
out. Instead, it stops out at 90.
????
In amibroker@xxxxxxxxxxxxxxx, eric paradis
<thechemistrybetweenus@xxxx> wrote:
>
> Use as an entry stop-
>
> Stop = 2 * ATR(10);
> ApplyStop( 0, 2, Stop, 0,0 );
>
> The ApplyStop function in the UserGuide will help you
> see what the settings are for applystop.
>
> Below is a trailing stop
>
> Trail = 6* ATR(10);
> ApplyStop(stopTypeTrailing, stopModePoint, Trail, 1,
> True,0);
>
> Eric
>
> P.S I found that the turtles rules in their original
> form do not work well at all. You need advanced
> pyramiding and Ive had limited sucess with this. But
> good luck!
>
> Eric
>
> --- balin8425 <balin8425@xxxx> wrote:
>
> > I'd like to write the code for a stop that is 2*ATR
> > below the price
> > at which I buy the stock. I can't figure it out. I
> > am trying to
> > translate the Turtle Trading Rules below. Has
> > anyone tried this?
> > Can someone tell me how to do the STOP?
> >
> > I tried ApplyStop but couldn't figure it out. I am
> > totally new to
> > AFL, and to Amibroker.
> >
> > Thanks, Balin Butler
> >
> >
> >
> >
> >
> > /// Turtle 20-Day Breakout
> > Replica //////////////////////////////////////
> >
> > vars:
> >
> N(0),StopLoss(1),DV(0),BB(0),AccountBalance(0),DollarRisk
> > (0),LTT(0),
> > Tracker(0),LastTrade(0),HBP(0),LBP(0); input:
> > InitialBalance
> > (100000),Length(20);
> >
> > if marketposition = 0 then begin
> > BB = 0;
> > N = xAverage( TrueRange, Length );
> > DV = N * BigPointValue;
> >
> > AccountBalance = InitialBalance;
> > DollarRisk = AccountBalance * .01;
> > LTT = IntPortion(DollarRisk/DV);
> > StopLoss = 2 * DV * LTT;
> >
> > if LastTrade = -1 then begin
> > buy LTT shares next bar highest(h,20) or higher;
> > buy LTT shares next bar highest(h,20) + (0.5*N) or
> > higher;
> > buy LTT shares next bar highest(h,20) + (1.0*N) or
> > higher;
> > buy LTT shares next bar highest(h,20) + (1.5*N) or
> > higher;
> > sellshort LTT shares next bar lowest(l,20) or lower;
> >
> > sellshort LTT shares next bar lowest(l,20) - (0.5*N)
> > or lower;
> > sellshort LTT shares next bar lowest(l,20) - (1.0*N)
> > or lower;
> > sellshort LTT shares next bar lowest(l,20) - (1.5*N)
> > or lower;
> > end;
> >
> > if LastTrade = 1 then begin
> > buy LTT shares next bar highest(h,55) or higher;
> > buy LTT shares next bar highest(h,55) + (0.5*N) or
> > higher;
> > buy LTT shares next bar highest(h,55) + (1.0*N) or
> > higher;
> > buy LTT shares next bar highest(h,55) + (1.5*N) or
> > higher;
> > sellshort LTT shares next bar lowest(l,55) or lower;
> >
> > sellshort LTT shares next bar lowest(l,55) - (0.5*N)
> > or lower;
> > sellshort LTT shares next bar lowest(l,55) - (1.0*N)
> > or lower;
> > sellshort LTT shares next bar lowest(l,55) - (1.5*N)
> > or lower;
> > end;
> >
> > end;
> >
> > // PREVIOUS TRADE TRACKER
> > if HBP = 0 and h > highest(h,19)[1] then begin
> > Tracker = 1; HBP = h; LBP = 0;
> > end;
> >
> > if LBP = 0 and l < lowest(l,19)[1] then begin
> > Tracker = -1; LBP = l; HBP = 0;
> > end;
> >
> > if Tracker = 1 then begin
> > if l < HBP - (2*N) then LastTrade = -1;
> > if h > HBP + (4*N) then LastTrade = 1;
> > end;
> >
> > if Tracker = -1 then begin
> > if h > LBP + (2*N) then LastTrade = -1;
> > if l < LBP - (4*N) then LastTrade = 1;
> > end;
> >
> > // LONG 20
> > if LastTrade = -1 and marketposition = 1 then begin
> > BB = BB + 1;
> > if currentshares = LTT then begin
> > buy LTT shares next bar highest(h,20)[BB] + (0.5*N)
> > or higher;
> > buy LTT shares next bar highest(h,20)[BB] + (1.0*N)
> > or higher;
> > buy LTT shares next bar highest(h,20)[BB]+ (1.5*N)
> > or higher;
> > end;
> >
> > if currentshares = LTT * 2 then begin
> > buy LTT shares next bar highest(h,20)[BB] + (1.0*N)
> > or higher;
> > buy LTT shares next bar highest(h,20)[BB] + (1.5*N)
> > or higher;
> > end;
> >
> > if currentshares = LTT * 3 then
> > buy LTT shares next bar highest(h,20)[BB] + (1.5*N)
> > or higher;
> > end;
> >
> > // LONG 55
> > if LastTrade = 1 and marketposition = 1 then begin
> > BB = BB + 1;
> > if currentshares = LTT then begin
> > buy LTT shares next bar highest(h,55)[BB] + (0.5*N)
> > or higher;
> > buy LTT shares next bar highest(h,55)[BB] + (1.0*N)
> > or higher;
> > buy LTT shares next bar highest(h,55)[BB]+ (1.5*N)
> > or higher;
> > end;
> > if currentshares = LTT * 2 then begin
> > buy LTT shares next bar highest(h,55)[BB] + (1.0*N)
> > or higher;
> > buy LTT shares next bar highest(h,55)[BB] + (1.5*N)
> > or higher;
> > end;
> > if currentshares = LTT * 3 then
> > buy LTT shares next bar highest(h,55)[BB] + (1.5*N)
> > or higher;
> > end;
> > sell ("out-S") next bar lowest(l,10) or lower;
> >
> > // SHORT 20
> > if LastTrade = -1 and marketposition = -1 then begin
> >
> > BB = BB + 1;
> > if currentshares = LTT then begin
> > sellshort LTT shares next bar lowest(l,20)[BB] -
> > (0.5*N) or lower;
> > sellshort LTT shares next bar lowest(l,20)[BB] -
> > (1.0*N) or lower;
> > sellshort LTT shares next bar lowest(l,20)[BB] -
> > (1.5*N) or lower;
> > end;
> > if currentshares = LTT * 2 then begin
> > sellshort LTT shares next bar lowest(l,20)[BB] -
> > (1.0*N) or lower;
> > sellshort LTT shares next bar lowest(l,20)[BB] -
> > (1.5*N) or lower;
> > end;
> > if currentshares = LTT * 3 then
> > sellshort LTT shares next bar lowest(l,20)[BB] -
> > (1.5*N) or lower;
> > end;
> >
> > // SHORT 55
> > if LastTrade = 1 and marketposition = -1 then begin
> > BB = BB + 1;
> > if currentshares = LTT then begin
> > sellshort LTT shares next bar lowest(l,55)[BB] -
> > (0.5*N) or lower;
> > sellshort LTT shares next bar lowest(l,55)[BB] -
> > (1.0*N) or lower;
> > sellshort LTT shares next bar lowest(l,55)[BB] -
> > (1.5*N) or lower;
> > end;
> > if currentshares = LTT * 2 then begin
> > sellshort LTT shares next bar lowest(l,55)[BB] -
> > (1.0*N) or lower;
> > sellshort LTT shares next bar lowest(l,55)[BB] -
> > (1.5*N) or lower;
> > end;
> > if currentshares = LTT * 3 then
> > sellshort LTT shares next bar lowest(l,55)[BB] -
> > (1.5*N) or lower;
> > end;
> > buytocover ("out-B") next bar highest(h,10) or
> > higher;
> >
> > // STOPS
> > if currentshares = (2 * LTT) then StopLoss = DV *
> > 3.5 * LTT;
> > if currentshares = (3 * LTT) then StopLoss = DV *
> > 4.5 * LTT;
> > if currentshares = (4 * LTT) then StopLoss = DV *
> > 5.0 * LTT;
> > setstoploss (StopLoss);
> >
> > // COMMENTARY
> > commentary ("LTT: ",LTT,Newline);
> > commentary ("CurrentShares:
> > ",CurrentShares,Newline);
> === message truncated ===
>
>
>
>
> __________________________________________
> Yahoo! DSL – Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
------------------------ 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/
|