In Monday's blog post, I wrote about the recent improvements to the trading terminal. One of the new features I talked about was that I've finished reverse engineering the Market Cipher indicator package. Now, for legal purposes, I have to say that I can't be 100% certain that what I've found is the actual formula. For Cipher A, B and SR, I'm 99.999% sure I have it. DBSI is close behind, and I'll tell you exactly how close below. Nobody outside the company that sells Market Cipher has the Pine Script source code for these indicators, me included. Everything I know came from measuring what they draw.

That said, I made some interesting discoveries along the way, and I want to walk through them here. Market Cipher is made up of four main indicators: Cipher A, B, SR and DBSI. Each gives a slightly different window into the market. I'll take them one at a time, and then get to the part I've been itching to tell you about, which is the money flow.

How I figured any of this out

A quick word on method, because it matters for everything below. TradingView lets you see the exact numbers an indicator plots on every bar, even when the code is hidden. So I pulled those numbers off the real Market Cipher on charts with thousands of bars (Bitcoin daily back to 2011, the Dow Jones daily back to 1896, Bitcoin on 15-minute candles), and then I kept changing my version until its numbers matched, bar by bar. When I say something "matches exactly" in this post, I mean every bar, to the five decimal places TradingView prints. Where I only got close, I'll say so.

Cipher A: trend from moving averages

Cipher A sits on the price chart. It tells you about trend based on moving averages, and it prints symbols above the candles as warnings.

The moving averages are a ribbon of eight lines. Each one is an exponential moving average of the closing price, which is just an average that cares more about recent candles than old ones. The eight lengths are 5, 11, 15, 18, 21, 25, 29 and 33 bars. Sighted traders read the ribbon by colour: a line turns blue while it sits above the next longer line, and grey when it doesn't. A ribbon that's all blue is a market trending up. I'm told it's very pretty.

The symbols are where it gets interesting, because most of them aren't just about the moving averages. Some borrow from Cipher B. The original names them by shape, which tells a blind trader nothing, so in the terminal each one says what it means:

  • Trend Turned Up (the green dot): the 11-bar average crosses above the 33-bar one, on a candle that's also showing Bullish Conditions.
  • Early Turn Up (the blue triangle): the 5-bar average crosses above the 25-bar one while Cipher B's waves are pointing up, before the longer trend has turned.
  • Bullish Conditions (the yellow diamond): short-term averages above the longer ones, Cipher B's fast wave above its slow wave, and either a clear gap between the waves or Cipher B's money flow above 5.
  • Short-Term Turn Down (the red X): the 5-bar average crosses below the 11-bar one.
  • Momentum Turned Down (the red diamond): Cipher B's fast wave crosses below its slow wave.
  • Strongest Sell Warning (the blood diamond): a red diamond and a red X on the same candle.
  • Oversold Trap Warning (the yellow X): a red diamond when the waves are already deep down and one of Cipher B's slower lines is below 20.

Against Market Cipher A's own numbers on Bitcoin daily, every one of those lands on exactly the same candles as the original, none missing and none extra. There were 541 red diamonds and I matched all 541. The one that gave me trouble for weeks was Bullish Conditions, and the reason turned out to be the money flow. Hold that thought.

Cipher B: the waves, the gap and the money flow

Cipher B is an oscillator with multiple parts, drawn in its own pane under the chart. Not all of Cipher B is original to Market Cipher, though.

The primary feature of Cipher B is the blue waves, which were originally developed by LazyBear on TradingView as the WaveTrend oscillator. The blue waves, also called momentum waves, show you where the strength is in price action relative to the timeframe you're looking at.

Here's how they're built, in plain terms. Take each candle's typical price, which is the average of its high, low and close. Measure how far that is from its own recent average, and compare that to how far price usually wanders. That gives you a number that's near zero when price is doing nothing unusual and swings far from zero when it's stretched. Smooth that over 12 bars and you have the fast wave, the light blue one. Average the fast wave over the last 3 bars and you have the slow wave, the dark blue one. Lines at plus and minus 53 and 60 mark overbought and oversold.

Every time the two waves cross, Cipher B puts a small dot on the cross. The famous big green buy dot is simpler than people think. It's a cross upward while the fast wave is below minus 60. That's it. No waiting for confirmation, no cool-down. I checked that against all 64 buy dots Market Cipher B drew on Bitcoin daily, and 68 more on Heikin-Ashi candles, and got every one with nothing extra.

In the terminal you hear all of this rather than see it. The waves play clean in the normal range, pick up a soft noise past 53 and a louder one past 60. A cross plays a short bell, and the buy dot says "Buy dot, waves crossed up from oversold."

