Scan a List
This script scans through several charts using the symbols listed on an open
quote page. An alert is shown if a study condition is found.
var
j,flag: integer;
symbol: string;
begin
keydown(32);
{this clears/reads any pending keyboard status for
the spacebar}
while not keydown(32) do begin
{now we will be in a loop until user presses
Spacebar to abort}
btnScrollDown.click;
{this is the equivalent of using mouse
to click on the scroll down button}
FindWindow(eChart);
{this assumes you have only one
chart window open}
{we scroll quote page list through this one chart}
j:=FindStudy(eAvS);
{find simple average study}
if j>0 then begin {j>0
means simple average was found}
flag:=GetStudy(j, 5, BarEnd);
{for simple average, item 5
is a crossing flag watching 1st ave cross 2nd ave}
{1 means cross above, 2 means cross
below. See documentation for GetStudy}
if flag=1 then begin {if
flag=1 then the averages crossed going up}
symbol:=GetVariable(eSymbol);
writeln(Align(symbol, 8, eLeft), sto);
Alert(True, 'Average Cross
Above'+Align(sto,6,eLeft), clGreen, clWhite, True);
end
else if flag=2 then begin {if
flag = 2 then the averages crossed going down}
symbol:=GetVariable(eSymbol);
writeln(Align(symbol, 8, eLeft), sto);
Alert(True, 'Average Cross
Below'+Align(sto,6,eLeft), clRed, clWhite, True);
end
else
Alert(False, '', clRed, clWhite,
False); {otherwise, remove alert bar}
end;
Pause(2); {pause for 2 seconds,
and then do next symbol on custom quote page}
end;
end;
|