Welcome Guest
You can search the forum and read articles
If you would like to post an article please sign in or Create free account

Sign in





Search articles by Keyword
Search articles by Category
FAQ
  • Trading IQ Game prizes (1)
  • System performances (6)
  • General FAQ (41)
Precision Trading Systems Products
  • Mach-Trend (13)
  • PLA Dynamical (23)
  • Precision Stop (18)
  • Precision Index Oscillator (21)
  • Precision Divergence Finder (8)
  • Demand Index (7)
  • Percent Asymmetric (13)
  • Precision Probability Index (13)
  • Gravity Model (Research project) (2)
Platform type
  • Ninja Trader (44)
  • MultiCharts (32)
  • Tradestation (28)
  • Metatrader 4 (17)
  • Metatrader 5 (10)
  • ESignal (3)
  • Metastock (2)
  • Amibroker (2)
  • SierraChart (2)
Level of experience
  • Advanced (33)
  • Intermediate (41)
  • Beginner (34)
Instrument-Market type
  • Stocks (14)
  • Indices (9)
  • Futures (22)
  • Forex (12)
  • Bonds (3)
Technical Analysis
  • Interesting charts (5)
  • New highs or low breakouts (3)
  • Patterns and Methods (15)
  • Stop losses where to place them (4)
Word Interest rates
  • United Kingdom (5)
  • USA (1)
  • India (0)
  • Japan (0)
Forum opertations
  • Updates needed (0)
  • Suggestions to improve forum (0)
  • Request new category (0)
Trading IQ Game
  • Operations (3)
  • Tips (2)
World News
  • News of interest (6)
  • Stockmarket sensitive news (3)
  • Technological developments (2)
World economy
  • Germany (1)
  • China (0)
  • United Kingdom (2)
  • USA (0)
  • Japan (0)
  • Eurozone (1)
Psychology
  • Human error (8)
  • Trading psychology (6)
  • Self improvement methods (1)
Programming - Code examples
  • Easy Language (9)
  • VB.Net (0)
  • Ninja Script (2)
  • Java (0)
Quantum Physics
  • Strange things (1)
  • Fractals (1)
UK Property
  • London House prices (3)
  • UK House prices (1)
Genius people
  • Albert Einstein (0)
  • Richard Feynman (0)
  • Albert Bartlett (0)
Computing
  • Operating system comparison (0)
Fracking
  • UK Fracking (0)
  • USA Fracking (0)
Futurology
  • Predictions for the future (2)
  • David Goodstein (0)
Philosophy
  • Proverbs (0)
No Image
User id RM1 May 9th 2015
View profile
Forum rating NA
Trading IQ NA
SOLVING DIVISION BY ZERO CODE ERRORS IN EASY LANGUAGE


<>

Dear Roger

I bought many your products these years. I'm an user of TradeStation2000i.

When I apply one indicator on TS2000i, sometimes following small window happened:

"Floating point invalid numbers in calculation. This error sometimes indicates a division

be zero error with a zero also in the numerator. Incorrect example: Value1=Value2/Value3;

Correct example: Value1=IFF(Value2=0,0, value2/value3):

Since all your indicators I bought are codes protected, I remember you post a solution

somewhere on your site but I couldn't find it. Please help me.

I would appreciate your quick response.

Regards


<< ANSWER >>

Division by zero is a frequent problem experienced in programming. The answer is always infinity, so we have to prevent anything getting divided by zero in the first place.

There are two methods of doing this.

Method 1

If value1 = 0 then value1=value1+0.0000000001;

So we simply add a tiny number to it, which is so tiny it will not make too much difference to the outputs.

Method 2

If value1 <> 0 then value2 = value3 / value1

This forces the computer to ask if the value1 is 0 or not before doing its calculations. If it is 0 it will return the default value that was assigned to value1 in the variables when you created it.



Voila.

So to be exactly clear if a value can be zero you have to stop it being zero or you will get this error in all programming situations.

There are more programming code examples here

http://www.precisiontradingsystems.com/easylanguage_code.htm

Hope this helps

user image









Disclaimer