[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RT] Programming Problems with 3Bar Net Line TS 4.0 ela - Help!



PureBytes Links

Trading Reference Links

Dear RT's:

I would appreciate any assistance in correcting my code with the following 
ELA.  This ela is suppose to PLOT  a dot below each of the 3 bar Lows when a 
NEW higher high is recognized.   The program won't exit from the "while" loop 
and I need to have a "while" statement to count the number of days back to 
accurately plot the 3 bar low from the NEW high.  

{Tradestation 4.0; 3 Bar Net Line - Program for Plotting 3 Bar Lows ONLY}

{The next line Set the program variables;  Note: MaxBarsBack is set at 10}
Vars: x(0), y(0), z(1), H1(0), L1(0); 

{The next 6 lines obtains the Highest High and Lowest Low for the past 10 
days storing the prices in H1 and L1, respectively}
If currentbar=2 then begin
H1=highest(h,10)[1];
end;
If currentbar=2 then begin
L1=Lowest(L,10)[1];
end;

{The next two lines define the conditions for the while statement;  the first 
two being for the rising bottoms}
Condition1=L[0+x]>L[z+x];       {Today's Low is greater than Yesterday's Low}
Condition2=L[0+x]<L[z+x];       {Today's Low is less than Yesterday's Low}

{Begin the program routine for calculating the 3 bar low's; first, 
identifying a NEW High and then with a series of Loops calculating the value 
of "z" which is the number of days prior that the last 3 bar low occurred}
If currentbar>3 and H>H1 then begin
    While y=0 and value1<10 begin
        If condition2 and y=0 then begin
            z=z+1;
        end;
        If condition1 and y=0 then begin
            x=x+1;
            z=z+1;
        end;
    value1=value1+1;
    if x>=2 then y=1;
    end;
value1=0;
y=0;
end;

{The next Plot line posts a dot below the Low, back "z" days ago}
If z>=2 then begin
Plot1[z-1](L[z-1],"3BL");
z=1;
x=0;
y=0;
end;

The program is NOT looping right and hanging up the system!!!!

Please e-mail me your suggestions or post on the network.  


Thanks


Bob Schoeffler
RJS1948@xxxxxxx