Here is this month's selection of Traders' Tips, contributed by various developers of technical analysis software to help readers more easily implement some of the strategies presented in this issue.You can copy these formulas and programs for easy use in your spreadsheet or analysis software. Simply "select" the desired text by highlighting as you would in any word processing program, then use your standard key command for copy or choose "copy" from the browser menu. The copied text can then be "pasted" into any open spreadsheet or other software by selecting an insertion point and executing a paste command. By toggling back and forth between an application window and the open Web page, data can be transferred with ease.
This month's tips include formulas and programs for:
TRADESTATION / SUPERCHARTS METASTOCK SMARTRADER WAVEWI$E MARKET SPREADSHEET TECHNIFILTER PLUSor return to September 1998 Contents
The focus of this month's Traders' Tips is the combination of a simple moving average with support and resistance, as presented by Dennis Tilley in his article "Moving averages with resistance and support." I have integrated this very interesting concept into both an indicator and a system for TradeStation or SuperCharts. Notice that the EasyLanguage codes for the indicator and the system are very similar.
We'll begin with the indicator, named "Mov avg--supp/res." The indicator has three inputs. "Price" and "length" are parameters for the basis of the moving average. "F" is the critical percentage, and should be entered as the percent value (8 = 8%). The plots for the indicator are as follows: the simple moving average line; points representing the support levels; and points representing the resistance levels. In order for the plots to appear correctly, the style for the indicator must be properly set (formatting information will follow the EasyLanguage code for the indicator).
Type: Indicator Name: Mov Avg--Supp/ResInputs: Price(Close), Length(10), F(8); Vars: AvgVal(0), S(0), R(0), SC(0), RC(0); AvgVal = Average(Price, Length); RC = RC + 1; SC = SC + 1; IF Close Crosses Below AvgVal AND Close > S* (1+(F/100)) AND R <> 0 Then Begin For value1 = RC-2 TO RC+2 Begin Plot2[value1](R, ÒRÓ); End; Alert = True; S = L; SC = 0; End Else Begin IF Close Crosses Below S AND R <> 0 Then Begin For value1 = RC-2 TO RC+2 Begin Plot2[value1](R, ÒRÓ); End; Alert = True; S = L; SC = 0; End; End; IF Close Crosses Above AvgVal AND Close < R / (1+(F/100)) AND S <> 0 Then Begin For value1 = SC-2 TO SC+2 Begin Plot3[value1](S, "S"); End; Alert = True; R = H; RC = 0; End Else Begin IF Close Crosses Above R AND S <> 0 Then Begin For value1 = SC-2 TO SC+2 Begin Plot3[value1](S, "S"); End; Alert = True; R = H; RC = 0; End; End; IF Close > AvgVal Then Begin IF High >= R Then Begin R = High; RC = 0; End; End; IF Close < AvgVal Then Begin IF Low <= S OR S = -1 Then Begin S = Low; SC = 0; End; End; Plot1(AvgVal, "SMA"); Style: Plot Name Type Color Weight Plot1 SMA Line Blue thinnest Plot2 R Point Magenta medium Plot3 S Point Cyan medium Scaling: Same as Price Data Properties: Enable AlertThe EasyLanguage for the moving average system is very similar to that for the indicator. The inputs "price," "length," and "F" have the same purpose.Type: System
Name: Mov Avg--Supp/ResInputs: Price(Close), Length(10), F(8); Vars: AvgVal(0), S(0), R(0), SC(0), RC(0); AvgVal = Average(Price, Length); RC = RC + 1; SC = SC + 1; IF CurrentBar > 1 Then Begin IF Close Crosses Below AvgVal AND Close > S* (1+(F/100)) AND R <> 0 Then Begin Sell Next Bar at Market; S = Low; SC = 0; End Else Begin IF Close Crosses Below S AND R <> 0 Then Begin Sell Next Bar at Market; S = Low; SC = 0; End; End; IF Close Crosses Above AvgVal AND Close < R / (1+(F/100)) AND S <> 0 Then Begin Buy Next Bar at Market; R = High; RC = 0; End Else Begin IF Close Crosses Above R AND S <> 0 Then Begin Buy Next Bar at Market; R = High; RC = 0; End; End; IF Close > AvgVal Then Begin IF High >= R Then Begin R = High; RC = 0; End; End; IF Close < AvgVal Then Begin IF Low <= S OR S = -1 Then Begin S = Low; SC = 0; End; End; End;This code is available at Omega Research's Web site. The file name is "MA_SR.ELA." Please note that all the Traders' Tips analysis techniques that are posted at the Omega Research Web site can be utilized by both TradeStation and SuperCharts. Whenever possible, the posted analysis techniques will include both Quick Editor and Power Editor formats.GO BACK--Gaston Sanchez, Omega Research
800 422-8587, 305 270-1095
Internet: https://www.OmegaResearch.com
In this issue, Dennis Tilley uses support and resistance to confirm price and simple moving average (SMA) crossover signals in his article "Moving averages with resistance and support."In MetaStock for Windows, you can easily recreate the SMARS indicators discussed in Tilley's article. First, choose Indicator Builder from the Tools menu in MetaStock 6.5. Next, choose New and enter the following formulas:
Resistance and Support
LookBack := Input("Look Back Periods",1,1000,10);
Resistance :=ValueWhen (1,Cross(Mov(C, LookBack, S),C),HHV(H, LookBack));
Support :=ValueWhen (1,Cross(C,Mov(C, LookBack, S)),LLV(L, LookBack));
Resistance;
Support;Resistance and Support * F
PrCnt:=Input("Percentage",0,100,10);
LookBack:= Input("Look Back Periods",1,1000,10); Resistance:=ValueWhen(1,Cross(Mov(C,LookBack,S),C),HHV(H,LookBack)); Support:=ValueWhen(1,Cross(C,Mov(C,LookBack,S)),LLV(L,LookBack));
Resistance * ((100-prcnt)/100);
Support * ((prcnt/100)+1);(Note that it's much easier to see the difference between the resistance and support * F lines and the actual resistance and support lines if you change the color and/or style of one of them.)
To display the indicators in MetaStock 6.5, drag the moving average indicator from the Indicator QuickList into the price window. Choose simple as the method, enter the time periods and then click OK.
Now, drag the resistance and support indicator from the QuickList into the price window. You will be prompted to enter the lookback periods. You should select the same time periods that you used for the moving average.
Finally, drag the "resistance and support * F" indicator into the price window. You will be prompted to enter the percentage and the lookback periods. If you would like the indicator to be a 10% difference from the resistance and support line, you would enter 10. Again, you should select the same time periods you used for the moving average.
GO BACK--Allan J. McNichol, Equis International
800 882-3040, 801 265-8886
Internet: https://www.equis.com
Implementation of Dennis Tilley's SMARS indicators is simple in SmarTrader. (See the SmarTrader specsheet in Figure 1.) Begin by adding a coefficient in row 9, which is named "periods," to contain the number of weeks (10) for the simple moving average (SMA) and the lookback for support and resistance. Row 10 is a simple moving average of the close (row 6) using the coefficient periods. Row 11 determines the resistance level (R) using the function "highest" on close for periods. Row 12 determines the support level (S) using the function "lowest." Note that the SMA, R and S all use the coefficient periods. This makes for easy what-if testing by just changing the value held in periods.Another coefficient, "percent" in row 13, was used to contain the value of the "critical percentage" as a fraction. Row 14, "Rwork," is a user row that calculates the level of the critical percent below R. Row 15, "Swork," similarly computes the critical percent above S. Rows 16 and 17 are user rows defining the conditions for buy and sell. Note in the next row, "trade," the short entry and exit are set to zero to prevent any short trades.
We tested this system using the S&P cash for data using only a 10-week SMA. We did try various values for percent and found that 2% worked best, since this data is trending steadily up. The result was strong equity gain with very few trades.
CompuTrac SNAP users can implement this system with no changes.
This specsheet file is available on Stratagem Software's Web site.
FIGURE 1: SMARTRADER. This SmarTrader specsheet implements Dennis Tilley's simple moving average system.
GO BACK--Jim Ritter, Stratagem Software International
504 885-7353, E-mail: Stratagem1@aol.com
Internet: https://members.aol.com/stratagem1
These Wave Wi$e formulas implement Dennis Tilley's simple moving average system.A: DATE @TC2000(C:\TC2000\DATA,SP-500,STANDARD & POORS 500,DB)
B: HIGH
C: LOW
D: CLOSE
E: OPEN
F: VOL
G: convert @CONVERT(1) 'CONVERT DATA TO WEEKLY OR MONTHLY H: period 20 'CHANGE PERIOD AS DESIRED
I: avg @MAVG(CLOSE,PERIOD)
J: signals @SIGNAL(CLOSE,BUY, CLOSE>=AVG, CLOSE<AVG)
K:
L: color @IF(SIGNALS>0, GREEN,RED) 'COLOR BUY/SELL BARS
M:
==========End FormulasGO BACK--Peter Di Girolamo, Jerome Technology
908 369-7503, E-mail: jtiware@aol.com
Internet: https://members.aol.com/jtiware
Given here is a TechniFilter Plus strategy that implements Dennis Tilley's simple moving average system. The resistance and support levels are given in formulas 2 and 3. The resistance requires tracking the maximum high while the close is above the average in a recursive manner. The support is computed in an analogous manner. The buy signal checks to see if the close has broken the resistance level, or if it has broken the average away from the resistance level. The sell signal is similar. Note that the strategy requires the position limit to be set in order to avoid opening multiple positions.SMARS Trading Strategy NAME: SMARS TEST TYPE: stock DATE RANGE: all POSITION LIMIT: 1FORMULAS--------------------- [1] Date [2] Resistance [1]: C>CA&1 [2]: ([1]=[1]Y1) * [1] * (TY1%H) + ([1]<>[1]Y1) * [1] * H {r} [3]: ([2]Y1 * ([2]=0))U31 [4]: [3] [3] Support [1]: C<=CA&1 [2]: ([1]=[1]Y1) * [1] * (TY1#L) + ([1]<>[1]Y1) * [1] * L {r} [3]: ([2]Y1 * ([2]=0))U31 [4]: [3] [4] Close C [5] SMA(10) CA&1 [6] Cross (C>[5])U2-TY1RULES--------------------- r1: Buy buy long 1 on Close at signal: Buy ([4] > [2]) ^ ( ( [6]=1) & ( [2]/[5]>1.08)) r2: Sell sell long 1 on Close at signal: Sell ([4] < [3]) ^ ( ( [6]=-1) & ( [5]/[3]>1.08))This TechniFilter Plus strategy and the reports, strategies and formulas of earlier Traders' Tips can be downloaded from RTR's Web site.GO BACK--Clay Burch, Rtr Software
919 510-0608, E-mail: rtrsoft@aol.com
Internet: https://www.rtrsoftware.com