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

Re[2]: TS2Ki: Floating point invalid numbers in calculation


  • Date: Mon, 21 Dec 2009 21:15:22 -0800 (PST)
  • From: alex@xxxxxxxxxxxxxx
  • Subject: Re[2]: TS2Ki: Floating point invalid numbers in calculation

PureBytes Links

Trading Reference Links

That was the problem with my strange floating point error. Thanks Jimmy. I was using a reserved word (i) as a variable. I changed 'i' to 'j' in my signal and all the supporting functions I wrote, and the error disappeared.

I can more or less see the usefulness in making reserved words out of the single characters O, H, L, C for trading software because they are unlikely to be used as loop counters and such.

Even though I haven't used FORTRAN in 20 years, I have ingrained in my mind that the variables i,j,k,m,n are to be used as integers, and generally only for array indexing or loop counting. Even today, when I look at code written in C or Java and see 'i' declared as a float, it seems bizarre.

-Alex

On Sat, 19 Dec 2009, Jimmy Snowden wrote:

Multicharts uses it as the same as their OpenInt.  Open interest.


On Thu, 17 Dec 2009, Gene Pope wrote:

Thanks for all the replies.

The print() statement seems to be the problem. The code works fine without
it. The code works fine the FIRST time it's run with the print()
statement. After that, re-verifying will produce the floating point error.

Bob: I don't know why "if CurrentBar <= 1" would behave any different than
"if CurrentBar = 1". I have always used the <= convention because I can
never remember if the first bar starts at 1 or 0.

Jimmy: What does MultiCharts use the variable 'i' for? Open Interest?
In any case you don't see 'i' in my code because I didn't include the
parts I commented out. I can change it to 'ii' I guess. I recall doing
that in the past, maybe because of the conflict with 'interest'?

Gene: I did actually start clipping out all the remarked code and posted
what was left. After I posted it, I clipped further and found out the
print() statement was generating the error. I still have no idea why.

-Alex

From: Gene Pope <gene@xxxxxxxxxxxxx>
To: omega-list@xxxxxxxxxx
Subject: RE: TS2Ki: Floating point invalid numbers in calculation

Sometimes even "remarked out" code will generate errors as if it was still
active, same deal with if...then loops even when if = false. Sam's advice to
clip out the bare bones code (and then add other code slowly until error
occurs) is a good starting point.

Gene



--
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \     Unicorn Research Corporation -- http://unicorn.us.com
 // __)    HTML FORMATTED MAIL SENT HERE WILL BE REJECTED AS SPAM.