help about Floating-point invalid operation exception  [SOLVED]

Questions about MultiCharts and user contributed studies.
nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

help about Floating-point invalid operation exception

Postby nuno-online » 13 Apr 2014

Hello

When loading my indicator over the chart, i got an error message: Error in study " Name of my study" : {Exception} Opération en virgule flottante non valide)

How do I debug that.

Code: Select all

Variables:
Position(0);

Position = absvalue(Open-((High+Low)/2)) / (High-Low);
If (High-Low) <> 0 then
Plot1(Position, "Position");
Any help appreciated

Nuno

User avatar
ABC
Posts: 626
Joined: 16 Dec 2006
Has thanked: 119 times
Been thanked: 355 times
Contact:

Re: help about Floating-point invalid operation exception  [SOLVED]

Postby ABC » 13 Apr 2014

Nuno,

this error points to a part in the code where it tries to divide by zero. In your code (High-Low) can become zero and trigger this alert.
Changing your code slightly should do the trick.

Code: Select all

Variables:
Position(0);

If (High-Low) <> 0 then
Position = absvalue(Open-((High+Low)/2)) / (High-Low);

Plot1(Position, "Position");
Regards,
ABC

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Re: help about Floating-point invalid operation exception

Postby nuno-online » 13 Apr 2014

Hi ABC

that's great!
thank you very much for your help

Nuno

User avatar
TJ
Posts: 7157
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 988 times
Been thanked: 2042 times

Re: help about Floating-point invalid operation exception

Postby TJ » 14 Apr 2014

ps.

POSITION is an EL reserved word; you should choose other words as a variable name.


Return to “MultiCharts”