OPEN-SOURCE SCRIPT

Papercuts Recency Candles

Updated
Papercuts Recency Candles
V0.8 by Joel Eckert PapercutsTrading

***This is currently an experimental visual exploratory concept.***
*** Experimental tools should only be explored by fellow coders and experienced traders.***


snapshot
DESCRIPTION:
As coders, how can we seamlessly transition between actual and smoothed price data sets as data ages?
This is a visual experiment to see if and how data can be smoothly transitioned from one value to another over a set number of candles. If we visualize a chart in 3 zones, a head, a body, and a tail we can start to understand how this could work. The head zone would represent the first data set of actual asset prices. The body zone would represent the transition period from the first to the to the second data set. Last, the tail zone would represent the second data set made of a Hull Moving Average of the asset.

snapshot
CONCEPT:
  • It is conceived that data and position precision constantly shift as they decay or age, therefore making older price levels act more like price regions or zones vs exact price points. This is what I am calling Recency.
  • This indicator utilizes the concept of "Recency" to explore the possibility of a new style of candle. It aims to maintain accurately on recent prices action but loosen up accuracy on older price action. The very nature of this requires ALTERING HISTORICAL DATA within the body zone or transition candles to achieve the effect. It is similar to trying to merge a line chart type with a candle chart type.
  • This experiment of using recency for candles was to create candles that stay more accurate near current price but fade away into a simple line as they age out, resulting in a simplified view of the big picture which consists of older price action.
  • This experimental design theoretically will help you stay focused only on what is currently unfolding and to minimize distractions from older price nuances.


USAGE:
WHO:
  • This is not recommended for new traders or novices that are unfamiliar with standard tools. Standardized tools should always be used to get grounded and build a foundation.
  • Active traders who are familiar with trading comfortably should experiment with this to see if they find it interesting or usable.
  • Pine coders may find this concept interesting enough, and may adapt the idea to other elements of their own scripts if they find it interesting… I just ask they give credit where credit is due.

HOW:
The best way to visualize how this works is to do the following:
  • Load it on a chart.
  • Turn off Standard candles in Chart Setting of the current window. I actually just turn off the bodies and borders, and dim the old wicks as I like the way the old wicks look when left alone with these new candles.
  • Enable chart replay at a faster speed, like 3x, and play back the chart to watch the behavior of the candles.
  • You’ll be able to see how the head of the candle type preserves OHLC, and indicates direction but as the candle starts to age it progressively flowers into the HMA
  • While it plays back try adjusting settings to see how they affect behavior.
  • You can see the data average in real-time which often reveals how unstable actual price noise really is.
  • The head candle diagonals indicate the candle body direction.

SETTINGS:
  • Coloring: You can choose your own bullish or bearish colors to match your scheme.
    Price Line: The price line is colored according to the trend and
  • Head Length: These candles are true to the source high and low. They remain slightly brighter than transition candles. We have a max of 50 to keep things responsive.
  • Time Decay Length: This is the amount of candles it takes to transition to the tail. Max is 300 to keep things responsive.
  • Decay Continuity: This forces transition candles to complete the HMA curve instead of creating gaps when conforming to it. The best way to visualize this feature is to run a 3x replay of an asset, and toggle the result on and off. On is preferred.
    snapshot
  • Tail HMA Length: This is the smoothing amount for the resulting HMA stepline that calculates every close, but has a delayed draw until after the transition candles. You can optionally turn off the delayed visibility to help with comprehension.
  • Tail HMA Weight: This is simply an option to make the tail thicker or thinner. This also adjusts the border on the head candles to help them stand out.
  • Show Side Bias Dots: Default true: Draws a dot when bias to one side changes to help keep you on the right side of trade. Side bias is simply the alignment of 3 moving averages in one direction.

IMPORTANT NOTES:
  • You'll have to turn off or dim the standard candles in your view "Chart Settings" to see this properly.
  • Be aware that since the candles are based on boxes and utilize the “recency concept”, which means their data decays and changes as it ages. This results in a cleaner chart overall, but exact highs and lows will be averaged out as the data decays, forming a Hull Moving Average stepline of your defined length once decay has finished.



SUMMARY OF HOW IT WORKS:
  • First it takes candle information and creates unique boxes that represent each candle based on the high and low. It utilizes boxes because standard candles once written, cannot be later altered or removed… which is a key element for this effect to work.
  • Next it creates a second box and line from open to close for the body of the Head candles. This indicates direction at a glance.
  • As candles age beyond the defined distance of the “Head” they enter the "Body" aka "Time Decay" zone. Here the accuracy of the high and low will be averaged down using an incremental factor of the HMA, defined by "Time Decay Length" amount of candles.
  • The resulting tail is an HMA of Tail HMA Length. This tail is always calculate at close, but is not drawn instantly. The draw is delayed so that there is not overlapping data, and this makes the effect look more elegant.
  • There are also two EMAs within the script that do nothing but help candle coloring and help provide a trade side bias. When both EMA's and the HMA align, a side bias is defined. Only when the side bias changes will a new dot is formed.


Head candles have been simplified from previous versions to be easier to read at a a glance.
snapshot
Release Notes
//Calculation speed improvement by making candle 0 be drawn as a standard candle. The rest of the recency candles only update once per bar now.
//This change also helps prevent some redraw hiccups that could occur when things get real fast.
Release Notes
//Updates v840:
Calculation speed improvement by making all head be drawn as a standard candles, removing old wick and body objects entirely. The High/Low boxes fade in, making a nice elegant style crossover. The rest of the recency candles only update once per bar now. See image below:
snapshot
Release Notes
//Added Ghost Wick Option with opacity control.
snapshot
Candlestick AnalysiseducationalexperimentalHull Moving Average (HMA)papercutsrecency

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


-joel

Disclaimer