Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 04-01-2010, 02:36 AM   #1

Join Date: Oct 2009
Location: london
Posts: 52
Ignore this user

Thanks: 2
Thanked 8 Times in 4 Posts

Floating Point Exception Error

I've got a few tradestation indicators that i've been trying to get working in MC. The indicators compile without issue, however when I try and load them into a chart I get:

Message: Error in study "PSS_S_PR": :{EXCEPTION} Floating Point Exception Error.

Any ideas?


Input:
LeftStrength(10),
RightStrength(2),
CheckPivotValue(true);

Vars:
nColor(0),
nDir(0),
nShift(0),
nPrc(0),
nBar(0),
iIdx(0),
txtID(Symbol + "_PRS"),
ret1(0), ret2(0);
Array:
float arrVal1[100](0);

DefineDLLFunc: "PSS_PR.DLL", int , "PSS_ZZ_AddBar",INT,LPSTR ,LONG,LONG,INT,int,LPLONG ,LPLONG,LPLONG,LPLONG,INT ;
DefineDLLFunc: "PSS_PR.DLL", int , "PSS_ZZ_CalcPiv", INT,LPSTR,LONG,INT,INT,LP FLOAT;

nBar = BarNumber;
if CheckPivotValue = false then
nBar = -BarNumber;
ret1 = PSS_ZZ_AddBar(CustomerID, txtID,Date,Time,nBar,Pric eScale,&Open,&High,&Low,& Close,Volume);
ret2 = PSS_ZZ_CalcPiv(CustomerID ,txtID,BarNumber,LeftStre ngth,RightStrength,&arrVa l1[0]);

if ret2 <> 0 then begin
//====== DRAW NEW PIVOT ========================= ============
nShift = arrVal1[0];
nDir = ret2;
nPrc = arrVal1[1];
if nDir > 0 AND nShift < MaxBarsBack then // avoid chart/DLL reload when AutoDetect reloads because of shift
Plot3[nShift](nPrc,"PivotHigh");
if nDir < 0 AND nShift < MaxBarsBack then
Plot4[nShift](nPrc,"PivotLow");

//====== CHECK IF WE CONSOLIDATED OLD PIVOTS AWAY ===========
if AbsValue(nDir) > 1 then begin
nShift = arrVal1[4];
nDir = ret2;
nPrc = arrVal1[5];
if nDir > 0 AND nPrc > 0 AND nShift < MaxBarsBack then
Plot1[nShift](nPrc,"PivotHighOld");
if nDir < 0 AND nPrc > 0 AND nShift < MaxBarsBack then
Plot2[nShift](nPrc,"PivotLowOld");
end;
end;
lonew0lf is offline  
Reply With Quote
Old 04-01-2010, 03:20 AM   #2

MidKnight's Avatar

Join Date: Oct 2006
Location: Pacman-iverse
Posts: 595
Ignore this user

Thanks: 377
Thanked 326 Times in 186 Posts

Re: Floating Point Exception Error

Hi there,

Just a hunch, but at first I would think the exception is coming from the dll and not from the code unless you are possibly not passing in a float as the required float param. That would be my first place to look, but I'm no EL expert....

With kind regards,
MK
MidKnight is offline  
Reply With Quote
Old 04-01-2010, 03:21 AM   #3

MidKnight's Avatar

Join Date: Oct 2006
Location: Pacman-iverse
Posts: 595
Ignore this user

Thanks: 377
Thanked 326 Times in 186 Posts

Re: Floating Point Exception Error

Also, possible typo's in your dll function calls??? I see the odd space where there should be none.
MidKnight is offline  
Reply With Quote
Old 04-01-2010, 07:44 AM   #4

Join Date: Oct 2009
Location: london
Posts: 52
Ignore this user

Thanks: 2
Thanked 8 Times in 4 Posts

Re: Floating Point Exception Error

Thanks, I'll take a look once more and see if that does it.
lonew0lf is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
TS8 Error hogarstrasni General Discussion 2 10-07-2009 06:22 PM
Error in MC emptyvault Coding Forum 11 08-30-2009 12:55 PM
Error Code Help Please emptyvault Coding Forum 10 07-19-2009 12:21 PM
Error when Retrieving PMs brownsfan019 Support Center 4 04-21-2009 11:16 PM
Url.dll Error - Help! brownsfan019 Tools of the Trade 5 09-16-2008 05:50 PM

All times are GMT -4. The time now is 02:34 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.