[BRAIN] Absolute Volatility of Price
Hello traders!
Today I want to share with you a series of scripts and strategies that I developed a few years ago. This is one of my first works, born from the curiosity of seeing a candlestick representation in a different way, without considering the price movement along the y-axis.
Imagine observing the price movement in dollars and percentages, always starting from the same reference point: the 0 axis. This approach can offer new insights and ideas on how and how much prices move.
To explain it better, the open of each candle does not start from the previous close negotiations but always starts from the 0 axis . In this way, it is possible to clearly compare the bodies of the candles with each other.
Script Visualization Methods and Input
- Study Normal: Simply reports the prices, including the negative ones of the red candles, on the same scale in absolute terms (ABS), as shown in the first indicator above.
- Study Normal Neg: In this version, the red candles vary negatively below zero, instead of in absolute terms above zero, as shown in the second indicator above.
- Study Perc: Similar to "Study Normal" but uses percentage values instead of dollars, useful for very low timeframes and low variations with many decimals, such as 1 minute on EUR/USD.
- Study Perc Neg: Similar to "Study Normal Neg" but uses percentage values.
Additionally, I have added the possibility to display or not, through two buttons, an average of the candle bodies adjustable in length via input and the range of each candle, always correlated in dollars or percentages, as per the main study setting.
I hope this work can be useful to many of you. I invite you to like if you appreciate my scripts and want to see more like these. Do not hesitate to comment or contact me for any doubts or questions.
PS: If you notice that in the script the sum of the percentage values between the shadow and the body of the candle does not correspond to the range, it is only a rounding issue. Change the precision setting to a lower value and you will see that the rounding disappears.
PS: In the script, to better visualize the percentage growth and decline of the instrument on very high timeframes, I decided to represent it as follows:
- If close ≥ open: (high - low) / low * 100
- If close < open: (high - low) / high * 100
The same method is also applied for calculating the percentage variations of the shadows relative to themselves.
I hope you like this version! If you need any further modifications or adjustments, let me know. Good luck with your project!
(In the photos below I show 3 versions of the indicator open on 3 different tickers as an example: from top to bottom in the 3 indicators are set these Study: Study Normal, Study Perc and Study Perc Neg)
Tradingpatterns
Worm *Public*This Pine Script code is designed to create a custom technical indicator called "Worm" that helps identify trends in the market based on momentum. Let's break down the code and its settings:
Indicator Title and Overlay:
The indicator is named "Worm (Clean)" and is set to be overlaid on the price chart.
Input Settings:
The code defines various input settings, which can be customized by the user. These settings include:
Indicator Settings (e.g., Alpha, Gap)
Backtest Settings (e.g., HighlightCrossovers, ApplyNorm)
Color Settings (e.g., Buy Color, Sell Color, Wait Color)
Location Settings for displaying the indicator above, below, or at the price.
Toggleable Inputs:
These settings allow you to choose whether the momentum indicator should be displayed above, below, or at the price chart. You can also specify the colors for buy, sell, and wait signals.
Indicator Calculations:
The code calculates momentum using various formulas involving the source price data (e.g., open, high, low, close). Momentum values are stored in variables L0, L1, L2, L3, and lrsi.
It also calculates the Color values for the indicator based on certain conditions and user-defined settings.
Bcolor and Scolor are used to determine the color of the plotted indicator based on buy and sell conditions.
Bollinger Bands (BB) and Keltner Channels (KC) Calculation:
The code calculates Bollinger Bands (UpperBB and LowerBB) and Keltner Channels (UpperKC and LowerKC) using the source price data.
It also determines whether the market is in a squeeze (SqzOn) or not (NoSqz) based on the relationship between BB and KC.
Signal Generation:
Buy and sell signals are generated based on various conditions, including momentum values and the squeeze state.
The color of the indicator line is determined based on the buy and sell signals.
LagF Calculation:
The LagF variable is calculated based on certain formulas involving the L0Line, L1Line, L2Line, and L3Line values.
Control Color:
The Color variable is used to control the color of the LagF indicator line based on certain conditions.
Plotting:
The momentum indicator (Val) is plotted on the chart with the specified colors and style.
The LagF indicator (Worm) is also plotted with a dynamic color based on market conditions.
Alerts are triggered when buy or sell signals are generated.
Experimental Section:
This section appears to be left for experimentation and may contain additional code or features.
Overall, this Pine Script code calculates and displays a custom momentum-based indicator called "Worm" on a price chart. It generates buy and sell signals based on momentum and squeeze conditions and allows users to customize various settings, including indicator location and colors. The code is designed for technical analysis and trend identification in financial markets.