[blackcat] L3 Ehlers Market Mode Indicator

Level: 3


John F. Ehlers introuced Market Mode Indicator on April, 2012.


This indicator is used to determine whether the market is in a trending or a cyclical mode. This is accomplished by comparing the average value of price, after being filtered to the peaks and valleys of that filtered price. The filter used in this indicator is a second order butterworth filter. For more information on this calculation see "Introducing SwamiCharts" (March 2012) and "Empirical Mode Decomposition" (March 2010) from Technical Analysis of Stocks and Commodities by Dr . Ehlers .

Key Signal

MeanCalc --> short term fast line
MeanCalc(2) --> short term slow line
long ---> long entry signal
short ---> short entry signal

Pros and Cons

NOT 100% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.


The 80th script for Blackcat1402 John F. Ehlers Week publication.

I kept the core of Ehlers market mode indicator, but add conditons for long and short entries which i think they are reasonable.


In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.

The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.

Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.

Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.

Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.

Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.

Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Skript med en öppen källkod

I sann TradingView-anda har författaren till detta skript publicerat det som öppen källkod, så att handlare kan förstå och verifiera det. Skål för författaren! Du kan använda den gratis men återanvändning av den här koden i en publikation regleras av våra Ordningsregler. Du kan göra den till favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?
"Win$ & Donate w/ This" Address:
BTC: 1GeuxGE6UUato7AgMnNUjSg56mSzQ6Wxxk
USDT ERC20: 0xfd4d0eb131e81f44530849c1a966cb261dd6bda2
ETH: 0xfd4d0eb131e81f44530849c1a966cb261dd6bda2
LINK: 0xfd4d0eb131e81f44530849


Hi Blackcat1402 , have you tested and what was the result ?
Because in Indian Stock market , gives unexpected wrong Result ? A seasoned progrmmer like you can not make such mistake . It must have been something
gross somewhere has gone awry . Please look in at the earliest , I have tested on daily ,weekly as well as monthly time frame and on very active scripts .
I hope you take this as suggestion Please, Or I am missing something , if so please guide .
+1 Svara
blackcat1402 MaheshVakharia
@MaheshVakharia, thanks for your feedback, could you share your tradingpair and timeframe used for the unexpected wrong Result. I may look into it.
MaheshVakharia blackcat1402
MaheshVakharia MaheshVakharia
Dear Blackcat1402 , unable to attach chart as in comment it is not allowed , you just can check the TPL PLASTECH LTD NSE in which MONTHLY TF from 2012 to 2014 the 01 Oct 2011 SELL , again 2 Sept 2013 SELL . In Weekly TF 03 Sept 2018 BUY . Might be i have interpreted wrongly , if so please guide where i am making
the mistake. Regards. (it is light of Indian Stock )
blackcat1402 MaheshVakharia
MaheshVakharia blackcat1402
@blackcat1402, Thank you very much.
blackcat1402 MaheshVakharia
@MaheshVakharia, in monthly tf, it looks normal...
blackcat1402 MaheshVakharia
@MaheshVakharia, for weekly tf, it is normal, but for oversold region, it should add a cross zero constraints for long indeed.
+1 Svara
MaheshVakharia blackcat1402
@blackcat1402, Oh ,Thanks for your input,for making clear by going through the charts .Appreciate your genuine efforts .Regards .
Nice one. I see yellow & purple are your favorite colors. Can't be a coincidence. I'd love to see some other color combos.
+1 Svara