Hello,
I have an indicator that has code in easy language that I would like to use on my esignal charts. It will draw trend lines on the chart - I will paste it below; can this be tailored for esignal? MY charts are all black background, so perhaps green for upward slope line and red for down? (original eh?)
Here it is:
Inputs: maxlookback(100);
var: counter(0),
counter2(0),
HHBack(0),
HHback2(0),
HHback3(0),
LLBack(0),
LLback2(0),
LLback3(0),
bottform(0),
topform(0),
dir(0),
sgMRObott(0),
sgMROtop(0),
HHTopTime(0),
HHTopDate(0),
HHTopVal(0),
LLBottomDate(0),
LLBottomTime(0),
LLBottomVal(0),
maxlength(0),
tlAexists(0),
tlBexists(0),
hh(0),
hl(0);
if barnumber = 1 then
dir = 1;
maxlength = MRO(dir = 1, maxlookback, 1);
counter = 0;
while counter < maxlength
begin
if high[counter +1] > H and H[counter] <= H then
begin
HHback = counter+1;
counter = maxlength + 1;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO( dir = 1, maxlookback, 3);
counter = 0;
while counter < maxlength
begin
if lowestbarfirst(L, counter) = highestbarfirst(H,
counter) and lowestbarfirst(L, counter) <> 0 and
lowestbarfirst(L, counter)<>0 then
begin
HHback2 = counter;
counter = counter + maxlength;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO(dir = 1, maxlookback, 3);
counter = 0;
while counter <= maxlength
begin
if C[counter] >= L[Lowestbarfirst(L, maxlength)] and
C[counter] <=H[Lowestbarfirst(L, maxlength)] and
lowestbarfirst(L, counter)<>0 then
begin
HHback3 = counter;
counter = counter + 1;
end else
begin
counter = counter + 1;
end;
end;
HHback = MaxList(HHback, HHback2, HHback3);
If (C[1] <= H[lowestbarfirst(L,HHback+1)] and C >
H[lowestbarfirst(L,HHback+1)]) or
(C[1] <= H[lowestbarfirst(L,MRO(dir = 1, HHback+1,
1))] and C > H[lowestbarfirst(L,MRO(dir = 1, HHback+1,
1))]) then
begin
bottform = 1;
end else
begin
bottform = -1;
end;
if dir[2] = 1 and dir[1] = -1 and C <= H[1] then
begin
bottform = -1;
end;
if dir[2] = -1 and dir[1] = -1 and L[1] < L[2] and C<=
H[1] then
bottform = -1;
maxlength = MRO(dir = -1, maxlookback, 1);
counter = 0;
while counter < maxlength
begin
if Low[counter +1] < L and L[counter] >= L then
begin
LLback = counter+1;
counter = maxlength + 1;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO(dir = -1, maxlookback, 3);
counter = 0;
while counter < maxlength
begin
if lowestbarfirst(L, counter) = highestbarfirst(H,
counter) and lowestbarfirst(L, counter) <> 0 and
highestbarfirst(H, counter)<>0 then
begin
LLback2 = counter ;
counter = maxlength + 1;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO(dir = -1, maxlookback, 3);
counter = 0;
while counter <= maxlength
begin
if C[counter] <= H[Highestbarfirst(H, maxlength)] and
C[counter] >=L[Highestbarfirst(H, maxlength)] and
highestbarfirst(H, counter)<>0 then
begin
LLback3 = counter;
counter = counter + 1;
end else
begin
counter = counter + 1;
end;
end;
LLback = MaxList(LLback, LLback2, LLback3);
If (C[1] >= L[highestbarfirst(H,LLback+1)] and C <
L[highestbarfirst(H,LLback+1)]) or
(C[1] >= L[highestbarfirst(H,MRO(dir = -1, LLback+1,
1))] and C < L[highestbarfirst(H,MRO(dir = -1,
LLback+1, 1))]) then
begin
topform = 1;
end else
begin
topform = -1;
end;
if dir[2] = -1 and dir[1] = 1 and C >= L[1] then
begin
topform = -1;
end;
if dir[2] = 1 and dir[1] = 1 and H[1] > H[2] and C>=
L[1] then
topform = -1;
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
sgMROtop = MRO(topform = 1, 100, 1) ;
sgMRObott = MRO(bottform = 1, 100, 1);
If sgMROtop > sgMRObott then
dir = 1
else if sgMROtop < sgMRObott then
dir =-1;
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
If dir[1] = -1 and dir = 1 then
begin
HHTopDate = Date;
HHTopTime = time;
HHTopVal = H;
end;
If dir[1] = 1 and dir = 1 then
begin
if H <= HHTopVal[1] then
begin
HHTopVal = HHTopVal[1];
HHTopDate = HHTopDate[1];
HHTopTime = HHTopTime[1];
end else
begin
if H > HHTopVal[1] then
begin
HHTopVal = H;
HHTopDate = date;
HHTopTime = time;
end;
end;
end;
If dir[1] = 1 and dir = -1 then
begin
LLBottomDate = Date;
LLBottomTime = time;
LLBottomVal = L;
end;
If dir[1] = -1 and dir = -1 then
begin
if L >= LLBottomVal[1] then
begin
LLBottomVal = LLBottomVal[1];
LLBottomDate = LLBottomDate[1];
LLBottomTime = LLBottomTime[1];
end else
begin
if L < LLBottomVal[1] then
begin
LLBottomVal = L;
LLBottomDate = date;
LLBottomTime = time;
end;
end;
end;
if dir[1] = -1 and dir = 1 then
begin
value1 = TL_New(LLBottomDate, LLBottomTime,
LLBottomVal, Date, Time, H);
tl_setcolor(value1, blue);
tl_setsize(value1, 1);
tlAexists = 1;
end;
if dir[1] = 1 and dir = 1 and highestbarfirst(H,
mro(dir = -1, maxlookback,1))=0 and tlAexists = 1 then
begin
TL_SetEnd(Value1, Date, Time, H);
end;
if dir[1] = 1 and dir = -1 then
begin
value2 = TL_New(HHTopDate, HHTopTime, HHTopVal, Date,
Time, L);
tl_setcolor(value2, magenta);
tl_setsize(value2, 1);
tlBexists = 1;
end;
if dir[1] = -1 and dir = -1 and lowestbarfirst(L,
mro(dir = 1, maxlookback,1))=0 and tlBexists = 1 then
begin
TL_SetEnd(Value2, Date, Time, L);
end;
=====
I have an indicator that has code in easy language that I would like to use on my esignal charts. It will draw trend lines on the chart - I will paste it below; can this be tailored for esignal? MY charts are all black background, so perhaps green for upward slope line and red for down? (original eh?)
Here it is:
Inputs: maxlookback(100);
var: counter(0),
counter2(0),
HHBack(0),
HHback2(0),
HHback3(0),
LLBack(0),
LLback2(0),
LLback3(0),
bottform(0),
topform(0),
dir(0),
sgMRObott(0),
sgMROtop(0),
HHTopTime(0),
HHTopDate(0),
HHTopVal(0),
LLBottomDate(0),
LLBottomTime(0),
LLBottomVal(0),
maxlength(0),
tlAexists(0),
tlBexists(0),
hh(0),
hl(0);
if barnumber = 1 then
dir = 1;
maxlength = MRO(dir = 1, maxlookback, 1);
counter = 0;
while counter < maxlength
begin
if high[counter +1] > H and H[counter] <= H then
begin
HHback = counter+1;
counter = maxlength + 1;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO( dir = 1, maxlookback, 3);
counter = 0;
while counter < maxlength
begin
if lowestbarfirst(L, counter) = highestbarfirst(H,
counter) and lowestbarfirst(L, counter) <> 0 and
lowestbarfirst(L, counter)<>0 then
begin
HHback2 = counter;
counter = counter + maxlength;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO(dir = 1, maxlookback, 3);
counter = 0;
while counter <= maxlength
begin
if C[counter] >= L[Lowestbarfirst(L, maxlength)] and
C[counter] <=H[Lowestbarfirst(L, maxlength)] and
lowestbarfirst(L, counter)<>0 then
begin
HHback3 = counter;
counter = counter + 1;
end else
begin
counter = counter + 1;
end;
end;
HHback = MaxList(HHback, HHback2, HHback3);
If (C[1] <= H[lowestbarfirst(L,HHback+1)] and C >
H[lowestbarfirst(L,HHback+1)]) or
(C[1] <= H[lowestbarfirst(L,MRO(dir = 1, HHback+1,
1))] and C > H[lowestbarfirst(L,MRO(dir = 1, HHback+1,
1))]) then
begin
bottform = 1;
end else
begin
bottform = -1;
end;
if dir[2] = 1 and dir[1] = -1 and C <= H[1] then
begin
bottform = -1;
end;
if dir[2] = -1 and dir[1] = -1 and L[1] < L[2] and C<=
H[1] then
bottform = -1;
maxlength = MRO(dir = -1, maxlookback, 1);
counter = 0;
while counter < maxlength
begin
if Low[counter +1] < L and L[counter] >= L then
begin
LLback = counter+1;
counter = maxlength + 1;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO(dir = -1, maxlookback, 3);
counter = 0;
while counter < maxlength
begin
if lowestbarfirst(L, counter) = highestbarfirst(H,
counter) and lowestbarfirst(L, counter) <> 0 and
highestbarfirst(H, counter)<>0 then
begin
LLback2 = counter ;
counter = maxlength + 1;
end else
begin
counter = counter + 1;
end;
end;
maxlength = MRO(dir = -1, maxlookback, 3);
counter = 0;
while counter <= maxlength
begin
if C[counter] <= H[Highestbarfirst(H, maxlength)] and
C[counter] >=L[Highestbarfirst(H, maxlength)] and
highestbarfirst(H, counter)<>0 then
begin
LLback3 = counter;
counter = counter + 1;
end else
begin
counter = counter + 1;
end;
end;
LLback = MaxList(LLback, LLback2, LLback3);
If (C[1] >= L[highestbarfirst(H,LLback+1)] and C <
L[highestbarfirst(H,LLback+1)]) or
(C[1] >= L[highestbarfirst(H,MRO(dir = -1, LLback+1,
1))] and C < L[highestbarfirst(H,MRO(dir = -1,
LLback+1, 1))]) then
begin
topform = 1;
end else
begin
topform = -1;
end;
if dir[2] = -1 and dir[1] = 1 and C >= L[1] then
begin
topform = -1;
end;
if dir[2] = 1 and dir[1] = 1 and H[1] > H[2] and C>=
L[1] then
topform = -1;
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
sgMROtop = MRO(topform = 1, 100, 1) ;
sgMRObott = MRO(bottform = 1, 100, 1);
If sgMROtop > sgMRObott then
dir = 1
else if sgMROtop < sgMRObott then
dir =-1;
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
If dir[1] = -1 and dir = 1 then
begin
HHTopDate = Date;
HHTopTime = time;
HHTopVal = H;
end;
If dir[1] = 1 and dir = 1 then
begin
if H <= HHTopVal[1] then
begin
HHTopVal = HHTopVal[1];
HHTopDate = HHTopDate[1];
HHTopTime = HHTopTime[1];
end else
begin
if H > HHTopVal[1] then
begin
HHTopVal = H;
HHTopDate = date;
HHTopTime = time;
end;
end;
end;
If dir[1] = 1 and dir = -1 then
begin
LLBottomDate = Date;
LLBottomTime = time;
LLBottomVal = L;
end;
If dir[1] = -1 and dir = -1 then
begin
if L >= LLBottomVal[1] then
begin
LLBottomVal = LLBottomVal[1];
LLBottomDate = LLBottomDate[1];
LLBottomTime = LLBottomTime[1];
end else
begin
if L < LLBottomVal[1] then
begin
LLBottomVal = L;
LLBottomDate = date;
LLBottomTime = time;
end;
end;
end;
if dir[1] = -1 and dir = 1 then
begin
value1 = TL_New(LLBottomDate, LLBottomTime,
LLBottomVal, Date, Time, H);
tl_setcolor(value1, blue);
tl_setsize(value1, 1);
tlAexists = 1;
end;
if dir[1] = 1 and dir = 1 and highestbarfirst(H,
mro(dir = -1, maxlookback,1))=0 and tlAexists = 1 then
begin
TL_SetEnd(Value1, Date, Time, H);
end;
if dir[1] = 1 and dir = -1 then
begin
value2 = TL_New(HHTopDate, HHTopTime, HHTopVal, Date,
Time, L);
tl_setcolor(value2, magenta);
tl_setsize(value2, 1);
tlBexists = 1;
end;
if dir[1] = -1 and dir = -1 and lowestbarfirst(L,
mro(dir = 1, maxlookback,1))=0 and tlBexists = 1 then
begin
TL_SetEnd(Value2, Date, Time, L);
end;
=====
Comment