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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
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?
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/
Nicolas,
Thanks for making this available. Have downloaded to perform some tests.
Kind regards,
Fredrik
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
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.
Thanks for the tip about CustomClose! I wasn’t aware of this.