TS Stochastic S&C System

Da traderpedia.
Versione del 22 mar 2012 alle 08:54 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 "Stochastic S&C System"

Formula per Tradestation™:

INIZIO FORMULA

Type: Function, Name: StochCustom
Inputs:
KPeriods(NumericSimple),
KSlow(NumericSimple);
Variables:
LoLo(0),
HiHi(0),
HLDIff(0);
LoLo = Lowest(Low, KPeriods);
HiHi = Highest(High, KPeriods);
HLDIff = HiHi - LoLo;

If HLDIff > 0 Then Begin
If KSlow <= 1 Then
StochCustom = (Close - LoLo) / HLDIff * 100
Else
StochCustom = Average(Close-LoLo,KSlow) / Average(HLDIff, KSlow)*100;
End;


Type: System, Name: Stochastic S&C
Input: KPeriods(7), DPeriods(12), KSlow(3), ExitBars(5);
Variables: KVal(0), DVal(0);
KVal = StochCustom(KPeriods, KSlow);
DVal = Average(KVal, DPeriods);
Condition1 = DVal > DVal[1] AND DVal[1] > DVal[2];
Condition2 = DVal < DVal[1] AND DVal[1] < DVal[2];

If Condition1 AND SwingLow(1, KVal, 1, 2) <> -1 Then
Buy This Bar on Close;
If Condition2 AND SwingHigh(1, KVal, 1, 2) <> -1 Then
Sell This Bar on Close;

If MarketPosition = 1 AND BarsSinceEntry = ExitBars Then
ExitLong This Bar on Close;
If MarketPosition = -1 AND BarsSinceEntry = ExitBars Then
ExitShort This Bar on Close;

FINE FORMULA

Vedi anche: