Latest on ATNET:

#crypto-opsec #crypto-trading-strategy
#crypto-fundamentals #yield
Roc  · 06/17/22

Script Spotlight: Detrended Price Oscillator (DPO)

Altcoin Trading Blog
04/08/22 · Crypto technical analysis

About This Blog Post

  1. Uses bitforex  ( + more posts) 
  2. Filed as ScriptSpotlight
  3. On the same topic: Another better Coinmarketcap - with a heatmap tool
  4. On the same topic: Script Spotlight: Bollinger Band Width
  5. On the same topic: OBV: On-Balance Volume Divergence Crypto Strategies
Welcome to AltcoinTrading's ScriptSpotlight series. In ScriptSpotlight, we review pine scripts that are available from the FREE version of Tradingview public library. If you don't have a TradingView account yet, make the free one here.
The Detrended Price Oscillator strategy tool from TradingView is similar to a moving average, but easier to read.
Subscribe to our RSS feed
Airdrops / Blog
 

The feature of today’s Script Spotlight is an older tool that is not groundbreaking or super sophisticated but it will make your chart reading faster.

It is called The Detrended Price Oscillator and it is very similar to a simple moving average.

Detrended Price Oscillator Strategy by HPotter

Full script

//  Copyright by HPotter v1.0 30/03/2017
study(title="Detrended Price Oscillator", shorttitle="DPO")
Length = input(14, minval=1)
Series = input(title="Price", type=string, defval="close")
hline(0, color=green, linestyle=line)
xPrice = close
xsma = sma(xPrice, Length)
nRes = xPrice - xsma
pos = iff(nRes > 0, 1,
	     iff(nRes < 0, -1, nz(pos[1], 0)))
barcolor(pos == -1 ? red: pos == 1 ? green : blue )
plot(nRes, color=red, title="Detrended Price Oscillator")

Parameters: Length (number of timespans to calculate over, default 14) and Price (candle value input, default Close).

What it does: It takes the price values over the chosen span and calculates a standard moving average from them. It then calculates the difference between the price and the SMA: nRes = xPrice - xsma

The resulting line gets plotted below the chart and the chart’s candles are colored red or green depending on whether the value of the difference is positive or negative.

This is what the Detrended Price Oscillator, or DPO, looks like on a 1D BTCUSD chart. (I changed the default colors for clarity)

barcolor(pos == -1 ? orange: pos == 1 ? lime : aqua )

Script Spotlight: Detrended Price Oscillator (DPO)

Does it work?

Of course it does work, there’s no rocket science in this one. You can use it on any timeframe and play with the length of the span.

On the 1W DPO gives an easy single-glance information about the market:

Script Spotlight: Detrended Price Oscillator (DPO)

Even better, it is worth noting that the information you get from the color changes is equivalent to the cross of the Bollinger Band middle line on Bollinger Bands of the same length.

Here on a 1W chart for the lengths of 28:

Script Spotlight: Detrended Price Oscillator (DPO)

For very long-term crypto charts this is actually more convenient that the bbands, if you are only looking for the position of the price relative to the mean.

You’ll notice I had to switch off the auto sizing on the chart because due to the periods of cryptocurrency bubbles, the lower and upper Bollinger bands shoot too far.

It won’t be a very difficult job to add candle coloring for the lower and upper Bollinger band crosses either, by the way.

Bottom Line

The Detrended Price Oscillator is indeed similar to SMAs. The information is presented by coloring the chart candles though, which means you don’t have to squint your eyes at the chart when investigating trend cycles.

A marginal advantage but if you have a chart with no candle-coloring script in place, this would be a good choice.



Disclosure: All products featured on AltcoinTrading.NET are independently chosen, but some of the links on this page are affiliate links. Read our full content disclosure to learn more.

You just read AltcoinTrading's ScriptSpotlight series. In ScriptSpotlight, we review pine scripts that are available from the FREE version of Tradingview public library. If you don't have a TradingView account yet, make the free one here.


This post belongs to series #scriptspotlight

 

Want to *really* learn crypto charting & technical analysis?

Hate to break it to you, but there's no trading school, no neatly structured course and no simple how to.
Read our articles to get familiar with the tools, but try everything hands on. Trading will press your emotions, you can only really learn it as you go.

All the good crypto charting tools and platforms are accessible for FREE in either TradingView app or at Bitfinex. Just start!

Get TradingView Signup at Bitfinex

 

Latest Airdrops & Bounties (Updates Mo + Thu nights)

airdrop GloDAO Airdrop - Airdrop with a big referral bonus. There is a bunch of mi...
airdrop Galaxy Project Airdrop - Simple gleam form to follow 4 accounts, pays to everyone....
airdrop NEST (BSC) Airdrop - NEST Protocol is a decentralized price oracle network dep...
airdrop Chee Finance Airdrop - A Gleam form that pays $CHEE tokens for three simple soci...
bounty PAXO Finance Testnet Bounty - PAXO is a Polygon app that is doing a testnet run of its ...
bounty MEME airdrop - Phase II of the airdrop. The 2.75 billion $MEME airdrop i...
bounty X Meta Fans Bounty (BSC BEP20) - Long running marketing bounty with 75k USD pool. Facebook...
exchange promo Ledger 'Not Your Keys' promo - 20% discount code - NYKNYC
exchange promo Bitget Giveaway - live
exchange promo Stacked Waitlist $25 Gift - live
exchange promo BitMart Welcome Bonus (up to 3k USD) - 3 tasks
exchange promo Wombat Exchange DEX airdrops - to farmers