Kaufman Efficiency Ratio (error) - futures io
futures io



Kaufman Efficiency Ratio (error)


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one davidcolin with 4 posts (1 thanks)
    2. looks_two ABCTG with 2 posts (1 thanks)
    3. looks_3 Fu510n with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,652 views
    2. thumb_up 4 thanks given
    3. group 5 followers
    1. forum 9 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,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
 

Kaufman Efficiency Ratio (error)

(login for full post details)
  #1 (permalink)
davidcolin
Vancouver BC Canada
 
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

Hi all,

just trying to code the Kaufman Efficiency Ratio in EasyLanguage as below (user function):

****************************************************

Inputs: length(numericsimple);

KaufmanER = absvalue( close - close[length] ) / absvalue( summation( (close - close[1]), length ) ) ;


****************************************************
Problem is I get a floating point invalid operation error when I apply this code. Can anyone help?

TIA!

David

Reply With Quote

Can you help answer these questions
from other members on futures io?
Time to change of FCM
Emini and Emicro Index
Help with Scale In ATM strategy
NinjaTrader
Tick Data Group Buy
Emini and Emicro Index
mahDualCandlePattern
NinjaTrader
Multidata
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Spoo-nalysis ES e-mini futures S&P 500
97 thanks
Most Funding Firms are a Scam
65 thanks
Hedging NQ and MNQ 1-10...
13 thanks
Trading Plan
9 thanks
How many day traders are profitable?
8 thanks
 
(login for full post details)
  #3 (permalink)
 Fu510n 
Suffield, CT
 
Experience: Advanced
Platform: MultiCharts, TS, Python
Broker: IB, IQFeed, TS, Kraken
Trading: ES, NQ, RTY, YM, CL, RB, 6E
 
Fu510n's Avatar
 
Posts: 128 since Oct 2009
Thanks: 852 given, 131 received


1) what are you passing in for length?
2) is/could the denominator be calculating as 0? (causing a divide by zero error; need to prevent that from happening if so)
3) have you taken a look at the Kaufman Efficiency Ratio indicator code in the D/L section?

Just a thought...

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #4 (permalink)
davidcolin
Vancouver BC Canada
 
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

Hi Fu510n....thanks for your response.

1. My coding ability is fairly rudimentary and as such I don't understand what "passing in for length" means. :/
2. Looks like it is a divide by zero error because I added the alternative:

Inputs: length(numericsimple);

If absvalue( summation( (close - close[1]), length ) ) <> 0
then KaufmanER = absvalue( close - close[length] ) / absvalue( summation( (close - close[1]), length ) )
else KaufmanER = 0

The floating point error disappears but the KER just plots as a straight line at 1. I didn't really know what to put for the alternative value....gah

3. I am not able to download that code as it for Elite members only, which I am not.




Fu510n View Post
1) what are you passing in for length?
2) is/could the denominator be calculating as 0? (causing a divide by zero error; need to prevent that from happening if so)
3) have you taken a look at the Kaufman Efficiency Ratio indicator code in the D/L section?

Just a thought...


Reply With Quote
 
(login for full post details)
  #5 (permalink)
 SMCJB 
Legendary Market Wizard
Houston, TX
 
Experience: Advanced
Platform: Trading Technologies
Broker: Primary Advantage Futures. Also ED&F and Tradestation
Trading: Primarily Energy but also a little GE, SI, Bitcoin & Ether
 
Posts: 4,527 since Dec 2013
Thanks: 3,855 given, 9,119 received

absvalue(summation()) <> summation(absvalue())

This should work

Inputs: length(numericsimple);

If summation( absvalue( (close - close[1]), length ) ) <> 0
then KaufmanER = absvalue( close - close[length] ) / summation( absvalue( (close - close[1]), length ) )
else KaufmanER = 0

Reply With Quote
The following 2 users say Thank You to SMCJB for this post:
 
(login for full post details)
  #6 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,326 since Apr 2013
Thanks: 425 given, 1,550 received

davidcolin,

the solution @SMCJB provided should fix the error. In general you might want to add a similar check to every division you do within any EasyLanguage code, to ensure the divisor is not 0 (it's enough to trigger this error in case it's 0 once on the very first call).

Regards,

ABCTG


davidcolin View Post
Hi all,

just trying to code the Kaufman Efficiency Ratio in EasyLanguage as below (user function):

****************************************************

Inputs: length(numericsimple);

KaufmanER = absvalue( close - close[length] ) / absvalue( summation( (close - close[1]), length ) ) ;


****************************************************
Problem is I get a floating point invalid operation error when I apply this code. Can anyone help?

TIA!

David


Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #7 (permalink)
davidcolin
Vancouver BC Canada
 
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

Thanks very much you guys. Your kindness and expertise is appreciated. I will try this out later today.

Reply With Quote
 
(login for full post details)
  #8 (permalink)
davidcolin
Vancouver BC Canada
 
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

Thank you again. Your revision worked.

Reply With Quote
The following user says Thank You to davidcolin for this post:
 
(login for full post details)
  #9 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,326 since Apr 2013
Thanks: 425 given, 1,550 received

@davidcolin,

you are welcome, I am glad to hear that it works for you.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #10 (permalink)
Tamir58
Tel Aviv/Israel
 
 
Posts: 1 since Jul 2018
Thanks: 0 given, 0 received


it should be as follows:

Total_abs_change = Summation(Absvalue(Close - Close[1]), Kaufman_ER_Length) * 100;
Value1 = Close - Close[Kaufman_ER_Length];
Kaufman_ER = Value1 / Total_abs_change * 100;

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Kaufman Efficiency Ratio (error)


Last Updated on January 20, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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