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

Excel code



PureBytes Links

Trading Reference Links

Didnt somebody ask for some indicators in Excel coder? Here is a site i
found tonight:

http://www.debry.com/a_to_z_companion_spreadsheet.htm

I have no idea how good it is.

Volker Knapp



  ++-----Ursprüngliche Nachricht-----
  ++Von: Barry Silberman [mailto:barry@xxxxxxxxxxxxxxxxxxxxx]
  ++Gesendet: Mittwoch, 1. Mai 2002 05:50
  ++An: omega-list@xxxxxxxxxx
  ++Betreff: Alexander Elder's new "SafeZone Stop"
  ++
  ++
  ++To List,
  ++
  ++Listed below is my code for implementing Alexander Elder's new "SafeZone
  ++Stop" that he presented in his new book "Come Into My Trading
  ++Room". (pages
  ++173-180).   In an uptrend, he defines noise as that part of
  ++each day's range
  ++that protrudes below the previous day's low, and in a
  ++downtrend, he defines
  ++noise as that part of each day's range that protrudes above the previous
  ++day's high.  The "SafeZone stop" measures market noise and
  ++places stops at a
  ++multiple of noise levels away from the market.
  ++
  ++The code works as is for a 15 day lookback, but I'm sure someone could
  ++improve the code to
  ++A) make the "lookback" period a variable
  ++B) reduce the lines of code by using an array or loops.
  ++
  ++================================================================
  ++=========
  ++{ Barry Silberman's version of Alexander Elder's "SafeZone
  ++Stop" from book
  ++"Come Into My Trading Room" page 173}
  ++
  ++inputs:
  ++ Price((H+L)/2 ), Length( 22), MULTIPLELONG(1), MULTIPLESHORT(1);
  ++
  ++variables:
  ++ MA(0),  Lday1(0), Lday2(0), Lday3(0), Lday4(0), Lday5(0), Lday6(0),
  ++Lday7(0), Lday8(0), Lday9(0), Lday10(0),
  ++ Lday11(0), Lday12(0), Lday13(0), Lday14(0), Lday15(0),
  ++Sday1(0), Sday2(0),
  ++Sday3(0), Sday4(0), Sday5(0),
  ++ Sday6(0), Sday7(0), Sday8(0), Sday9(0), Sday10(0), Sday11(0),
  ++Sday12(0),
  ++Sday13(0), Sday14(0), Sday15(0),
  ++ LONGSUM(0),  SHORTSUM(0) , COUNTLONG(0), COUNTSHORT(0), AVGLOW(0),
  ++AVGHIGH(0), LONGSTOP(0), SHORTSTOP(0),
  ++ LSTOP(0), SSTOP(0);
  ++
  ++{determine trend by slope of EMA}
  ++MA = xaverage( Price, Length );
  ++
  ++CONDITION1 = MA > MA[3];
  ++CONDITION2 = MA < MA[3];
  ++
  ++{SafeZone for Longs}
  ++
  ++IF CONDITION1 THEN BEGIN
  ++   LDAY1 = IFF(L[1]>L, L[1] - L, 0);
  ++    LDAY2 = IFF(L[2]>L[1], L[2] - L[1], 0);
  ++    LDAY3 = IFF(L[3]>L[2], L[3] - L[2], 0);
  ++    LDAY4 = IFF(L[4]>L[3], L[4] - L[3], 0);
  ++    LDAY5 = IFF(L[5]>L[4], L[5] - L[4], 0);
  ++    LDAY6 = IFF(L[6]>L[5], L[6] - L[5], 0);
  ++    LDAY7 = IFF(L[7]>L[6], L[7] - L[6], 0);
  ++    LDAY8 = IFF(L[8]>L[7], L[8] - L[7], 0);
  ++    LDAY9 = IFF(L[9]>L[8], L[9] - L[8], 0);
  ++    LDAY10 = IFF(L[10]>L[9], L[10] - L[9], 0);
  ++    LDAY11 = IFF(L[11]>L[10], L[11] - L[10], 0);
  ++    LDAY12 = IFF(L[12]>L[11], L[12] - L[11], 0);
  ++    LDAY13 = IFF(L[13]>L[12], L[13] - L[12], 0);
  ++    LDAY14 = IFF(L[14]>L[13], L[14] - L[13], 0);
  ++    LDAY15 = IFF(L[15]>L[14], L[15] - L[14], 0);
  ++End;
  ++
  ++
  ++{TOTAL ALL VALUES OF LOWS BEING LOWER THAN PRIOR LOW}
  ++
  ++LONGSUM = LDAY1 + LDAY2 + LDAY3 + LDAY4 + LDAY5 + LDAY6 + LDAY7
  +++ LDAY8 +
  ++LDAY9 + LDAY10 +
  ++       LDAY11 + LDAY12 + LDAY13 + LDAY14 + LDAY15;
  ++
  ++
  ++{COUNT NUMBER OF DAYS WITH LOWS BEING LOWER THAN PRIOR LOW}
  ++
  ++COUNTLONG = 0;
  ++IF LDAY1 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY2 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY3 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY4 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY5 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY6 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY7 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY8 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY9 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY10 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY11 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY12 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY13 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY14 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++IF LDAY15 > 0 THEN COUNTLONG = COUNTLONG + 1;
  ++
  ++{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");
  ++
  ++
  ++{SafeZone for SHORTS}
  ++
  ++IF CONDITION2 THEN BEGIN
  ++    SDAY1 = IFF(H[1]<H, H - H[1], 0);
  ++    SDAY2 = IFF(H[2]<H[1], H[1] - H[2], 0);
  ++    SDAY3 = IFF(H[3]<H[2], H[2] - H[3], 0);
  ++    SDAY4 = IFF(H[4]<H[3], H[3] - H[4], 0);
  ++    SDAY5 = IFF(H[5]<H[4], H[4] - H[5], 0);
  ++    SDAY6 = IFF(H[6]<H[5], H[5] - H[6], 0);
  ++    SDAY7 = IFF(H[7]<H[6], H[6] - H[7], 0);
  ++    SDAY8 = IFF(H[8]<H[7], H[7] - H[8], 0);
  ++    SDAY9 = IFF(H[9]<H[8], H[8] - H[9], 0);
  ++    SDAY10 = IFF(H[10]<H[9], H[9] - H[10], 0);
  ++    SDAY11 = IFF(H[11]<H[10], H[10] - H[11], 0);
  ++    SDAY12 = IFF(H[12]<H[11], H[11] - H[12], 0);
  ++    SDAY13 = IFF(H[13]<H[12], H[12] - H[13], 0);
  ++    SDAY14 = IFF(H[14]<H[13], H[13] - H[14], 0);
  ++    SDAY15 = IFF(H[15]<H[14], H[14] - H[15], 0);
  ++End;
  ++
  ++
  ++{TOTAL ALL VALUES OF HIGHS BEING HIGHER THAN PRIOR HIGH}
  ++
  ++SHORTSUM = SDAY1 + SDAY2 + SDAY3 + SDAY4 + SDAY5 + SDAY6 +
  ++SDAY7 + SDAY8 +
  ++SDAY9 + SDAY10 +
  ++       SDAY11 + SDAY12 + SDAY13 + SDAY14 + SDAY15;
  ++
  ++
  ++{COUNT NUMBER OF DAYS WITH HIGHS BEING HIGHER THAN PRIOR HIGH}
  ++
  ++COUNTSHORT = 0;
  ++IF SDAY1 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY2 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY3 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY4 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY5 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY6 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY7 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY8 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY9 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY10 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY11 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY12 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY13 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY14 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++IF SDAY15 > 0 THEN COUNTSHORT = COUNTSHORT + 1;
  ++
  ++{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");
  ++
  ++
  ++
  ++
  ++
  ++
  ++
  ++