PureBytes Links
Trading Reference Links
|
Hello Everyone,
Has anyone got an idea how to make this indicator plot true/false in rader
Thanks in advance,
Danton
input: nth(2); { How many highs/lows to search for }
var: x(0), n(0), { general index }
break(0), { loop breaker }
px(0), { index of leftmost pivot bar }
ppx(0), { index of pivot bar with extreme High/Low }
lastextreme(0); { running extreme High/Low }
{* Low pivot:*}
If L > L[2] and L[1] > L[2] { Find pivot pattern }
and ((L[3] > L[2] and L[4] > L[2]) or (L[2] = L[3] and L[3] < L[4]))
then begin
if L[2] = L[3] then begin { Account for equal-low pivot bars }
px = 3;
if H[2] > H[3] then
ppx = 2
else
ppx = 3;
end else begin
px = 2;
ppx = 2;
end;
lastextreme = H[ppx]; { Remember pivot High }
x = px; { Search for Nth Highest High }
break = 0;
n = 1;
while break = 0 and x < MaxBarsBack begin
x = x + 1;
if H[x] > lastextreme then begin
lastextreme = H[x];
n = n + 1;
if n > nth then
break = 1;
end;
end;
ppx = Text_New(Date[ppx], Time[ppx], low[ppx], "L");
Text_SetStyle(ppx, 2, 1);
end;
{* High pivot:*}
if h < H[2] and h[1] < H[2] { Find pivot pattern }
and H[2] > H[3] and H[2] > H[4] or (H[2] = H[3] and H[3] > H[4])
then begin
if H[2] = H[3] then begin { Account for equal-low pivot bars }
px = 3;
if L[2] < L[3] then
ppx = 2
else
ppx = 3;
end else begin
px = 2;
ppx = 2;
end;
lastextreme = L[ppx]; { Remember pivot Low }
x = px; { Search for Nth Lowest Low }
break = 0;
n = 1;
while break = 0 and x < MaxBarsBack begin
x = x + 1;
if L[x] < lastextreme then begin
lastextreme = L[x];
n = n + 1;
if n > Nth then
break = 1;
end;
end;
ppx = Text_New(Date[ppx], Time[ppx], high[ppx], "H");
Text_SetStyle(ppx, 2, 1);
end;
|