Originally Posted By: Djin
Хотелось бы по возможности иметь под руками индикатор WATR


+1. Хорошая штука, судя по описанию (pdf!)



Quote:
Процентный Трендовый индикатор прорыва динамического ценового канала
в формате Omega TradeStation. {Percentage Trend Indicator with correction
filter and dynamic period of trend calculation. Copyright (c) konkop 2001}
Inputs:
K(15), {%Coeff. of correction}
Max_per(50); {Max. Dynamic Period for Trend Calculation}
Vars: Trend(C), Period(0) ; {Trend Calculation}
Condition1= C > Trend[1]; {UpTrend}
Condition2= C <= Trend[1]; { DownTrend}
{SetUp Period When New Trend Begin}
If C Cross over Trend[1] or C Cross Below Trend[1] Then Period = 0;
If Period < Max_per Then Begin {Counting UpTrends with dynamic period}
If Condition1 Then Begin
Period = Period +1;
Trend = Highest(C,Period)[1]∗(1 — (K/100));
End ; {Counting DownTrends with dynamic period}
If Condition2 Then Begin
Period = Period + 1;
Trend = Lowest(C,Period)[1]∗(1 + (K/100));
End;
End Else Begin {Counting UpTrends with constant period}
If Condition1 Then Trend = Highest(C,Max_per)[1]∗(1 — (K/100));
{Counting DownTrends with constant period}
If Condition2 Then Trend = Lowest(C,Max_per)[1]∗(1 + (K/100));
End; {Plotting Indicator}
Plot1(Trend, «Trend»);
Трендовый индикатор прорыва динамического ценового канала на основе WATR
в формате Omega TradeStation.
{Volatility Trend Indicator based on Smoothed True Range
and dynamic period of trend calculation. Copyright (c) konkop 2001}
Inputs:
Len(21), {WATR Lenght}
M(3), {WATR Multiplier}
Max_per(50); {Max. Dynamic Period for Trend Calculation}
Vars: TrueHi(H), TrueLo(L), TrueRng(0), WATR(0), Trend(C), Period(0) ;
{Calculate Smoothed TR}
If Close[1] > High Then TrueHi = Close[1] Else TrueHi = High;
{Calculate TrueHigh}
If Close[1] < Low Then TrueLo = Close[1] Else TrueLo = Low;
{Calculate TrueLow}
TrueRng = TrueHi — TrueLo; {Calculate TrueRange}
WATR = WAverage(TrueRng,Len); {Calculate WATR}
{Trend Calculation}
Condition1= C > Trend[1]; {UpTrend}
Condition2= C <= Trend[1]; { DownTrend}
{SetUp Period When New Trend Begin}
If C Cross over Trend[1] or C Cross Below Trend[1] Then Period = 0;
If Period < Max_per Then Begin {Counting UpTrends with dynamic period}
If Condition1 Then Begin
Period = Period +1;
Trend = Highest(C,Period) — M∗WATR;
End ; {Counting DownTrends with dynamic period}
If Condition2 Then Begin
Period = Period + 1;
Trend = Lowest(C,Period) + M∗WATR;
End;
End Else Begin {Counting UpTrends with constant period}
If Condition1 Then Trend = Highest(C,Max_Per)[1] — M∗WATR;
{Counting DownTrends with constant period}
If Condition2 Then Trend = Lowest(C,Max_per)[1] + M∗WATR;
End; {Plotting Indicator}
Plot1(Trend,»Trend»);