Here is my code.
Code: Select all
{
Plot horizontal lines at places on the $TICK chart.
}
Inputs:
doPlus1200(1),
doPlus1000(1),
doPlus800(1),
doPlus600(1),
doPlus0(1),
doMinus600(1),
doMinus800(1),
doMinus1000(1),
doMinus1200(1),
plus1200(1200),
plus1000(1000),
plus800(800),
plus600(600),
plus0(0),
minus600(-600),
minus800(-800),
minus1000(-1000),
minus1200(-1200);
Array:
tickLines[8,2](0);
Variables:
j(0),
k(0),
maxArraySize(100),
firstDate(0),
secondDate(0),
tlid1(-1),
tlid2(-1);
tickLines[0,0] = doPlus1200;
tickLines[1,0] = doPlus1000;
tickLines[2,0] = doPlus800;
tickLines[3,0] = doPlus600;
tickLines[4,0] = doPlus0;
tickLines[5,0] = doMinus600;
tickLines[6,0] = doMinus800;
tickLines[7,0] = doMinus1000;
tickLines[8,0] = doMinus1200;
tickLines[0,1] = plus1200;
tickLines[1,1] = plus1000;
tickLines[2,1] = plus800;
tickLines[3,1] = plus600;
tickLines[4,1] = plus0;
tickLines[5,1] = minus600;
tickLines[6,1] = minus800;
tickLines[7,1] = minus1000;
tickLines[8,1] = minus1200;
tickLines[0,2] = blue;
tickLines[1,2] = blue;
tickLines[2,2] = blue;
tickLines[3,2] = blue;
tickLines[4,2] = white;
tickLines[5,2] = red;
tickLines[6,2] = red;
tickLines[7,2] = red;
tickLines[8,2] = red;
firstDate = 1201001;
secondDate = 1201231;
for j = 0 to 8
begin
if (tickLines[j, 0] = 1) then
TL_New(firstDate, 0000, tickLines[j, 1], secondDate, 2359, tickLines[j, 1]);
k = TL_New(firstDate, 0000, tickLines[j, 1], secondDate, 2359, tickLines[j, 1]);
TL_setColor(k, tickLines[j, 2]);
end;
1. How do I set firstDate to be the first date on this chart? I have tried numerous things, none of them work.
2. How do I get the ID of the lines? The way I'm doing it here is ... interesting, where it's a throwaway. Can I get ahold of those outside of this loop? I suppose I could have j, 3 to hold that value...
Thank you,
Rob