Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Sign in to follow this  
lonew0lf

Floating Point Exception Error

Recommended Posts

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,LPFLOAT;

 

nBar = BarNumber;

if CheckPivotValue = false then

nBar = -BarNumber;

ret1 = PSS_ZZ_AddBar(CustomerID,txtID,Date,Time,nBar,PriceScale,&Open,&High,&Low,&Close,Volume);

ret2 = PSS_ZZ_CalcPiv(CustomerID,txtID,BarNumber,LeftStrength,RightStrength,&arrVal1[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;

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.