NexusFi: Find Your Edge


Home Menu

 





Finding Errors and Portfolio Start Date


Discussion in EasyLanguage Programming

Updated
      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 2,471 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 6 posts
    2. attach_file 1 attachments




 
Search this Thread

Finding Errors and Portfolio Start Date

  #1 (permalink)
sunbeam
Sydney Australia
 
Posts: 3 since Jan 2012
Thanks Given: 0
Thanks Received: 1

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 NexusFi?
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769


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 NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
Nicolas11's Avatar
 Nicolas11 
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
Posts: 1,071 since Aug 2011
Thanks Given: 2,232
Thanks Received: 1,769


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 NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


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
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,446 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,610

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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
sunbeam
Sydney Australia
 
Posts: 3 since Jan 2012
Thanks Given: 0
Thanks Received: 1


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




Last Updated on January 27, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts