Hello,

I am trying out MultiCharts64 v8.5. I imported my .eld file and I get the dreaded "Floating-point division by zero" error which does not occur with TS 9.1 ~ does anyone have any insight why this would be?

Rick

# ELD Floating Point Error (TS vs MC)

- Henry MultiСharts
**Posts:**9121**Joined:**25 Aug 2011**Has thanked:**1258 times**Been thanked:**2927 times

### Re: ELD Floating Point Error (TS vs MC)

Hello Rick,

Please refer to the following article to resolve that issue: Floating-Point Division by Zero Error Message

Please refer to the following article to resolve that issue: Floating-Point Division by Zero Error Message

### Re: ELD Floating Point Error (TS vs MC)

Henry,

I have already reviewed that link but really have no idea how to implement it in my code... like TS, there are really no good examples of how to implement the code for the neophyte like myself.

Can you give an example of how and where to place in indicator code?

Also, there is only one division equation used I could find in the indicator (I have not looked into the functions yet).

Why would TS have no issues with the code but MC does?

Thank you.

Rick

I have already reviewed that link but really have no idea how to implement it in my code... like TS, there are really no good examples of how to implement the code for the neophyte like myself.

Can you give an example of how and where to place in indicator code?

Also, there is only one division equation used I could find in the indicator (I have not looked into the functions yet).

Why would TS have no issues with the code but MC does?

Thank you.

Rick

### Re: ELD Floating Point Error (TS vs MC)

Rick,Henry,

I have already reviewed that link but really have no idea how to implement it in my code... like TS, there are really no good examples of how to implement the code for the neophyte like myself.

Can you give an example of how and where to place in indicator code?

Also, there is only one division equation used I could find in the indicator (I have not looked into the functions yet).

Why would TS have no issues with the code but MC does?

Thank you.

Rick

MC is slightly more sensible when it comes to division by zero issues than TS is, but

it's pretty simple to overcome. To make sure that you don't run into a floating point error with a study, check every division for cases where the denominator could be zero.

For example:

Code: Select all

`Value1 = Value2/Value3;`

To avoid this, you do the following check:

Code: Select all

```
if Value3 <> 0 then //meaning Value 3 is not 0
```

Value1 = Value2/Value3

else

Value1 = 0; //or whatever makes sense

Code: Select all

`Value1 = Value2/(Value3-Value4);`

Code: Select all

```
if (Value3-Value4) <> 0 then //meaning (Value 3-Value4) is not 0
```

Value1 = Value2/(Value3-Value4)

else

Value1 = 0; //or whatever makes sense

Code: Select all

```
if denominator <> 0 then
```

do the regular calculation

else

assign a value like 0 to your variable

Regards,

ABC

### Re: ELD Floating Point Error (TS vs MC)

ABC,

The line in the INDICATOR code that has the division is as follows:

and the FUNCTION hy_average is as follows:
Do you think it is the INDICATOR code or FUNCTION code that is giving the floating point error?

Thank you for your time ~ it is sincerely appreciated!

Rick

The line in the INDICATOR code that has the division is as follows:

Code: Select all

`Variables: DOTS (0)`

DOTS = hy_average ((CLOSE+HIGH+LOW) /3, 5) ;

Code: Select all

```
Inputs: Price(NUMERICSERIES), Length(NUMERIC);
```

hy_Average = hy_Summation (Price, Length)/Length ;

Thank you for your time ~ it is sincerely appreciated!

Rick

### Re: ELD Floating Point Error (TS vs MC)

Rick,

did you try it with checking for each of the expressions alone and see what happens?

Theoretically it could be both. But as the denominator in the indicator is fixed, I would guess the problem comes from the function (and if it's not within the hy_Summation function).

Although your length input is different than zero, too, I would guess that this is creating the problem. It would be enough if MC doesn't read the Length input as 5 on the very first time the function gets executed.

As I mentioned MC is very sensitive to this error compared to TS.

Regards,

ABC

did you try it with checking for each of the expressions alone and see what happens?

Theoretically it could be both. But as the denominator in the indicator is fixed, I would guess the problem comes from the function (and if it's not within the hy_Summation function).

Although your length input is different than zero, too, I would guess that this is creating the problem. It would be enough if MC doesn't read the Length input as 5 on the very first time the function gets executed.

As I mentioned MC is very sensitive to this error compared to TS.

Regards,

ABC

### Re: ELD Floating Point Error (TS vs MC)

Thanks ABC,

Yes, I noticed there was a function within a function (hy_Summation) that contain more division equations... oh boy! Nothing is easy!

Lets see what I can do...

Thanks again!

Rick

Yes, I noticed there was a function within a function (hy_Summation) that contain more division equations... oh boy! Nothing is easy!

Lets see what I can do...

Thanks again!

Rick

### Re: ELD Floating Point Error (TS vs MC)

SP... tried that to no avail...

Why can't MultiCharts tell me were the floating-point division by zero error is ?

It just states {EXCEPTION}

Rick

Why can't MultiCharts tell me were the floating-point division by zero error is ?

It just states {EXCEPTION}

Rick

- TJ
**Posts:**7210**Joined:**29 Aug 2006**Location:**Global Citizen**Has thanked:**991 times**Been thanked:**2052 times

### Re: ELD Floating Point Error (TS vs MC)

>Why would TS have no issues with the code but MC does?Henry,

I have already reviewed that link but really have no idea how to implement it in my code... like TS, there are really no good examples of how to implement the code for the neophyte like myself.

Can you give an example of how and where to place in indicator code?

Also, there is only one division equation used I could find in the indicator (I have not looked into the functions yet).

Why would TS have no issues with the code but MC does?

Thank you.

Rick

Most likely because the data is different.

you might have a bad tick somewhere that causes the calculation to hang.