StopLoss error

Questions about MultiCharts and user contributed studies.
NiC72
Posts: 92
Joined: 02 Nov 2009
Location: Sweden
Has thanked: 34 times
Been thanked: 12 times

StopLoss error

Postby NiC72 » 09 Dec 2009

Hi all,

I tried to put Stop Loss on yesterday's high but get the message:
"floating-point division by zero" ..someting. And the signal is turn off.

I tryed to use:
if (condition3 and condition4) then begin
sellshort ( "SmiSE" ) 3 contract next bar at market;
setstopcontract;
Set Stop Loss((HighD(1)/entry price)*entry price
end;

Anybody have any suggestions?
Or am I thinking completely wrong?

Thanks!

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Postby TJ » 09 Dec 2009

please copy and paste (or post screenshot) the error message here

NiC72
Posts: 92
Joined: 02 Nov 2009
Location: Sweden
Has thanked: 34 times
Been thanked: 12 times

Postby NiC72 » 09 Dec 2009

Hi TJ,
Thank for your answer.
Some of the text is in swedish. All the text is someting like:
-----------------------------------------------------
Message: Error in study "NiC Setup_test2" :: {EXCEPTION}
Floating-point Division by zero
-----------------------------------------------------

Thanks
Attachments
error.jpg
error.jpg (50.11 KiB) Viewed 241 times

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Postby TJ » 09 Dec 2009

Hi TJ,
Thank for your answer.
Some of the text is in swedish. All the text is someting like:
-----------------------------------------------------
Message: Error in study "NiC Setup_test2" :: {EXCEPTION}
Floating-point Division by zero
-----------------------------------------------------

Thanks



you have to search your code and find any divisions...

make sure the denominator is not zero.

NiC72
Posts: 92
Joined: 02 Nov 2009
Location: Sweden
Has thanked: 34 times
Been thanked: 12 times

Postby NiC72 » 10 Dec 2009

Strange, "entry price" seems to be zero. It work with close, open, high, low..

I change:
Set Stop Loss((HighD(1)/entry price)*entry price
to
sell next bar Lowest(L,1) stop;

It seems to work.
Thanks TJ!

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Postby TJ » 10 Dec 2009

...
It seems to work.
Thanks TJ!



you are welcome.


also see this post on SetStopLoss:
http://forum.tssupport.com/viewtopic.php?t=6929


Return to “MultiCharts”