Nicolas

Fractal Dimension Index - FDI

Category: Indicators By: Nicolas Created: April 15, 2016, 2:24 PM
April 15, 2016, 2:24 PM
Indicators
6 Comments
Fractal Dimension Index - FDI

The Fractal Dimension Index is an indicator that measure the strength of a trend by determining the amount of volatility of the instrument. This indicator is already available in the platform but not available for custom coding in ProScreener or ProOrder. This version can resolve this issue.

 

N = 30

once fdi=undefined

if barindex >= n-1 then
 diff=0
 length = 0
 pdiff = 0
 hh=0
 ll=0
 FDI=0
 HH = highest[N](close)
 LL = lowest[N](close)

 for Period = 1 to N-1 do
  if (HH - LL) > 0 then
   diff = (customclose[Period] - LL) / (HH - LL)
    if Period > 1 then
     length = length + SQRT(SQUARE(diff - pdiff) + (1 / SQUARE(N)))
   endif
  pdiff = diff
 endif
next

 if length > 0 then
  FDI = 1 + (LOG(length) + LOG(2)) / LOG(2 * (N))
 else
  FDI = 0
 endif
endif

return FDI AS "Fractal Dimension Index"

 

Download
Filename: Fractal-Dimension-Index-PRC.itf
Downloads: 184
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Wilko
10 years ago
#

Thanks for the tip about CustomClose! I wasn't aware of this.

Wilko
10 years ago
#

Dear Nicolas,

When I apply this code i get marginal differences with the default indicator included in PRT called Fractal Dimension Index. Do you know why?

Another question is: Your indicator allows me to choose which value to apply it to (close, TypicalPrice, MedianPrice, etc). I can't find anything in the code that would trigger this option. Do you know why it is triggered and how to integrate it in other user-programmed indicators?

Kind regards and thanks again for all your work,

Fredrik

Nicolas
10 years ago
#

I don't know about the differences from this version and the default platform one. As far as I remember, I translated this code from another programming language.

If you want to play with other different prices type, you can replace (close) with (customclose) at lines 12 and 13 and you should be able to change it in your indicator parameter window.

Wilko
10 years ago
#

Nicolas,

Thanks for making this available. Have downloaded to perform some tests.

Kind regards,

Fredrik

Dymjohn
10 years ago
#

Hi 

Downloaded this file but seems to be something wrong. I'm trying to use it as an indicator as part of a buy signal to buy when value is below 1.5 but the following has a problem with the CALL as  it is underlined as in error when loading from "user indicators"

indicator2 = myFractalDimensionIndex = CALL "Fractal Dimension Index PRC"(close)

Can anyone tell me what is wrong please?

 

Nicolas
10 years ago
#

You are not using correctly the CALL function. Please take a look on the "how-to" example in the documentation, right here: http://www.prorealcode.com/documentation/call/

ProRealCode ProRealCode
Loading...