Автор:
Разместил:   Дата: 2006-01-15 06:55
Комментарии: (0)   Рейтинг:

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






Inputs: 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 Alert




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.


 
Реклама:

Rambler's Top100

Страница создана за 0.035 секунды