The Market Mode indicator seeks to identify trends and rebounds by identifying “phases” according to the principles of John Ehlers.
- When the oscillator passes above the top line, the market is in an uptrend.
- When the oscillator goes below the bottom line, the market is in a downtrend.
- Between these two levels, the market is calmer and could rebound in the direction of the initial trend and / or phase of trend change.
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 69 70 |
//PRC_LMarket Mode | indicator //29.12.2017 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //translated from MQL4 code MMPeriod = 20 // Market mode period Delta = 0.5 // Delta Fraction = 0.8 // Fraction LevelUpAveragePeriod = 10 // Level up average period LevelDownAveragePeriod = 10 // Level down average period Price = (high+low)/2 MPI = 3.14159265358979323846 calc = 2.0*MPI/MMPeriod beta = cos(calc /(2*MPI)*360) calc2 = 4.0*MPI*Delta/MMPeriod gamma = 1.0 / Cos(calc2 / (4.0*MPI*Delta) *360) alpha = gamma - Sqrt(gamma*gamma-1.0) alphaUp = 2.0 /(1.0+LevelUpAveragePeriod) alphaDn = 2.0 /(1.0+LevelDownAveragePeriod) dPeriod = 2*MMPeriod if barindex>MMPeriod then workbp = 0.5*(1.0-alpha)*(price-price[2])+beta*(1.0+alpha)*workbp[1]-alpha*workbp[2] mean = workbp for k=1 to dPeriod-1 do mean = mean+workbp[k] inc=k next mean = mean/inc workapeak = workapeak[1] if(mean>0) then workapeak=workapeak[1]+alphaup*(mean-workapeak[1]) endif workavaley=workavaley[1] if(mean<0) then workavaley=workavaley[1]+alphadn*(mean-workavaley[1]) endif fractionUp = Fraction*workapeak fractionDn = Fraction*workavaley r=255 g=255 b=255 if mean>fractionUp then r=50 g=205 b=50 elsif mean<fractionDn then r=219 g=112 b=147 endif if mean crosses over fractionUp then drawtext("●",barindex,mean,Dialog,Bold,16) coloured(0,255,0) endif if mean crosses under fractionDn then drawtext("●",barindex,mean,Dialog,Bold,16) coloured(255,0,0) endif endif return mean coloured(r,g,b) style(line,2) as "Mean",fractionUp coloured(100,100,100) as "upper line",fractionDn coloured(100,100,100) as "lower line" |
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
Très intéressant, merci beaucoup !
Thanks Nicolas!
merci beaucoup!!!!
merci, interessant, une idée comment élaborer une stratégie d’après cet indicateur?
Would be nice if the idicator can be adjusted for the 4 phases of Stan Weinstein.
Sure, but it has absolutely nothing to deal with…
merci, possible de l’utiliser seul pour le faire fonctionner en tant que stratégie ? de même est-ce possible de l’utiliser sur du 1Min en période 10 je doit changer le fractioner ?
Oui.
Pour changer la période, il faudra ajuster la variable MMperiod
plus la période est grande (en occurrence 20) plus l’indicateur est précis dans les changement de tendance? perso j’aime bien utiliser un sto 128 période avec une zone à 50 horizontal)
Hallo Nicolas,
in John Ehlers book “cycle analytics for Traders” from 2013, Mr. Ehlers describes the gamma for BanPass as follows:
gamma= 1/COS(360*Delta/MMPeriod) (your line 18).
I have added a while slope to the code in order to return a swami chart.
The result of the while slope swami chart is different to the manual chosen periods.
Do you have any idea what’s the reason could be?
I assume, that the look back period of [1]-[2] has an infuence.
Best regards
Hasardeur