TS Moving average with resistance and support system

Da traderpedia.
Versione del 22 mar 2012 alle 08:51 di imported>Stefano Fanton (→‎Vedi anche:)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)
Jump to navigation Jump to search

Trading System "Moving average with resistance and support system"

Combinazione di una semplice media mobile con supporti e resistenze, presentato da Dennis Tilley nel suo articole "Moving averages with resistance and support."

Formula per Tradestation™:

INIZIO FORMULA

Type: System, 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 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;

FINE FORMULA

Vedi anche: