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

Sv: understanding easylanguage code



PureBytes Links

Trading Reference Links

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Den 2006-02-21 18.48.08 skrev Bob Fulks:
CurrentBar = 1 on the first bar of the calculation.

if CurrentBar = 1 then begin
   <initialization code here>
end else
   <code for subsequent bars>
end;

Bob Fulks



At 12:15 PM 2/21/2006, Mikael Göransson wrote:


i made my own XAverage function which would produce some debugging output in a text file.

before i added the debugging code i tested it too se if it returned
the same value as the XAverage function, and it did.

the code:
Inputs: Price(NumericSimple), Length(NumericSimple);
Variables: Factor(0);

If Length + 1 <> 0 Then Begin
{Debugging}
FileAppend("c:\debug_output.txt", ELDateToString(Date)
+ Spaces(2)+","+Spaces(2)
+ NumToStr(CurrentBar,0)
+ Spaces(2)+","+Spaces(2)
+ NumToStr(Price,2)
+ NewLine);

If CurrentBar <= 1 Then Begin
Factor = 2 / (Length + 1);
MXAverage = Price;
End
Else
MXAverage = Factor * Price + (1 - Factor) * MXAverage[1];
End;

Okey, first thing i learned from the output was that CurrentBar = 1 wasen't todays date, so i was doing the calculation the wrong way.
though reversing it didn't produce the same return value as ts.
In the file there where 255 lines, when calling the function with a Length of 35 ?! if someone could explain this it would be great.
Second, i've come to realized this right now, how does EL control
how many recursive calls the function will do?

thanks.
- -- .-.-.-..---..----..---. Mikael Göransson
| | | || |'_| || || |-< http://www.mgor.se
`-'-'-'`-'-/`----'`-'`-' micke@xxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD/gDQVBSPWpaZs/0RAo8kAJ9gYH6bfuPWiOqKsP8iQ47+26rUzACgljCR
JZFr7+t0AD2usOHW+iQrfAU=
=X94r
-----END PGP SIGNATURE-----