Papercuts Recency CandlesPapercuts 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.***
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.
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.
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.
Experimental
Advanced Dynamic Threshold RSI [Elysian_Mind]Advanced Dynamic Threshold RSI Indicator
Overview
The Advanced Dynamic Threshold RSI Indicator is a powerful tool designed for traders seeking a unique approach to RSI-based signals. This indicator combines traditional RSI analysis with dynamic threshold calculation and optional Bollinger Bands to generate weighted buy and sell signals.
Features
Dynamic Thresholds: The indicator calculates dynamic thresholds based on market volatility, providing more adaptive signal generation.
Performance Analysis: Users can evaluate recent price performance to further refine signals. The script calculates the percentage change over a specified lookback period.
Bollinger Bands Integration: Optional integration of Bollinger Bands for additional confirmation and visualization of potential overbought or oversold conditions.
Customizable Settings: Traders can easily customize key parameters, including RSI length, SMA length, lookback bars, threshold multiplier, and Bollinger Bands parameters.
Weighted Signals: The script introduces a unique weighting mechanism for signals, reducing false positives and improving overall reliability.
Underlying Calculations and Methods
1. Dynamic Threshold Calculation:
The heart of the Advanced Dynamic Threshold RSI Indicator lies in its ability to dynamically calculate thresholds based on multiple timeframes. Let's delve into the technical details:
RSI Calculation:
For each specified timeframe (1-hour, 4-hour, 1-day, 1-week), the Relative Strength Index (RSI) is calculated using the standard 14-period formula.
SMA of RSI:
The Simple Moving Average (SMA) is applied to each RSI, resulting in the smoothing of RSI values. This smoothed RSI becomes the basis for dynamic threshold calculations.
Dynamic Adjustment:
The dynamically adjusted threshold for each timeframe is computed by adding a constant value (5 in this case) to the respective SMA of RSI. This dynamic adjustment ensures that the threshold reflects changing market conditions.
2. Weighted Signal System:
To enhance the precision of buy and sell signals, the script introduces a weighted signal system. Here's how it works technically:
Signal Weighting:
The script assigns weights to buy and sell signals based on the crossover and crossunder events between RSI and the dynamically adjusted thresholds. If a crossover event occurs, the weight is set to 2; otherwise, it remains at 1.
Signal Combination:
The weighted buy and sell signals from different timeframes are combined using logical operations. A buy signal is generated if the product of weights from all timeframes is equal to 2, indicating alignment across timeframe.
3. Experimental Enhancements:
The Advanced Dynamic Threshold RSI Indicator incorporates experimental features for educational exploration. While not intended as proven strategies, these features aim to offer users a glimpse into unconventional analysis. Some of these features include Performance Calculation, Volatility Calculation, Dynamic Threshold Calculation Using Volatility, Bollinger Bands Module, Weighted Signal System Incorporating New Features.
3.1 Performance Calculation:
The script calculates the percentage change in the price over a specified lookback period (variable lookbackBars). This provides a measure of recent performance.
pctChange(src, length) =>
change = src - src
pctChange = (change / src ) * 100
recentPerformance1H = pctChange(close, lookbackBars)
recentPerformance4H = pctChange(request.security(syminfo.tickerid, "240", close), lookbackBars)
recentPerformance1D = pctChange(request.security(syminfo.tickerid, "1D", close), lookbackBars)
3.2 Volatility Calculation:
The script computes the standard deviation of the closing price to measure volatility.
volatility1H = ta.stdev(close, 20)
volatility4H = ta.stdev(request.security(syminfo.tickerid, "240", close), 20)
volatility1D = ta.stdev(request.security(syminfo.tickerid, "1D", close), 20)
3.3 Dynamic Threshold Calculation Using Volatility:
The dynamic thresholds for RSI are calculated by adding a multiplier of volatility to 50.
dynamicThreshold1H = 50 + thresholdMultiplier * volatility1H
dynamicThreshold4H = 50 + thresholdMultiplier * volatility4H
dynamicThreshold1D = 50 + thresholdMultiplier * volatility1D
3.4 Bollinger Bands Module:
An additional module for Bollinger Bands is introduced, providing an option to enable or disable it.
// Additional Module: Bollinger Bands
bbLength = input(20, title="Bollinger Bands Length")
bbMultiplier = input(2.0, title="Bollinger Bands Multiplier")
upperBand = ta.sma(close, bbLength) + bbMultiplier * ta.stdev(close, bbLength)
lowerBand = ta.sma(close, bbLength) - bbMultiplier * ta.stdev(close, bbLength)
3.5 Weighted Signal System Incorporating New Features:
Buy and sell signals are generated based on the dynamic threshold, recent performance, and Bollinger Bands.
weightedBuySignal = rsi1H > dynamicThreshold1H and rsi4H > dynamicThreshold4H and rsi1D > dynamicThreshold1D and crossOver1H
weightedSellSignal = rsi1H < dynamicThreshold1H and rsi4H < dynamicThreshold4H and rsi1D < dynamicThreshold1D and crossUnder1H
These features collectively aim to provide users with a more comprehensive view of market dynamics by incorporating recent performance and volatility considerations into the RSI analysis. Users can experiment with these features to explore their impact on signal accuracy and overall indicator performance.
Indicator Placement for Enhanced Visibility
Overview
The design choice to position the "Advanced Dynamic Threshold RSI" indicator both on the main chart and beneath it has been carefully considered to address specific challenges related to visibility and scaling, providing users with an improved analytical experience.
Challenges Faced
1. Differing Scaling of RSI Results:
RSI values for different timeframes (1-hour, 4-hour, and 1-day) often exhibit different scales, especially in markets like gold.
Attempting to display these RSIs on the same chart can lead to visibility issues, as the scaling differences may cause certain RSI lines to appear compressed or nearly invisible.
2. Candlestick Visibility vs. RSI Scaling:
Balancing the visibility of candlestick patterns with that of RSI values posed a unique challenge.
A single pane for both candlesticks and RSIs may compromise the clarity of either, particularly when dealing with assets that exhibit distinct volatility patterns.
Design Solution
Placing the buy/sell signals above/below the candles helps to maintain a clear association between the signals and price movements.
By allocating RSIs beneath the main chart, users can better distinguish and analyze the RSI values without interference from candlestick scaling.
Doubling the scaling of the 1-hour RSI (displayed in blue) addresses visibility concerns and ensures that it remains discernible even when compared to the other two RSIs: 4-hour RSI (orange) and 1-day RSI (green).
Bollinger Bands Module is optional, but is turned on as default. When the module is turned on, the users can see the upper Bollinger Band (green) and lower Bollinger Band (red) on the main chart to gain more insight into price actions of the candles.
User Flexibility
This dual-placement approach offers users the flexibility to choose their preferred visualization:
The main chart provides a comprehensive view of buy/sell signals in relation to candlestick patterns.
The area beneath the chart accommodates a detailed examination of RSI values, each in its own timeframe, without compromising visibility.
The chosen design optimizes visibility and usability, addressing the unique challenges posed by differing RSI scales and ensuring users can make informed decisions based on both price action and RSI dynamics.
Usage
Installation
To ensure you receive updates and enhancements seamlessly, follow these steps:
Open the TradingView platform.
Navigate to the "Indicators" tab in the top menu.
Click on "Community Scripts" and search for "Advanced Dynamic Threshold RSI Indicator."
Select the indicator from the search results and click on it to add to your chart.
This ensures that any future updates to the indicator can be easily applied, keeping you up-to-date with the latest features and improvements.
Review Code
Open TradingView and navigate to the Pine Editor.
Copy the provided script.
Paste the script into the Pine Editor.
Click "Add to Chart."
Configuration
The indicator offers several customizable settings:
RSI Length: Defines the length of the RSI calculation.
SMA Length: Sets the length of the SMA applied to the RSI.
Lookback Bars: Determines the number of bars used for recent performance analysis.
Threshold Multiplier: Adjusts the multiplier for dynamic threshold calculation.
Enable Bollinger Bands: Allows users to enable or disable Bollinger Bands integration.
Interpreting Signals
Buy Signal: Generated when RSI values are above dynamic thresholds and a crossover occurs.
Sell Signal: Generated when RSI values are below dynamic thresholds and a crossunder occurs.
Additional Information
The indicator plots scaled RSI lines for 1-hour, 4-hour, and 1-day timeframes.
Users can experiment with additional modules, such as machine-learning simulation, dynamic real-life improvements, or experimental signal filtering, depending on personal preferences.
Conclusion
The Advanced Dynamic Threshold RSI Indicator provides traders with a sophisticated tool for RSI-based analysis, offering a unique combination of dynamic thresholds, performance analysis, and optional Bollinger Bands integration. Traders can customize settings and experiment with additional modules to tailor the indicator to their trading strategy.
Disclaimer: Use of the Advanced Dynamic Threshold RSI Indicator
The Advanced Dynamic Threshold RSI Indicator is provided for educational and experimental purposes only. The indicator is not intended to be used as financial or investment advice. Trading and investing in financial markets involve risk, and past performance is not indicative of future results.
The creator of this indicator is not a financial advisor, and the use of this indicator does not guarantee profitability or specific trading outcomes. Users are encouraged to conduct their own research and analysis and, if necessary, consult with a qualified financial professional before making any investment decisions.
It is important to recognize that all trading involves risk, and users should only trade with capital that they can afford to lose. The Advanced Dynamic Threshold RSI Indicator is an experimental tool that may not be suitable for all individuals, and its effectiveness may vary under different market conditions.
By using this indicator, you acknowledge that you are doing so at your own risk and discretion. The creator of this indicator shall not be held responsible for any financial losses or damages incurred as a result of using the indicator.
Kind regards,
Ely
Test - Symbiotic Exiton Measure Enthropic Nexus indicatorThe Symbiotic Exiton Measure Enthropic Nexus (SEMEN) Indicator is a technical analysis tool used in trading and investing. It's name might sound complex, but its function is quite simple - to help traders make informed decisions about buying or selling stocks by predicting market trends.
The SEMEN indicator uses a combination of various factors such as volume, price action, moving averages, and other indicators to generate a single numerical value that represents the overall health of the market. A high reading indicates a strong uptrend, while a low one suggests a downtrend.
Traders can use this information to enter or exit positions with confidence.
In essence, the SEMEN indicator provides a comprehensive view of the market's sentiment and direction, making it an essential tool for any trader or investor looking to make profitable decisions in today's volatile stock markets.
~description generated with Airoboros7b
- The indicator is experimental so use at your own discretion..
TrendBars
This new bar system consists of candles connected to each other with trend lines.
I have defined a falling trend if the current peak is lower than the previous peak, and an rising trend if the current low is higher than the previous low.
When the series of lows or highs is broken, indicating a reversal in the trend, the candles change color. This provides a fresh perspective when monitoring the trend.
Continue to stay tuned for original concepts and many more new systems. Happy trading!
Zigzag Array ExperimentalThis is experimental script for zigzag which uses type, method and array. Not recommend for actual usage, for pine script study maybe useful.
In this experiment, I use type as coded below. It seems have limitation as specially when push as array. As Trading View recommendation, pushing float and int into array especially for type not guarantee to work. I agree with that. Preferred to push array as line or label especially for types.
// @type Used for point especially for array
// @field x int value for bar_index
// @field y float value for price
// @field sty label style
// @field col color for text label
// @field str high or low string
type point
int x = na
float y = na
string sty = na
color col = na
string str = na
I simulate the arrays as below.
var dirLine = array.new()
var dirLabel = array.new()
var dirPoint = array.new()
....
dirPoint.unshift(zigzag.createPoint(0))
dirLabel.unshift(zigzag.createLabel(fontSize, 0, true))
dirLine.unshift(zigzag.createLine(width, switchLine, 0, true))
Here are some results.
switches [experimental / tools]This scripts shows a tool which enables switching between settings without opening the settings
In this case you can switch between a RSI of 3 different tickers, 3 different higher timeframes, and 4 different lengths.
How does it work?
The position of a 'time line' is compared with the position of a box.
Changing the position of the line changes the settings.
The settings need to be set upfront though,
if you want to switch between length 7, 10, 14, 21 they need to be set first.
Example:
One wants to switch between RSI of SOLUSDT, ADAUSDT and FILUSDT
First set your tickers
-> Settings -> Set 1 -> Ticker
Then tap/click and move the line
And there you go!
The same with Timeframe and Length
Important:
It is not possible to automatically set the boxes/line at current time,
so these (settings -> date at Box, Line) need to be set in the beginning
Cheers!
Moving Averages 3DHello All,
This is an experimental work to show 10 moving averages in 3D by using linefill.new() feature of the Pine language.
You can set moving average type as Simple (SMA) or Exponential (EMA)
You can set "Starting Length" and set the "Step" to calculate other lengths. For example; if "Starting Length" is 10 and "step" is 5 then the lengths are 10, 15, 20, 25...
You can set the colors as Red, Green, Blue for each direction. And you can change the width. you can see the examples below
In following example Green and Blue used:
In following example Blue and Red is used and Width is set as 5:
Enjoy!
[RS]Dollar Composite IndexExperimental:
a composite of the dollar index with equal weights.
this is a repost of:
www.tradingview.com
WIPNNetworkLibrary "WIPNNetwork"
this is a work in progress (WIP) and prone to have some errors, so use at your own risk...
let me know if you find any issues..
Method for a generalized Neural Network.
network(x) Generalized Neural Network Method.
Parameters:
x : TODO: add parameter x description here
Returns: TODO: add what function returns
FunctionPatternDecompositionLibrary "FunctionPatternDecomposition"
Methods for decomposing price into common grid/matrix patterns.
series_to_array(source, length) Helper for converting series to array.
Parameters:
source : float, data series.
length : int, size.
Returns: float array.
smooth_data_2d(data, rate) Smooth data sample into 2d points.
Parameters:
data : float array, source data.
rate : float, default=0.25, the rate of smoothness to apply.
Returns: tuple with 2 float arrays.
thin_points(data_x, data_y, rate) Thin the number of points.
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
rate : float, default=2.0, minimum threshold rate of sample stdev to accept points.
Returns: tuple with 2 float arrays.
extract_point_direction(data_x, data_y) Extract the direction each point faces.
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
Returns: float array.
find_corners(data_x, data_y, rate) ...
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
rate : float, minimum threshold rate of data y stdev.
Returns: tuple with 2 float arrays.
grid_coordinates(data_x, data_y, m_size) transforms points data to a constrained sized matrix format.
Parameters:
data_x : float array, points x value.
data_y : float array, points y value.
m_size : int, default=10, size of the matrix.
Returns: flat 2d pseudo matrix.
Inverse Divergence [HeWhoMustNotBeNamed]Experimental.
In regular scenario divergence calculation follows these procedure
Pivots on price are considered as primary source
They are compared with pivots on oscillators
Trend bias of price is used
This is an experimental version where
Pivots on oscillators are considered as primary source
They are compared with pivots on price
Trend bias of oscillator is used. Using percentrank to define oscillator trend
Caution: Not meant for trading :)
Stock Dividend Periodicityexperimental:
a basic method to evaluate stock dividend periodicity.
known issues:
* it does not adapt well to changes in periodicity, if there is a big enough change on the dividend period plan.
Test - Gramian Angular FieldExperimental:
The Gramian Angular Field is usually used in machine learning for machine vision, it allows the encoding of data as a visual queue / matrix.
Conway's Game of Life [NOT AN INDICATOR]This is not an indicator, just for fun and testing out the new table functions.
Requires bar replay to calculate (quickly) one generation to the next.
A random pregen seed and a few other known seeds picked at random. The limited grid dimensions affect the outcome for some.
test - autocorrelation distributionexperimental:
shows the distribution for each shift in a autocorrelation.
test - autocorrelationExperimental:
finds and displays the wavelength index's of the autocorrelation wavelengths..
Adaptation of Kıvanç Özbilgiç's Turtle Trade PineScriptOops - I pasted this into my public published chart, so here it goes again.
Here's my first shot at learning PineScript. I have adapted Kıvanç Özbilgiç's Turtle Trade PineScript :
tr.tradingview.com
I've also added an 83-year semi-log detrended SP500 index, which is explained at :
www.billhowell.ca
RMI + Triple HMRSI + Double EVWRSI + TERSI + CMO StrategyThis is a strange experimental strategy WIP that I decided to upload an early version to share some of what I am working on. Just one script of a few.
It combines Chande Momentum with RMI and some weird ones I am experimenting with - Triple Hull MA RSI, Double Exponential + Volume Weighted RSI, Triple Exponential RSI. And to top it off, a final oscillator that combines the THMRSI with the RMI.
The main intention here, currently, is to test the usefulness of each on different timeframes and values. Currently it is considered to buy when all are below their threshold and sell when all are above, with the chande momentum crossing its line as the final confirmation.
For now there is no individual for each of the unique elements included. I am going to likely use this is a working house project to test other experimental indicators in the future.
It may be some of these are better suited for long term but I do think they have valid uses in checking short and long term momentum at the very least.
I copied the RMI from Everget.
Examples of Rolling Average Using Automated AnchoringIn this study, I present a method to expose NaN values to development environment.
This exposure allows NaN values to be used by methods in scripts.
I also show how to use values, even NaN values, as anchors from which statistics can be computed from.
I demonstrate how to do this with constants and variables in methods for computing the cumulative/rolling average of a series.
I also show how to calculate the cumulative/rolling average from the start of a ticker series using the aforementioned methods.
Each method has a description on how some of their parts work as well as their constraints.
Method #1 - Can only be used for computing the rolling average on the ticker series.
Method #2 - The simple moving average from the Pine Script reference.
- Can be used to calculate the rolling average of the ticker series and number values of a series.
- This method seems to cause an error when there are many bars in the series.
Method #3 - The most versatile method due to the use of computing the rolling average using an array.
- Timeout will occur when computing the rolling average of an entire ticker series which is long.
- Timeout has not occurred when computing a rolling average of a series from NaN or non-NaN anchor points even when the series is long.
This is an attempt to get around the constraints of the built-in sma(source, length) function in which length cannot be dynamically adjusted.
Other Pine Script functions have that constraint which we can get around by defining our own functions.