The "VWAP" that isn't a VWAP

Market Cipher B draws a yellow area that it labels VWAP. VWAP usually means volume-weighted average price, which is the average price paid, weighted by how much was traded at each price. I spent a while assuming that's what it was. It isn't. Market Cipher B's "VWAP" is simply the fast wave minus the slow wave, the gap between the two blue waves. It's the same idea as the MACD histogram, which is the gap between MACD's two lines. When the waves cross, the gap crosses zero, so it's another way to watch momentum build or fade.

In the terminal it's called the Wave Gap. It clicks every time it crosses zero, and Ctrl+Left and Right Arrow jump between those crossings.

Two lines that aren't what they say either

Cipher B also draws two thin lines that run from 0 to 100, one labelled "RSI" and one labelled "Sto RSI." Neither one is an RSI. I tested them against every RSI, stochastic and smoothing from 2 to 100 bars that I could think of. The "RSI" line is a 40-bar stochastic of the closing price, and the "Sto RSI" line is an 81-bar one, both smoothed over 2 bars. A stochastic just tells you where today's close sits between the highest high and lowest low of a window, as a percentage. Both are exact. The next-best guesses were off by around a point, which matters, because these lines decide when other signals fire.

Cipher A's Oversold Trap Warning reads the 81-bar line, and DBSI reads both. They're drawn in the terminal but muted by default, so they don't add two more voices to the chart. You can still arrow onto them.

Cipher SR: support and resistance

Cipher SR shows you support and resistance levels, the prices where a market has turned before and might turn again.

It draws one resistance level and one support level at a time, each as a run of dots, one per bar. A resistance level starts at a candle whose highs climbed for two bars in a row going into it and fell for two bars in a row after it, and whose volume was above the average of the last six bars. Support is the mirror image, built from the lows. About half the pivots that pass the volume test don't climb and fall in clean steps like that, and the original skips them. My first version used a looser pivot and matched roughly two thirds of the original's levels. With the two-step rule, it matches every bar.

The level stays in place until a newer one replaces it, even if price closes straight through it. Market Cipher SR never calls a level "broken." So the number of dots tells you how long a level has been the local high or low. In the terminal, when a level is replaced you hear "New resistance at" the new price, "replacing" the old one, and when price crosses a level, that's what you hear.

SR also draws the day's high, low and middle, and a VWAP that resets at midnight UTC. This one really is a volume-weighted price. On a 15-minute Bitcoin chart with over 5,000 bars, every bar of both levels and the VWAP matched the original.

One place I deliberately did things differently. On past days, the original draws the whole day's high from the very first bar of that day, so a 10 AM candle already knows the high that came at 3 PM. That's looking into the future, and it makes history look smarter than it was. Mine draws the high so far. On the live bar they agree.

SR is also the one part of the package that genuinely uses volume. That'll be important in a minute.

Cipher DBSI: scoring the bulls and the bears

DBSI prints two whole numbers on the chart, one for the bulls and one for the bears, that tell you how strong each side is right now. A bigger number means a stronger side. It's the hardest of the four to crack, because unlike the others, its numbers don't come from one formula you can fit a curve to. It's a scoring system with a lot of rules.

So I read its scores, thousands of them, across Bitcoin, Ethereum, the Dow, the S&P 500, gold, Apple, Microsoft and more, on timeframes from one minute to daily. And it turns out DBSI is built almost entirely out of Cipher B's parts. Each side gets a set of votes: is Cipher B's fast wave rising, is the gap between the waves widening, is the money flow rising, are the 40-bar and 81-bar lines rising, and a few more. Then the score depends on where that side is in its current wave run: whether there's no run, whether the gap has widened on every bar since the waves crossed, or whether the run has started to fade. The bears use the exact same rules, run on the price chart turned upside down.

How close is it? On over 33,000 bars from charts I never used to choose a rule, my DBSI prints the original's exact number on 99.97% of them. Where it misses, it's mostly on old stock and commodity charts with long flat stretches where the high and low were the same price. There, tiny rounding differences between TradingView and my code can push a score off by up to two, so the terminal tells you when a number might be off. Many of the rules are narrow, and a market unlike the ones I checked may see a few more misses. That's why I call DBSI essentially identical rather than exact.

The secret ingredient: money flow

The secret of Market Cipher is the money flow, and it's what most people haven't been able to replicate, even in the popular Cipher B clones on TradingView. The money flow calculation in Cipher B is also used by Cipher A and DBSI, so it has to be right or none of the other indicators will be accurate either. Remember Bullish Conditions in Cipher A? Before it checked the money flow at all, it fired on 34 to 39 candles the original never marked. With my close-but-not-quite money flow, it was still off on a few. With the exact one, zero. On the Dow daily, a chart I never used for fitting, it went from nine extra to none.

Here's the secret: Cipher B's money flow has nothing to do with volume. It's actually based on the Commodity Channel Index, or CCI, averaged over a 60-bar window.

CCI is an old indicator, published by Donald Lambert back in 1980. It asks one question: how far is the typical price from its recent average, compared to how far it normally strays? Market Cipher takes a very short version of that, only five bars, and works it out on every candle. Then it averages the last 60 of those readings and caps the result at plus or minus 100. When the line is above zero, price has been closing above where it usually sits for a while. Below zero, the opposite. Sighted traders see it as a green or red area. In the terminal it plays as its own wave.

The way I found it was kind of fun. A 60-bar average has a useful quirk: each time it moves, the change is just the newest reading coming in minus the reading from 60 bars ago dropping out, divided by 60. That means you can work backwards from the line Market Cipher draws to the readings being fed into it. Once I had those readings, I asked what mix of the last ten candles' prices would produce them. The answer came back clean: the high, low and close count equally, the open counts for almost nothing, and the four candles before count a quarter each against the newest. That's the typical price minus its five-bar average. The multiplier came out as 66.667 on every chart I tried. That number is the constant Lambert built into CCI in 1980. That's when I knew what I was looking at.

There is one small twist. Classic CCI compares the price to how far prices have strayed from today's average. Market Cipher's version compares it to the average of how far each recent bar strayed. It's a small difference, but you need it to land on the exact numbers.

And it is exact: on the Dow daily all the way back to 1896, over 32,000 bars, on Bitcoin daily with both kinds of candles, and on Bitcoin 15-minute, every finished bar matches to five decimal places. It even starts on the same bar, the 68th.

The popular clones build their money flow from candle bodies, meaning how far each candle closed from where it opened. To be fair, so did my first two attempts. They look similar on a chart and track the real thing pretty well, but they never match it, and the indicators that depend on them drift.

Since Market Cipher can be used on any asset on any timeframe, and since not every asset has volume (currency pairs and indices often don't), it's only logical to assume the money flow doesn't use volume, and sure enough, it doesn't. Cipher B's waves don't either, and here's a fun twist: WaveTrend is a CCI too. It uses that same 1980 constant. So Cipher B is really two CCIs, a quick one for the waves and a slow one for the money flow. That's a big part of why it behaves the same on Bitcoin, the Dow and the euro.

Why Heikin-Ashi candles

The Market Cipher package is intended to be used on Heikin-Ashi candlestick charts. Heikin-Ashi candles smooth out price action so that trend and direction are a little easier to spot. Each Heikin-Ashi candle closes at the average of the real candle's open, high, low and close, and it opens halfway between the previous Heikin-Ashi candle's open and close. So one noisy candle can't jerk the chart around, and a trend shows up as a run of candles all going the same way.

When the chart is on Heikin-Ashi, every Cipher reads the Heikin-Ashi candles, the same way TradingView does. I checked Cipher A and B against the originals on both kinds of candles, and they match on both.

Inside the terminal, pressing Alt+C toggles between regular and Heikin-Ashi candles, and it tells you which one you're on. One caution: a Heikin-Ashi close is an average, not a price anybody actually traded at. When you arrow through the candles on Heikin-Ashi, the closes you hear aren't the real ones. Strategies in the terminal always trade the real prices for that reason.

What to take from all of this

The biggest lesson for me was that the names lie. The "VWAP" isn't a VWAP, the "RSI" isn't an RSI, and the "money flow" has no money in it. Once I stopped trusting the labels and started trusting the numbers, things fell into place.

As I said on Monday, none of this makes Market Cipher a money printer. When I tested its signals on their own, fairly, across years of stocks and crypto, they had no edge. It's a lens for reading momentum, and now that I know what's inside it, I trust that lens a lot more.

If you want to hear it for yourself, log in to the hosted terminal at accessibletrader.com/terminal, open a chart, press Alt+A and search for Cipher A, Cipher B, Cipher SR or Cipher DBSI. Press Alt+C to switch to Heikin-Ashi, and arrow through Cipher B's money flow. Now you know exactly what you're listening to.

To be clear, the terminal isn't affiliated with Market Cipher. Cipher A, B, SR and DBSI are my own builds, made to behave like the originals.