Code: Select all
vars: HL(0);
if high(10) = low(10) then
begin
HL=1 ;
Plot1(HL) ;
end;
Code: Select all
vars: HL(0);
if high(10) = low(10) then
begin
HL=1 ;
Plot1(HL) ;
end;
I'm trying to compile this simple code which I intend using to filter out thinly traded stocks but it wont compile and it indicates that the issue is in the vars statement which I believe to be OK. Anyone able to take a look and tell me what you think?Code: Select all
vars: HL(0);
if high(10) = low(10) then
begin
HL=1 ;
Plot1(HL) ;
end;
Code: Select all
vars: HL(0);
if high[10] = low[10] then
HL=1 else HL = 0;
Plot1(HL);
Code: Select all
Inputs: Barsback(10);
vars: HL(0),
x(Barsback);
for x = Barsback downto 0 Begin
if high[x] = Low[x]
then
HL=1;
x=x-1;
end;
Plot1(HL);
Hi,
I'm trying to figure out what's going on with this code. The theory is that if the high equals the low for any given bar in the last ten bars then variable HL is set to 1. It seems that HL is set to 1 regardless of whether the condition is met or not. Any idea where I went wrong?
Code: Select all
Inputs: Barsback(10);
vars: HL(0),
x(Barsback);
for x = Barsback downto 0 Begin
if high[x] = Low[x]
then
HL=1;
x=x-1;
end;
Plot1(HL);
Thanks for the feedback TJ. Strictly speaking, not I haven't told it to do otherwise such as an else statement. To my way of thinking HL is initialized as 0 and will switch to and remain at 1 if any bar in the last 10 bars has a high the same value as the low. If every bar in the last 10 bars has a high different from the low then HL should remain at 0, then HL is initialized to 0 as the first line of code is run for the next instrument. Is my understanding incorrect?
Code: Select all
Inputs: Barsback(10);
vars: HL(0),
x(Barsback);
for x = Barsback downto 0 Begin
if high[x] = Low[x]then
begin
HL=1;
x=x-1;
end
else
HL=0;
x=x-1;
Plot1(HL);
Code: Select all
Inputs: Barsback(10);
vars: HL(0),
x(0);
for x = Barsback downto 0
BEGIN
if high[x] = Low[x]then
begin
HL=1;
// x=x-1;
end
else
begin
HL=0;
//x=x-1;
end;
END;
Plot1(HL);
Code: Select all
Inputs: Barsback(100);
vars: HL(0),
x(0);
for x = Barsback downto 0
BEGIN
if high[x] = Low[x]then
begin
HL=1;
end;
END;
Plot1(HL);
if HL=1 then
begin
HL=0;
end;
Thanks. Minor modification to the code as it was only picking the stock with the H=L condition on the last bar. All good now.
. . .