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

RE: Alexander Elder's "SafeZone Stop"



PureBytes Links

Trading Reference Links

Would someone care to comment on this Book. I am considering purchasing It.

Regards
Jerry

> -----Original Message-----
> From: Barry Silberman [mailto:barry@xxxxxxxxxxxxxxxxxxxxx]
> Sent: Sunday, May 05, 2002 8:34 AM
> To: omega-list@xxxxxxxxxx
> Subject: RE: Alexander Elder's "SafeZone Stop"
> 
> 
> To List:
> 
> Many thanks to those who worked to improve my initial code 
> for Alexander
> Elder's "SafeZone Stop".
> 
> The version below is a combination of the code John Lynch 
> provided to me
> privately for testing (which he has approved for posting to 
> the list) and
> some neat additions from Eric Svendesen, which he previously 
> provided to the
> list.   The array formula below gives identical results to 
> the "LONG" way of
> doing it.
> 
> Regards,
> 
> Barry Silberman
> 
> 
> ==============================================================
> ==============
> ==
> { Barry Silberman's version of Alexander Elder's "SafeZone 
> Stop" from book
> "Come Into My Trading Room" page 173
> Amended by John Lynch 5/1 for array and
> Amended by Eric Svendsen's 5/3 for Coloured Stop and trend variable}
> 
> inputs: Price((H+L)/2 ), Length( 22), MULTIPLELONG(1), 
> MULTIPLESHORT(1),
>         Lookback(15), trend(3), ColourShort(Red), ColourLong(Blue);
> 
> variables: MA(0),  LONGSUM(0),  SHORTSUM(0) , COUNTLONG(0), 
> COUNTSHORT(0),
> AVGLOW(0),
>            AVGHIGH(0), LONGSTOP(0), SHORTSTOP(0), LSTOP(0), 
> SSTOP(0), ii(0);
> 
> Arrays: Lday[30](0), Sday[30](0);
> 
> {determine trend by slope of EMA}
> MA = xaverage( Price, Length );
> 
> CONDITION1 = MA > MA[trend];
> CONDITION2 = MA < MA[trend];
> 
> {SafeZone for Longs}
> IF CONDITION1 THEN For ii=1 to Lookback Begin
>   Lday[ii]=IFF(L[ii]>L[ii-1],L[ii]-L[ii-1],0);
> End;
> 
> {TOTAL ALL VALUES OF LOWS BEING LOWER THAN PRIOR LOW}
> Longsum=0;
> For ii=1 to Lookback Begin
>   LONGSUM =LONGSUM + Lday[ii];
> End;
> 
> {COUNT NUMBER OF DAYS WITH LOWS BEING LOWER THAN PRIOR LOW}
> COUNTLONG = 0;
> For ii=1 to Lookback Begin
>   COUNTLONG = COUNTLONG + IFF(Lday[ii]>0,1,0);
> End;
> 
> {GET AVERAGE OF LOWS LOWER THAN PRIOR LOW}
> IF COUNTLONG <> 0 THEN
> AVGLOW = LONGSUM / COUNTLONG;
> 
> {CALCULATE STOP AT "X" TIMES AVGLOW}
> LSTOP = LOW[1] - (MULTIPLELONG * AVGLOW[1]);
> 
> {PREVENT STOP FROM BEING LOWERED}
> LONGSTOP = MAXLIST(LSTOP, LSTOP[1], LSTOP[2], LSTOP[3], 
> LSTOP[4], LSTOP[5]);
> 
> {SET PLOT}
> IF CONDITION1 THEN
> PLOT1(LONGSTOP, "STOP", ColourLong);
> 
> 
> {SafeZone for SHORTS}
> IF CONDITION2 THEN For ii=1 to Lookback Begin
>   Sday[ii]=IFF(H[ii]<H[ii-1],H[ii-1]-H[ii],0);
> End;
> 
> {TOTAL ALL VALUES OF HIGHS BEING HIGHER THAN PRIOR HIGH}
> Shortsum=0;
> For ii=1 to Lookback Begin
>   SHORTSUM =SHORTSUM + Sday[ii];
> End;
> 
> {COUNT NUMBER OF DAYS WITH HIGHS BEING HIGHER THAN PRIOR HIGH}
> COUNTSHORT = 0;
> For ii=1 to Lookback Begin
>   COUNTSHORT = COUNTSHORT + IFF(Sday[ii]>0,1,0);
> End;
> 
> {GET AVERAGE OF HIGHS HIGHER THAN PRIOR HIGH}
> IF COUNTSHORT <> 0 THEN
> AVGHIGH = SHORTSUM / COUNTSHORT;
> 
> {CALCULATE STOP AT "X" TIMES AVGHIGH}
> SSTOP = HIGH[1] + (MULTIPLESHORT * AVGHIGH[1]);
> 
> {PREVENT STOP FROM RISING}
> SHORTSTOP = MINLIST(SSTOP, SSTOP[1], SSTOP[2], SSTOP[3], SSTOP[4],
> SSTOP[5]);
> 
> {SET PLOT}
> IF CONDITION2 THEN
> PLOT1(SHORTSTOP, "STOP", ColourShort);
>