Division by Zero, how to debug - EasyLanguage Programming | futures io social day trading
futures io futures trading


Division by Zero, how to debug
Updated: Views / Replies:3,748 / 6
Created: by arjfca Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Division by Zero, how to debug

  #1 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received

Division by Zero, how to debug

Hello

I'm writing my first line of codes in Easylanguage . When loading my Signal over the chart, i got an error message: Error in study " Name of my study" Exception Division by Zero)

How do I debug that.

I doid not found any code brake or variables report to help me to go down to the problem.

Any help appreciated

Martin

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,357 given, 83,237 received



arjfca View Post
Hello

I'm writing my first line of codes in Easylanguage . When loading my Signal over the chart, i got an error message: Error in study " Name of my study" Exception Division by Zero)

How do I debug that.

I doid not found any code brake or variables report to help me to go down to the problem.

Any help appreciated

Martin

It would be helpful if you posted the code. But in general, you've probably got a defined var that is zero by default, and you've tried to divide another var into it. One way to debug is to add print statements every few lines in your code, so you can see where it is "making it" and where it stops. The output will be in the PL Editor output window.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
 Vendor: www.innovative-trading-solutions-online.com 
Hartford, CT. USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG, Kinetick
Favorite Futures: TF
 
RJay's Avatar
 
Posts: 677 since Jun 2009
Thanks: 726 given, 740 received


arjfca View Post
Hello

I'm writing my first line of codes in Easylanguage . When loading my Signal over the chart, i got an error message: Error in study " Name of my study" Exception Division by Zero)

How do I debug that.

I doid not found any code brake or variables report to help me to go down to the problem.

Any help appreciated

Martin

Before executing Y/X, I always do a check. If X = 0, then, either set X to 1, or execute a "return".

Reply With Quote
The following user says Thank You to RJay for this post:
 
  #5 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received

Here is a copy of the faulty function

The chart on the screen is a Forex one. This function is to determine if a bar as a hammer, using my definition. The return is a True Or False value.

The problem occur when i do the division to get the ratio between the tail and the body of the bar.

From my observation on the output windows, Var's: are rounded to the second decimal, then calculated

So if Real value Displayed Value
High = 1.3672 1.37
Low 1.3651 1.37
Open 1.3657 1.37
Close 1.3664 1.37

If Body = Open - Close (1.37 - 1.37) = 0 instead of 0.0007

 
Code
{Hammer Fuction Return Hammer =True if all condition is met
Input: RBT: Ratio Bar / Tail // RBT: Ratio Body Tail
Output: Tail 
Hammer (True or False) }
 
variables:RBT(0);// Ratio Bar tail
Variables:DoubleLength(0),DoubleBody(0),DoubleTail(0);
Variables:DoubleLBody(0),DoubleHBody(0);
 
_Hammer=true;

RBT=0.99;              // If = 1 then Body and Tail could be of equal length. Other Value may be tested
Body=absvalue(open-close);
LBody=Minlist(Close,Open);// Slect the bottom price of the body
HBody=Maxlist(close,open);          // Select the upper price of the body
Tail=LBody-Low;// Tail = Lower part of the body - low of the bar
 

Print(value1," ",High," ",Low," ",Open," ",Close);   // for debugging only
Value1=value1+1;                                        //          :: ::
 

 
If((Body/Tail)<RBT)and(close>=medianprice)then_Hammer=true  {The body as to be smaller than the tail by a determined ratio ( RBT)}

 
else begin
  _Hammer=False;             //Actual ratio = Body / Tail. This as to be < then the targeted RBT
    Tail=0;
End

Any help appreciated

Martin


Last edited by arjfca; September 30th, 2010 at 06:54 AM. Reason: Text formating
Reply With Quote
 
  #6 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received

Partly Resolve

Did resole this division proble by modifying my approach

Line
If((Body/Tail)<RBT)and(close>=medianprice)then_Hammer=true

as been change for

If ( (Body* RBT ) <Tail) and (close >= medianprice) then _Hammer = true

Instead to divise, I multiply my ratio value to the body.

Work this tiime, not error displayed. Still have to work on the format

Martin

Reply With Quote
The following user says Thank You to arjfca for this post:
 
  #7 (permalink)
Trading Apprentice
Willowbrook, IL
 
Futures Experience: None
Platform: Windows 7, Android
Favorite Futures: Mouse and Keyboard
 
tarantino's Avatar
 
Posts: 32 since Sep 2010
Thanks: 71 given, 39 received


arjfca View Post
Did resole this division proble by modifying my approach

Line
If((Body/Tail)<RBT)and(close>=medianprice)then_Hammer=true

as been change for

If ( (Body* RBT ) <Tail) and (close >= medianprice) then _Hammer = true

Instead to divise, I multiply my ratio value to the body.

Work this tiime, not error displayed. Still have to work on the format

Martin

Mathematically you are incorrect:

Body/Tail < RBT should be changed to Body < Tail * RBT

Reply With Quote
The following user says Thank You to tarantino for this post:

Reply



futures io > > > > > Division by Zero, how to debug

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug Strategies and Indicators with the MicroSoft CLR Debugger sam028 NinjaTrader Programming 6 February 17th, 2015 06:34 PM


All times are GMT -4. The time now is 10:55 AM.

Copyright © 2017 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
Page generated 2017-12-18 in 0.13 seconds with 19 queries on phoenix via your IP 54.226.113.250