John Ehlers’ and Ric Way’s article in this issue, “Fractal Dimension As A Market Mode Sensor,” provides a method of calculating the fractal dimension of any price series. The authors suggest using the calculations to distinguish trending from cycling price movement
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
// Parameters // N = 30 ; N must be an even number // Threshold = 1.4 Price = MedianPrice once HalfN = 0.5 * N once NMinus1 = N - 1 once HalfNMinus1 = HalfN - 1 once Log2 = Log(2) if barindex > N then Smooth = (Price + 2 * Price[1] + 2 * Price[2] + Price[3]) / 6 N3 = ( highest[N](Smooth) - lowest[N](Smooth) ) / N HH = Smooth LL = Smooth for Count = 0 to HalfNMinus1 do if Smooth[Count] > HH then HH = Smooth[Count] endif if Smooth[Count] < LL then LL = Smooth[Count] endif next N1 = ( HH - LL ) / HalfN HH = Smooth[HalfN] LL = Smooth[HalfN] for Count = HalfN to NMinus1 do if Smooth[Count] > HH then HH = Smooth[Count] endif if Smooth[Count] < LL then LL = Smooth[Count] endif next N2 = ( HH - LL ) / HalfN if N1 > 0 and N2 > 0 and N3 > 0 then Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) / Log2 + Dimen[1] ) endif Dimen = Average[20](Ratio) endif return Dimen as "Dimen", 1.6 as "1.6", Threshold as "Trigger" |
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