WAVE INDICATOR

WAVE INDICATOR

Type : Indicator, Name : Swing Wave Indicator

Vars:
VLineUp(0),
VLineDn(0),
Highest(0),
Lowest(0),
JustChanged(FALSE),
VLine(0);

Array:
Highs[22](0),
Lows[22](0),
Range[22](0),
UpWave[1](FALSE),
DnWave[1](FALSE);

{MaxBarsBack = 21}

JustChanged = FALSE;

if CurrentBar <= 21 then begin
Highs[CurrentBar] = Close;
Lows[CurrentBar] = Close;
Range[CurrentBar] = (High — Low) /2;
end;

if CurrentBar = 22 then begin
if Highs[21] >= Highs[20] then begin
UpWave[1] = TRUE;
Highest = Highs[21];
VLineUp = Highest — (3 * Average((High — Low),21));
Plot1(VLineUp,»VLineUp»);
end;

if Highs[21] < Highs[20] then begin
DnWave[1] = TRUE;
Lowest = Lows[21];
VLineDn = Lowest + (3 * Average((High — Low),21));
Plot2(VLineDn,»VLineDn»);
end;
end;

if CurrentBar > 22 then begin

if DnWave[1] and Close > VLineDn then begin {WAVE CHANGE}
DnWave[1] = FALSE;
UpWave[1] = TRUE;
JustChanged = TRUE;
Highest = Close;
Lowest = 0;
end;

if UpWave[1] and Close < VLineUp and JustChanged = FALSE then begin
{WAVE CHANGE}
UpWave[1] = FALSE;
DnWave[1] = TRUE;
JustChanged = TRUE;
Lowest = Close;
Highest = 0;
end;

if JustChanged = FALSE then begin
if Close > Highest then Highest = Close
else if Close < Lowest then Lowest = Close;
end;

{CALCULATIONS AND PLOT STATMENTS}
VLineUp = Highest — (3 * Average((High — Low),21));
VLineDn = Lowest + (3 * Average((High — Low),21));

if UpWave[1] then Plot1(VLineUp,»VLineUp»)
else if DnWave[1] then Plot2(VLineDn,»VLineDn»);

end;

Подписаться
Уведомить о
0 комментариев
Межтекстовые Отзывы
Посмотреть все комментарии