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

Re: EL question - static variables?



PureBytes Links

Trading Reference Links

What I tried was if barnumber = 10 then value1 = close; in an
indicator I had and it showed as zero using expert commentary to see
what its value was. I just now created an indicator called test
(below) and everything works as expected. Now I'll go back to my other
indicator, add value1, again and see if I can figure out what is going
on.

Regards, Randall

{Test Indicator Code}

if barnumber = 10 then Value1 = close;

value2 = value2 + 1;

plot1(value2, "1");

{-----Commentary to show debug data-----}
Vars:           String1("");   {Output strings}

#BeginCmtryOrAlert
if AtCommentaryBar then begin

                String1 =
                        newline + "  Value1  = " + NumToStr(Value1, 2) +
                        newline + "  Value2  = " + NumToStr(Value2, 2);
        
        Commentary(String1);
end;
#end;



Friday, August 10, 2001, 14:30:16, you wrote:

>> Interesting to note that I tried using Value1 in TS2k as he did
>> and it DOES reset to 0 except on bar 10. I then declared a variable
>> and it did not reset. I never use the built in variables so I did
>> not realize that would happen. 

> !!!

> You're kidding.  That's a *MAJOR* change in definition from TS4, and 
> a very confusing difference between built-in and user-defined 
> variables.  Given how many people DO use the built-in vars, I would 
> think that would break a lot of TS4 code.

> Are you **sure** it's doing that?  Try something like this:

> value1 = value1 + 1;
> plot1(value1, "v");

> ...and see if it increases on every bar.  If not, I would call that a 
> huge bug or massively stupid "feature."

> Gary