This code is the translation from an indicator made by Ehler and found on TradingView. It returns the Fourier wave for a specific period of time. The period of time should be a multiple of a measured historical cycle.
Blue skies!!
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
src3 = (close) Period = 20 Bandwidth = 0.1//don't change this setting too much X1 = src3 - src3[2] L1 = cos(360/period) L2 = cos(360/(period/2)) L3 = cos(360/(period/3)) G1 = cos((Bandwidth*360/Period)) G2 = cos(Bandwidth*360/(Period/2)) G3 = cos(Bandwidth*360/(Period/3)) S1 = 1/G1 - sqrt(1/(G1*G1)-1) S2 = 1/G2 - sqrt(1/(G2*G2)-1) S3 = 1/G3 - sqrt(1/(G3*G3)-1) // - - - - - Band-Pass Filter - - - - - // if barindex <= period then F1 = 0 else F1 = 0.5*(1-S1)*X1 + L1*(1+S1)*F1[1] - S1*F1[2] endif // - - - - - Quadrature - - - - - // if barindex <= period then Q1 = 0 else Q1 = (Period/360) * (F1-F1[1]) endif // - - - - - 2nd Harmonic Band-Pass Filter - - - - - // if barindex <= period then F2 = 0 else F2 = 0.5*(1-S2)*X1 + L2*(1+S2)*F2[1] - S2*F2[2] endif // - - - - - 2nd Harmonic Quadrature - - - - - // if barindex <= period then Q2 = 0 else Q2 = (Period/360) * (F2-F2[1]) endif // - - - - - 3rd Harmonic Band-Pass Filter - - - - - // if barindex <= period then F3 = 0 else F3 = 0.5*(1-S3)*X1 + L3*(1+S3)*F3[1] - S3*F3[2] endif // - - - - - 3rd Harmonic Quadrature - - - - - // if barindex <= period then Q3 = 0 else Q3 = (Period/360) * (F3-F3[1]) endif // - - - - - Harmonic Sum - - - - - // if barindex > period then once P1 = 0 once P2 = 0 once P3 = 0 for i = 0 to (Period-1) P1 = P1 + F1[i]*F1[i] + Q1[i]*Q1[i] P2 = P2 + F2[i]*F2[i] + Q2[i]*Q2[i] P3 = P3 + F3[i]*F3[i] + Q3[i]*Q3[i] next // - - - - - Harmonic Sum (combined) - - - - - // if P1 = 0 then Wave = 0 else Wave = F1 + sqrt(P2/P1)*F2 + sqrt(P3/P2)*F3 endif endif return wave,0 |
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
have u got the trading view version?