Finding Errors and Portfolio Start Date - futures io
futures io futures trading



Finding Errors and Portfolio Start Date


Discussion in EasyLanguage Programming

Updated by sunbeam
      Top Posters
    1. looks_one Nicolas11 with 2 posts (2 thanks)
    2. looks_two sunbeam with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 1,784 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 6 replies
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Finding Errors and Portfolio Start Date

(login for full post details)
  #1 (permalink)
Sydney Australia
 
 
Posts: 3 since Jan 2012
Thanks: 0 given, 1 received

Hi first post here and am using MultiCharts ver5.5.

When I run a Strategy on a Portfolio of 22 stocks I get the following error message after it has or seems to have finished the backtest:

{Exception}
Floating-point division by zero.

The signal compiles fine and runs OK - how do I find out where the problem is and how do I fix it.

Also how do I set a date range and/or a start date for the backtest on the Portfolio

Thanks

Reply With Quote

Can you help answer these questions
from other members on futures io?
Times and Sales more data to be displayed
TradeStation
is there an easy way to obtain by code the price variation percentual
MultiCharts
Stacked Imbalances.
Sierra Chart
IB Bracker Order
Platforms and Indicators
T​​​​​​radestation datafeed (real time and historical) to NT8
NinjaTrader
 
 
(login for full post details)
  #3 (permalink)
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
 
Nicolas11's Avatar
 
Posts: 1,071 since Aug 2011
Thanks: 2,232 given, 1,746 received


Hi,


sunbeam View Post
The signal compiles fine and runs OK - how do I find out where the problem is and how do I fix it.

Actually, the signal does not run OK since you have an execution error "Floating-point division by zero."
I think that the code runs OK on the specific instrument that you have manually tested, but the error comes from the implementation of the code on another instrument of the portfolio that you have not tested manually.
There should be somewhere in your code a division a/b with b = 0.
I suggest that, before each division, you add something like
 
Code
if b = 0 then MessageLog(GetSymbolName, " ", Date:7:0, " ", Time_s:6:0, "Division by zero at such step of the code")
in order to identify where the problem comes from.

Personally, before each division with a risk of null denominator, I add a test like:
 
Code
if b <> 0 then c = a/b;
Nicolas

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
(login for full post details)
  #4 (permalink)
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
 
Nicolas11's Avatar
 
Posts: 1,071 since Aug 2011
Thanks: 2,232 given, 1,746 received


sunbeam View Post
Also how do I set a date range and/or a start date for the backtest on the Portfolio

Isn't it proposed in the backtest window?



Nicolas

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
(login for full post details)
  #5 (permalink)
The Netherlands
 
Experience: None
Platform: MultiCharts, TradingView
Trading: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 685 received


Nicolas11 View Post
Isn't it proposed in the backtest window?

He's still using MultiCharts 5.5, so who knows which options are or aren't available there.

Perhaps updating wouldn't be a bad idea Sunbeam since a lot of bugs got fixed, and possibly also some bugs related to your problem.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,050 since Jun 2009
Thanks: 31,658 given, 94,916 received

I agree, you need to be on MC 7. Then you can troubleshoot from there.

I've had floating point div by zero errors before, I generally end up using a Math.Min equivalent (I can't recall the EL code right now), to make sure I am not dividing by zero.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #7 (permalink)
Sydney Australia
 
 
Posts: 3 since Jan 2012
Thanks: 0 given, 1 received


Nicolas11 View Post
Actually, the signal does not run OK since you have an execution error "Floating-point division by zero."
I think that the code runs OK on the specific instrument that you have manually tested, but the error comes from the implementation of the code on another instrument of the portfolio that you have not tested manually.
There should be somewhere in your code a division a/b with b = 0.
I suggest that, before each division, you add something like
 
Code
if b = 0 then MessageLog(GetSymbolName, " ", Date:7:0, " ", Time_s:6:0, "Division by zero at such step of the code")
in order to identify where the problem comes from.

Personally, before each division with a risk of null denominator, I add a test like:
 
Code
if b <> 0 then c = a/b;
Nicolas

I have tested the code on each instrument and they do work OK and as expected on the individual markets.

I always put in something like the following for the condition whereby I may have a zero divisor:

Value1 = IFF(H-L<>0, (C-L)/(H-L), 1);

It seems to me that it is a calculation in the Portfolio backtest not the individual instrument

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Finding Errors and Portfolio Start Date


January 27, 2012


Upcoming Webinars and Events
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts