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

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


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

PureBytes Links

Trading Reference Links

On Tue, 22 Dec 2009, Jimmy Snowden wrote:

I take it back -- the problem returned, in spite of resolving the conflict between my variable 'i' and the reserved word for open interest.

Oh well. I guess I'll have to work around it:
* Print to debug window
* Acknowledge floating point error dialog box
* Go to analysis properties and turn ON the thing that TS2000i turned OFF due to the error
* Repeat

It's slow but it gets the job done.

-Alex

From: Jimmy Snowden <jhsnowden@xxxxxxxxxxxxx>
To: alex@xxxxxxxxxxxxxx
Subject: Re[3]: TS2Ki: Floating point invalid numbers in calculation

Great Alex.  We learn something everyday.  Wow! I really didn't think
that was the problem except in MC.

Jimmy


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