Range PercentageRange Percentage is a simple indicator utility to clearly display and dynamically alert on where a chosen series falls between two bounds, either series themselves or constant values.
To set up, select between series or value for upper and lower bounds. Only the chosen options will be used by the indicator, though you may enter the non-selected option. Configure the thresholds if you wish to use them for visual display or alerting. If you only care about the background color, disable both thresholds and the percentage line and move the indicator into the main pane.
Some sample use cases:
Coloring background on a zoomed-in chart to show to show price change relative to the entire value of an asset, not just the range selected on the y-axis
Get alerts which adjust dynamically as price approaches another series or dynamic value
Determine at a glance where a price falls between your identified support/resistance lines, no matter where you zoom or scroll
Compare relative gain of two assets
Identify trends of a price closing closer to low or high over time
This indicator is often most useful in conjunction with other indicators which produce a plotted series output and can save a lot of time thinking or interpreting. Its usefulness to a trader depends entirely on the rationale for choosing a lower/upper bound and sample series that are meaningful to that trader.
Statistics
Kalman Filter by TenozenAnother useful indicator is here! Kalman Filter is a quantitative tool created by Rudolf E. Kalman. In the case of trading, it can help smooth out the price data that traders observe, making it easier to identify underlying trends. The Kalman Filter is particularly useful for handling price data that is noisy and unpredictable. As an adaptive-based algorithm, it can easily adjust to new data, which makes it a handy tool for traders operating in markets that are prone to change quickly.
Many people may assume that the Kalman Filter is the same as a Moving Average, but that is not the case. While both tools aim to smooth data and find trends, they serve different purposes and have their own sets of advantages and disadvantages. The Kalman Filter provides a more dynamic and adaptive approach, making it suitable for real-time analysis and predictive capabilities, but it is also more complex. On the other hand, Moving Averages offer a simpler and more intuitive way to visualize trends, which makes them a popular choice among traders for technical analysis. However, the Moving Average is a lagging indicator and less adaptive to market change, if it's adjusted it may result in overfitting. In this case, the Kalman Filter would be a better choice for smoothing the price up.
I hope you find this indicator useful! It's been an exciting and extensive journey since I began diving into the world of finance and trading. I'll keep you all updated on any new indicators I discover that could benefit the community in the future. Until then, take care, and happy trading! Ciao.
MTF TREND-PANEL-(AS)
0). INTRODUCTION: "MTF TREND-PANEL-(AS)" is a technical tool for traders who often perform multi-timeframe analysis.
This simple tool is meant for traders who wish to monitor and keep track of trend directions simultaneously on various timeframes, ranging from 1MIN to 3MONTHS (or other - 'DIFF')
script enhances decision-making efficiency and provides a clearer picture of market condition by integrating multiple timeframe analysis into a single panel.
1). WARNING!:
-script doesn't make any calculations on its own really but is more of a tool for traders to remember what is happening on other time frames
- use tooltips to navigate settings easier
2). MAIN OPTIONS:
- Keeps track of up to 7 timeframes. (NUMBER of TimeFrames setting, from 1-7)
- Customizable Display: Choose to display nothing, upward/downward arrows, or a range indication for each timeframe.
- timeframe options: '1-MIN','5-MIN','15-MIN','30-MIN','1H','4H','1D','1W','1M','3M','DIFF'
- Color Coding: Define your preferred colors for each timeframe
- set position of the table and size of text (Position/text)
- Personal Touch: Add your own trading maxim or motto for inspiration to show up when SHOW TEXT is turned on
3. )OPTIONS:
-NUMBER of TimeFrames setting: from 1-7 - how many rows to show
-SHOW TABLE: Toggle to display or hide the trend table panel.
-SHOW TEXT: Show or hide your personalized trading maxim.
-SHOW TREND: Enable to display trend direction arrows.
-SHOW_CLRS: Turn on to activate color coding for each timeframe.
-position/text size for table
-settings for each timeframe:color,time,trend
-place to type ur own text
5). How to Use the Script:
-After adding the script to your chart, use the 'NUMBER of TimeFrames' setting to select how many timeframes you want to track (1 to 7).
-Customize the appearance of each timeframe row using the color and arrow options.
-For trend analysis, the script offers arrows to indicate upward, downward, or ranging markets.
-decide what trend dominates particular TF (using other tools - script does not calculate trend on its own )
- mark trends on panel to keep track of all TF
-Enable or disable various features like the table panel, trader maxim, and color coding using the ON/OFF options.
6). just in case:
- ask me anything about the code
-don't be shy to report any bugs or offer improvements of any kind.
- originally created for @ict_whiz and made public at his request
Commitments of Traders Report [Advanced]This indicator displays the Commitment of Traders (COT) report data in a clear, table format similar to an Excel spreadsheet, with additional functionalities to analyze open interest and position changes. The COT report, published weekly by the Commodity Futures Trading Commission (CFTC), provides valuable insights into market sentiment by revealing the positioning of various trader categories.
Display:
Release Date: When the data was released.
Open Interest: Shows the total number of open contracts for the underlying instrument held by selected trader category.
Net Contracts: Shows the difference between long and short positions for selected trader category.
Long/Short OI: Displays the long and short positions held by selected trader category.
Change in Long/Short OI: Displays the change in long and short positions since the previous reporting period. This can highlight buying or selling pressure.
Long & Short Percentage: Displays the percentage of total long and short positions held by each category.
Trader Categories (Configurable)
Commercials: Hedgers who use futures contracts to manage risk associated with their underlying business (e.g., producers, consumers).
Non-Commercials (Large Speculators): Speculative traders with large positions who aim to profit from price movements (e.g., hedge funds, investment banks).
Non-Reportable (Small Speculators/Retail Traders): Smaller traders with positions below the CFTC reporting thresholds.
CFTC Code: If the indicator fails to retrieve data, you can manually enter the CFTC code for the specific instrument. The code for instrument can be found on CFTC's website.
Using the Indicator Effectively
Market Sentiment Gauge: Analyze the positioning of each trader category to gauge overall market sentiment.
High net longs by commercials might indicate a bullish outlook, while high net shorts could suggest bearish sentiment.
Changes in open interest and long/short positions can provide additional insights into buying and selling pressure.
Trend Confirmation: Don't rely solely on COT data for trade signals. Use it alongside price action and other technical indicators for confirmation.
Identify Potential Turning Points: Extreme readings in COT data, combined with significant changes in open interest or positioning, might precede trend reversals, but exercise caution and combine with other analysis tools.
Disclaimer
Remember, the COT report is just one piece of the puzzle. It should not be used for making isolated trading decisions. Consider incorporating it into a comprehensive trading strategy that factors in other technical and fundamental analysis.
Credit
A big shoutout to Nick from Transparent FX ! His expertise and thoughtful analysis have been a major inspiration in developing this COT Report indicator. To know more about this indicator and how to use it, be sure to check out his work.
Genuine Liquidation Delta [Mxwll] - No EstimatesTHANK YOU TradingView for allowing us to upload custom data!!!
As a result, Mxwll Capital is providing an indicator that shows REAL liquidation delta for over 100 cryptocurrencies sourced directly from a popular crypto exchange!
Features
Crypto exchange sourced liquidation delta
Crypto exchange sourced long liquidation daily count
Crypto exchange sourced short liquidation daily count
All provided data extends back 2 years!!
Various aesthetic components to illustrate data
Liquidation delta data (sourced from a popular exchange) is provided for:
1000shib
aave
ada
algo
alice
arb
audio
alpha
ankr
ape
apt
atom
avax
axs
bal
band
bat
bch
bel
blz
blur
bnb
bnx
btc
chr
chz
comp
coti
crv
ctk
dash
defi
doge
dot
dydx
edu
egld
enj
ens
eos
etc
eth
fil
flm
ftm
fxs
gala
gmx
grt
hbar
hnt
icx
id
inj
iost
iota
joe
kava
knc
ksm
ldo
lina
link
lit
lrc
ltc
mana
mask
matic
mkr
near
neo
ocean
omg
one
ont
op
people
qtum
reef
ren
rndr
rose
rlc
rsr
rune
rvn
sand
sfp
skl
snx
sol
stmx
storj
sui
sushi
sxp
theta
tomo
trb
trx
unfi
uni
vet
waves
xem
xlm
xmr
xrp
xtz
yfi
zec
zen
zil
zrx
How-To
The image above shows the indicator with default settings.
The image above shows the start point of our data!
Over 2-years of data, allowing for plentiful analysis!
The image above explains the primary plot.
Filled blue columns reflect liquidation delta exceeding the long side. When the liquidation delta plot is aqua and exceeds 0 to the upside, longs were liquidated more than shorts for the
day.
Filled red columns reflect liquidation delta exceeding the short side. When the liquidation delta plot is red and exceeds 0 to the downside, shorts were liquidated more than longs for the day.
The image above explains the solid line (polyline) plot and its intentions!
Filled, solid, blue line reflects the total number of long liquidation events for the period.
Filled, solid, red line reflects the total number of short liquidation events for the period.
Keep in mind that the total number of liquidation events is normalized to plot alongside the total liquidation delta for the day. So, there aren't "millions" of liquidation events taking place, the total liquidation count for the long and short side is simply normalized to fit atop total liquidation delta.
The image above explains the liquidation count meter the indicator provides!
The left (blue columns) reflect the intensity of long liquidation events for the day. The right (red columns) reflect the intensity of short liquidation events for the day.
The "Max" numbers at the top show the maximum number of long liquidation events, or short liquidation events, for their respective columns.
Therefore, if the number of long liquidation events were "1.241k", as stated for this cryptocurrency in the table, the blue meter would be full. Similar logic applies to the red meter.
Once more, THANK YOU @TradingView and @PineCoders for allowing us to upload custom data! This project wouldn't be possible without it!
Semaphore PlotThe Semaphore Plot V2, crafted by OmegaTools for the TradingView platform, is a sophisticated technical analysis tool designed to offer traders nuanced insights into market dynamics. This closed-source script embodies a novel approach by synthesizing multiple technical analysis methodologies into a coherent analytical framework. This detailed description aims to demystify the operational essence of the Semaphore Plot V2 and elucidate its application in trading scenarios without overstepping into claims of infallibility or price prediction accuracy.
Analytical Foundations and Integration:
At its core, the Semaphore Plot V2 is founded on the integration of several analytical dimensions, each contributing to a comprehensive market overview:
1. Dynamic Trend Analysis: Unlike conventional trend indicators that might rely solely on moving averages, the Semaphore Plot V2 examines the market's direction through a more complex lens. It assesses momentum, utilizing derivatives of price movements to understand the velocity and acceleration of trends. This analysis is deepened by examining the rate of change (ROC), providing a multi-tiered view of how swiftly market conditions are evolving.
2. Volatility Insights: Recognizing volatility as a pivotal component of market behavior, the script incorporates volatility metrics to analyze market conditions. By evaluating historical price ranges and applying statistical models, it aims to gauge the potential for future price fluctuations, thus offering insights into market stability or turbulence without predicting specific movements.
3. Linear Regression and Predictive Analysis: The script utilizes linear regression to analyze price data points over a specified period, offering a statistical basis to understand the trajectory of market trends. This regression analysis is complemented by market momentum indicators, forming a predictive model that suggests potential areas where market activity might concentrate. It's important to note that these "predictions" are not certainties but rather statistically derived zones of interest based on historical data.
4. Market Sentiment and Risk Evaluation: Incorporating an evaluation of market sentiment, the script analyzes trends in trading volume and price action to deduce the prevailing market mood. Risk assessment tools, such as the analysis of statistical deviations and Value at Risk (VaR), are also applied to offer a perspective on the risk associated with current market conditions.
Operational Mechanism:
- By processing the integrated analysis, the script generates semaphore signals which are plotted on the trading chart. These signals are not direct buy or sell signals but are designed to highlight areas where, based on the script’s complex analysis, market activity might see significant developments.
- Additionally, the Semaphore Plot V2 features an information table that provides a retrospective analysis of the signals' alignment with market movements, offering traders a tool to assess the script's historical context.
Application and Utility:
- Traders can leverage the Semaphore Plot V2 by applying it to their TradingView charts and adjusting input settings such as lookback periods and sensitivity according to their preferences.
- The semaphore signals serve as markers for areas of potential interest. Traders are encouraged to interpret these signals within the context of their overall market analysis, incorporating other fundamental and technical analysis tools as necessary.
- The informational table serves as a resource for evaluating the historical context of the signals, providing an additional layer of insight for informed decision-making.
The Essence of Originality:
The Semaphore Plot V2 distinguishes itself through the innovative melding of traditional technical analysis components into a unique analytical concoction. This originality lies not in the creation of new technical indicators but in the novel integration and application of existing methodologies to offer a holistic view of market conditions.
Responsible Usage Disclaimer:
The financial markets are characterized by uncertainty, and the Semaphore Plot V2 is intended to serve as an analytical tool within a trader's arsenal, not a standalone solution for trading decisions. It is critical for users to understand that the script does not guarantee trading success nor does it claim to predict exact price movements. Traders should employ the Semaphore Plot V2 alongside comprehensive market analysis and sound risk management practices, acknowledging that past performance is not indicative of future results and that trading involves the risk of loss.
Trading TP SL Risk Commission Calculator🎉 Introducing Your Trading TP SL Risk Commission Calculator! 🎉
Hey there, savvy trader! 🚀 Are you looking to enhance your trading game? Meet the Trading TP SL Risk Commission Calculator! This handy tool is here to guide you through the complexities of trading, providing insights into your potential risks and rewards. Let's walk through how you can leverage it for smarter trading decisions!
Setting Up 🛠
Let's get your calculator ready for action:
Lines and Labels Visibility: Flip this switch on to see your Entry, Take Profit (TP), Stop Loss (SL), and Liquidation points displayed on your chart. It's a great way to get a visual summary of your strategy.
Input Your Trade Details: Enter your Entry Price, Take Profit Price, and Stop Loss Price. These figures are crucial for mapping out your trade.
Order Info: Specify your Order Size in USD, the amount of Leverage you're using, and your platform's Commission Rate. This customizes the calculator to fit your unique trading setup.
Customizing Your View 🎨
Table Placement & Size: Pick the location and size for your results table to appear on your screen. Tailor it to your liking, whether you prefer it out of the way or front and center.
Deciphering Your Results 📊
With your inputs in place, the calculator springs into action. Here's what you'll find:
Risk Assessment (with Emojis!): Quickly gauge your risk level with our intuitive emoji system, ranging from "⛔️⛔️⛔️" (very high risk) to "✅✅✅" (very low risk).
Profit and Loss Insights: Understand your potential take-profit gains and stop-loss implications, both as percentages and in USD. We also factor in fees to give you a clear picture.
Liquidation Alert: For those using leverage, the liquidation price calculation is crucial to avoid unpleasant surprises.
Expert Tips 💡
Stay Flexible: Market conditions evolve, so should your strategy. Revisit and adjust your inputs regularly to stay aligned with your trading goals.
Risk Emoji Check: Keep an eye on your risk level emojis. A sea of "⛔️" might signal it's time to reassess your approach.
Use Visual Guides: The on-chart lines and labels offer a quick visual reference to how your current trade measures up against your TP, SL, and liquidation thresholds.
Dive In and Trade Smart! 🚦
This calculator isn't just about making calculations; it's about empowering you to make informed trading decisions. With this tool in your arsenal, you're equipped to navigate the trading waters with confidence and clarity.
Risk Management Chart█ OVERVIEW
Risk Management Chart allows you to calculate and visualize equity and risk depend on your risk-reward statistics which you can set at the settings.
This script generates random trades and variants of each trade based on your settings of win/loss percent and shows it on the chart as different polyline and also shows thick line which is average of all trades.
It allows you to visualize and possible to analyze probability of your risk management. Be using different settings you can adjust and change your risk management for better profit in future.
It uses compound interest for each trade.
Each variant of trade is shown as a polyline with color from gradient depended on it last profit.
Also I made blurred lines for better visualization with function :
poly(_arr, _col, _t, _tr) =>
for t = 1 to _t
polyline.new(_arr, false, false, xloc.bar_index, color.new(_col, 0 + t * _tr), line_width = t)
█ HOW TO USE
Just add it to the cart and expand the window.
█ SETTINGS
Start Equity $ - Amount of money to start with (your equity for trades)
Win Probability % - Percent of your win / loss trades
Risk/Reward Ratio - How many profit you will get for each risk(depends on risk per trade %)
Number of Trades - How many trades will be generated for each variant of random trading
Number of variants(lines) - How many variants will be generated for each trade
Risk per Trade % -risk % of current equity for each trade
If you have any ask it at comments.
Hope it will be useful.
Aroon and ASH strategy - ETHERIUM [IkkeOmar]Intro:
This post introduces a Pine Script strategy, as an example if anyone needs a push to get started. This example is a strategy on ETH, obviously it isn't a good strategy, and I wouldn't share my own good strategies because of alpha decay. This strategy combines two technical indicators: Aroon and Absolute Strength Histogram (ASH).
Overview:
The strategy employs the Aroon indicator alongside the Absolute Strength Histogram (ASH) to determine market trends and potential trade setups. Aroon helps identify the strength and direction of a trend, while ASH provides insights into the strength of momentum. By combining these indicators, the strategy aims to capture profitable trading opportunities in Ethereum markets. Normally when developing strats using indicators, you want to find some good indicators, but you NEED to understand their strengths and weaknesses, other indicators can be incorporated to minimize the downs of another indicator. Try to look for synergy in your indicators!
Indicator settings:
Aroon Indicator:
- Two sets of parameters are used for the Aroon indicator:
- For Long Positions: Aroon periods are set to 56 (upper) and 20 (lower).
- For Short Positions: Aroon periods are set to 17 (upper) and 55 (lower).
Absolute Strength Histogram (ASH):
ASH is calculated with a length of 9 bars using the closing price as the data source.
Trading Conditions:
The strategy incorporates specific conditions to initiate and exit trades:
Start Date:
Traders can specify the start date for backtesting purposes.
Trade Direction:
Traders can select the desired trade direction: Long, Short, or Both.
Entry and Exit Conditions:
1. Long Position Entry: A long position is initiated when the Aroon indicator crosses over (crossover) the lower Aroon threshold, indicating a potential uptrend.
2. Long Position Exit: A long position is closed when the Aroon indicator crosses under (crossunder) the lower Aroon threshold.
3. Short Position Entry: A short position is initiated when the Aroon indicator crosses under (crossunder) the upper Aroon threshold, signaling a potential downtrend.
4. Short Position Exit: A short position is closed when the Aroon indicator crosses over (crossover) the upper Aroon threshold.
Disclaimer:
THIS ISN'T AN OPTIMAL STRATEGY AT ALL! It was just an old project from when I started learning pine script!
The backtest doesn't promise the same results in the future, always do both in-sample and out-of-sample testing when backtesting a strategy. And make sure you forward test it as well before implementing it!
Difference from Highest Price (Last N Candles)The output of this TradingView indicator is a label that appears below the latest candle on the chart. This label provides information about:
The highest high of the last N candles.
The highest close of the last N candles.
The current trading price.
The percentage difference between the highest high and the current trading price.
The percentage difference between the highest close and the current trading price.
The percentage change in price from the previous candle.
The N-day average percentage change.
This information is useful for traders to understand the relationship between the current price and recent price action, as well as to identify potential overbought or oversold conditions based on the comparison with recent highs and closes.
Here's a breakdown of what the code does:
It takes an input parameter for the number of days (or candles) to consider (input_days).
It calculates the highest high and highest close of the last N candles (highest_last_n_high and highest_last_n_close).
It calculates the difference between the close of the current candle and the close of the previous candle (diff), along with the percentage change.
It maintains an array of percentage changes of the last N days (percentage_changes), updating it with the latest percentage change.
It calculates the sum of percentage changes and the N-day average percentage change.
It calculates the difference between the highest high/highest close of the last N candles and the current trading price, along with their percentage differences.
Finally, it plots this information as a label below the candle for the latest bar.
Blockunity Miners Synthesis (BMS)Track the status of Bitcoin and Ethereum Miners' Netflows and their asset reserves.
The Idea
The goal is to provide a simple tool for visualizing the changes in miners' flows and reserves.
How to Use
Analysing the behaviour of miners enables you to detect long-term opportunities, in particular with the state of reserves, but also in the shorter term with the visualization of Netflows.
Elements
Miners Reserves
Miners Reserves represent the balances of addresses belonging to mining pools (in BTC or ETH).
This data can also be displayed in USD via the indicator parameters:
Miners Netflow
The Netflow is calculated by subtracting the outflows from the inflows originating from addresses associated with mining pools. When this result is negative, it indicates that more funds are exiting the miners' accounts than the funds they are receiving. Consequently, negative miner netflows suggests selling activity.
This data can also be displayed in USD via the indicator parameters. You can also choose the timeframe. For example, selecting "Yearly" will give a Netflow daily average taking into account the last 365 days:
Settings
In the settings, you can first choose which asset to view, between Bitcoin and Ethereum. Here are the reserves of Ethereum miners:
As with Bitcoin, Netflow can also be displayed in the timeframe of your choice. Here you can see the average daily netflow of Ethereum miners in USD over the last 30 days:
Here are all the parameters:
Asset Selector: Choose between Bitcoin or Ethereum miner data.
Get values in USD: Displays values in USD instead of assets.
Switch between Netflow and Reserve : If checked, displays Miners' Reserves data. If unchecked, displays Miners' Netflow data.
Display timeframe: Allows you to select the timeframe for displaying the Netflow plot.
Period Lookback (in days): Select the period to be taken into account when calculating the variation percentage of Miners' Reserves.
Lastly, you can modify all table and labels parameters.
Bitcoin Leverage Sentiment - Strategy [presentTrading]█ Introduction and How it is Different
The "Bitcoin Leverage Sentiment - Strategy " represents a novel approach in the realm of cryptocurrency trading by focusing on sentiment analysis through leveraged positions in Bitcoin. Unlike traditional strategies that primarily rely on price action or technical indicators, this strategy leverages the power of Z-Score analysis to gauge market sentiment by examining the ratio of leveraged long to short positions. By assessing how far the current sentiment deviates from the historical norm, it provides a unique lens to spot potential reversals or continuation in market trends, making it an innovative tool for traders who wish to incorporate market psychology into their trading arsenal.
BTC 4h L/S Performance
local
█ Strategy, How It Works: Detailed Explanation
🔶 Data Collection and Ratio Calculation
Firstly, the strategy acquires data on leveraged long (**`priceLongs`**) and short positions (**`priceShorts`**) for Bitcoin. The primary metric of interest is the ratio of long positions relative to the total of both long and short positions:
BTC Ratio=priceLongs / (priceLongs+priceShorts)
This ratio reflects the prevailing market sentiment, where values closer to 1 indicate a bullish sentiment (dominance of long positions), and values closer to 0 suggest bearish sentiment (prevalence of short positions).
🔶 Z-Score Calculation
The Z-Score is then calculated to standardize the BTC Ratio, allowing for comparison across different time periods. The Z-Score formula is:
Z = (X - μ) / σ
Where:
- X is the current BTC Ratio.
- μ is the mean of the BTC Ratio over a specified period (**`zScoreCalculationPeriod`**).
- σ is the standard deviation of the BTC Ratio over the same period.
The Z-Score helps quantify how far the current sentiment deviates from the historical norm, with high positive values indicating extreme bullish sentiment and high negative values signaling extreme bearish sentiment.
🔶 Signal Generation: Trading signals are derived from the Z-Score as follows:
Long Entry Signal: Occurs when the BTC Ratio Z-Score crosses above the thresholdLongEntry, suggesting bullish sentiment.
- Condition for Long Entry = BTC Ratio Z-Score > thresholdLongEntry
Long Exit/Short Entry Signal: Triggered when the BTC Ratio Z-Score drops below thresholdLongExit for exiting longs or below thresholdShortEntry for entering shorts, indicating a shift to bearish sentiment.
- Condition for Long Exit/Short Entry = BTC Ratio Z-Score < thresholdLongExit or BTC Ratio Z-Score < thresholdShortEntry
Short Exit Signal: Happens when the BTC Ratio Z-Score exceeds the thresholdShortExit, hinting at reducing bearish sentiment and a potential switch to bullish conditions.
- Condition for Short Exit = BTC Ratio Z-Score > thresholdShortExit
🔶Implementation and Visualization: The strategy applies these conditions for trade management, aligning with the selected trade direction. It visualizes the BTC Ratio Z-Score with horizontal lines at entry and exit thresholds, illustrating the current sentiment against historical norms.
█ Trade Direction
The strategy offers flexibility in trade direction, allowing users to choose between long, short, or both, depending on their market outlook and risk tolerance. This adaptability ensures that traders can align the strategy with their individual trading style and market conditions.
█ Usage
To employ this strategy effectively:
1. Customization: Begin by setting the trade direction and adjusting the Z-Score calculation period and entry/exit thresholds to match your trading preferences.
2. Observation: Monitor the Z-Score and its moving average for potential trading signals. Look for crossover events relative to the predefined thresholds to identify entry and exit points.
3. Confirmation: Consider using additional analysis or indicators for signal confirmation, ensuring a comprehensive approach to decision-making.
█ Default Settings
- Trade Direction: Determines if the strategy engages in long, short, or both types of trades, impacting its adaptability to market conditions.
- Timeframe Input: Influences signal frequency and sensitivity, affecting the strategy's responsiveness to market dynamics.
- Z-Score Calculation Period: Affects the strategy’s sensitivity to market changes, with longer periods smoothing data and shorter periods increasing responsiveness.
- Entry and Exit Thresholds: Set the Z-Score levels for initiating or exiting trades, balancing between capturing opportunities and minimizing false signals.
- Impact of Default Settings: Provides a balanced approach to leverage sentiment trading, with adjustments needed to optimize performance across various market conditions.
Moving Average PropertiesThis indicator calculates and visualizes the Relative Smoothness (RS) and Relative Lag (RL) or call it accuracy of a selected moving average (MA) in comparison to the SMA of length 2 (the lowest possible length for a moving average and also the one closest to the price).
Median RS (Relative Smoothness):
Interpretation: The median RS represents the median value of the Relative Smoothness calculated for the selected moving average across a specified look-back period (max bar lookback is set at 3000).
Significance: A more negative (larger) median RS suggests that the chosen moving average has exhibited smoother price behavior compared to a simple moving average over the analyzed period. A less negative value indicates a relatively choppier price movement.
Median RL (Relative Lag):
Interpretation: The median RL represents the median value of the Relative Lag calculated for the selected moving average compared to a simple moving average of length 2.
Significance: A higher median RL indicates that the chosen moving average tends to lag more compared to a simple moving average. Conversely, lower values suggest less lag in the selected moving average.
Ratio of Median RS to Median RL:
Interpretation: This ratio is calculated by dividing the median RS by the median RL.
Significance: Traders might use this ratio to assess the balance between smoothness and lag in the chosen moving average. This a measure of for every % of lag what is the smoothness achieved. This can be used a benchmark to decide what length to choose for a MA to get an equivalent value between two stocks. For example a TESLA stock on a 15 minute time frame with a length of 12 has a value (ratio of RS/RL) of -150 , where as APPLE stock of length 35 on a 15 minute chart also has a value (ratio of RS/RL) of -150.
I imply that a MA of length 12 working on TESLA stock is equivalent to MA of length 35 on a APPLE stock. (THIS IS A EXAMPLE).
My assumption is that finding the right moving average length for a stock isn't a one-size-fits-all situation. It's not just about using a fixed length; it's about adapting to the unique characteristics of each stock. I believe that what works for one stock might not work for another because they have different levels of smoothness or lag in their price movements. So, instead of applying the same length to all stocks, I suggest adjusting the length of the moving average to match the values that we know work best for achieving the desired smoothness or lag or its ratio (RS/RL). This way, we're customizing the indicator for each stock, tailoring it to their individual behaviors rather than sticking to a one-size-fits-all approach.
Users can choose from various types of moving averages (EMA, SMA, WMA, VWMA, HMA) and customize the length of the moving average. RS measures the smoothness of the MA, while RL measures its lag compared to a simple moving average. The script plots the median RS and RL values, the selected MA, and the ratio of median RS to median RL on the price chart. Traders can use this information to assess the performance of different moving averages and potentially inform their trading decisions.
ATR Grid Levels [By MUQWISHI]▋ INTRODUCTION :
The “ATR Levels” produces a sequence of horizontal line levels above and below the Center Line (reference level). They are sized based on the instrument's volatility, representing the average historical price movement on a selected higher timeframe using the average true range (ATR) indicator.
_______________________
▋ OVERVIEW:
_______________________
▋ IMPLEMENTATION:
The indicator starts by drawing a Center Line that is selected by the user from a variety of common levels. Then, it draws a sequence of horizontal lines above and below the Center Line, which are sized based on the most confirmed average true range (ATR) at the selected higher timeframe.
In the top right corner of the chart, there is a table displaying both the selected ATR (in the right cell) and the ATR of the current bar (in the left cell). This feature enables users to compare these two values. It's important to note that the ATR of the current bar may not be confirmed yet, as the market is still active.
_______________________
▋ INDICATOR SETTINGS:
# Section (1): ATR Settings
(1) ATR Period & Smoothing.
(2) Timeframe where ATR value imported from.
(3) To show/hide the table comparison between the current ATR and the ATR for the selected period. Also, ability to color the current ATR cell if it’s greater.
# Section (2): Levels Settings
(1) Selecting a Center Line level among a variety of common levels, which is taken as reference level where a sequence of horizontal lines plot above and below it.
(2) Size of grid in ATR unit.
(3) Number of horizontal lines to plot in a single side.
(4) Grid Side. Ability to plot above or below the Center Line.
(5) Lines colors, and mode.
(6) Line style.
(7) Label style.
(8) Ability to remove old lines, from previous HTF.
_____________________
▋ COMMENT:
The ATR Levels should not be taken as a major concept to build a trading decision.
Please let me know if you have any questions.
Thank you.
Octopus Nest Strategy Hello Fellas,
Hereby, I come up with a popular strategy from YouTube called Octopus Nest Strategy. It is a no repaint, lower timeframe scalping strategy utilizing PSAR, EMA and TTM Squeeze.
The strategy considers these market factors:
PSAR -> Trend
EMA -> Trend
TTM Squeeze -> Momentum and Volatility by incorporating Bollinger Bands and Keltner Channels
Note: As you can see there is a potential improvement by incorporating volume.
What's Different Compared To The Original Strategy?
I added an option which allows users to use the Adaptive PSAR of @loxx, which will hopefully improve results sometimes.
Signals
Enter Long -> source above EMA 100, source crosses above PSAR and TTM Squeeze crosses above 0
Enter Short -> source below EMA 100, source crosses below PSAR and TTM Squeeze crosses below 0
Exit Long and Exit Short are triggered from the risk management. Thus, it will just exit on SL or TP.
Risk Management
"High Low Stop Loss" and "Automatic High Low Take Profit" are used here.
High Low Stop Loss: Utilizes the last high for short and the last low for long to calculate the stop loss level. The last high or low gets multiplied by the user-defined multiplicator and if no recent high or low was found it uses the backup multiplier.
Automatic High Low Take Profit: Utilizes the current stop loss level of "High Low Stop Loss" and gets calculated by the user-defined risk ratio.
Now, follows the bunch of knowledge for the more inexperienced readers.
PSAR: Parabolic Stop And Reverse; Developed by J. Welles Wilders and a classic trend reversal indicator.
The indicator works most effectively in trending markets where large price moves allow traders to capture significant gains. When a security’s price is range-bound, the indicator will constantly be reversing, resulting in multiple low-profit or losing trades.
TTM Squeeze: TTM Squeeze is a volatility and momentum indicator introduced by John Carter of Trade the Markets (now Simpler Trading), which capitalizes on the tendency for price to break out strongly after consolidating in a tight trading range.
The volatility component of the TTM Squeeze indicator measures price compression using Bollinger Bands and Keltner Channels. If the Bollinger Bands are completely enclosed within the Keltner Channels, that indicates a period of very low volatility. This state is known as the squeeze. When the Bollinger Bands expand and move back outside of the Keltner Channel, the squeeze is said to have “fired”: volatility increases and prices are likely to break out of that tight trading range in one direction or the other. The on/off state of the squeeze is shown with small dots on the zero line of the indicator: red dots indicate the squeeze is on, and green dots indicate the squeeze is off.
EMA: Exponential Moving Average; Like a simple moving average, but with exponential weighting of the input data.
Don't forget to check out the settings and keep it up.
Best regards,
simwai
---
Credits to:
@loxx
@Bjorgum
@Greeny
Machine Learning Cross-Validation Split & Batch HighlighterThis indicator is designed for traders and analysts who employ Machine Learning (ML) techniques for cross-validation in financial markets.
The script visually segments a selected range of historical price data into splits and batches, helping in the assessment of model performance over different market conditions.
User
Theory
In ML, cross-validation is a technique to assess the generalizability of a model, typically by partitioning the data into a set of "folds" or "splits." Each split acts as a validation set, while the others form the training set. This script takes a unique approach by considering the sequential nature of financial time series data, where random shuffling of data (as in traditional cross-validation) can disrupt the temporal order, leading to misleading results.
Chronological Integrity of Splits
Even if the order of the splits is shuffled for cross-validation purposes, the data within each split remains in its original chronological sequence. This feature is crucial for time series analysis, as it respects the inherent order-dependency of financial markets. Thus, each split can be considered a microcosm of market behavior, maintaining the integrity of trends, cycles, and patterns that could be disrupted by random sampling.
The script allows users to define the number of splits and the size of each batch within a split. By doing so, it maintains the chronological sequence of the data, ensuring that the validation set is representative of a future time period that the model would predict.
www.tradingview.com
Parameters
Number of Splits: Defines how many segments the selected data range will be divided into. Each split serves as a standalone testing ground for the ML model. (Up to 24)
Batch Size: Determines the number of bars (candles) in each batch within a split. Smaller batches can help pinpoint overfitting at a finer granularity.
Start Index: The bar index from where the historical data range begins. It sets the starting point for data analysis.
End Index: The bar index where the historical data range ends. It marks the cutoff for data to be included in the model assessment.
Usage
To use this script effectively:
1 - Input the Start Index and End Index to define the historical data range you wish to analyze.
2 - Adjust the Number of Splits to create multiple validation sets for cross-validation.
3 - Set the Batch Size to control the granularity of each validation set within the splits.
4 - The script will highlight the background of each batch within the splits using alternating shades, allowing for a clear visual distinction of the data segmentation.
By maintaining the temporal sequence and allowing for adjustable granularity, the "ML Split and Batch Highlighter" aids in creating a robust validation framework for time series forecasting models in finance.
Bandwidth Volatility - Silverman Rule of thumb EstimatorOverview
This indicator calculates volatility using the Rule of Thumb bandwidth estimator and incorporating the standard deviations of returns to get historical volatility. There are two options: one for the original rule of thumb bandwidth estimator, and another for the modified rule of thumb estimator. This indicator comes with the bandwidth , which is shown with the color gradient columns, which are colored by a percentile of the bandwidth, and the moving average of the bandwidth, which is the dark shaded area.
The rule of thumb bandwidth estimator is a simple and quick method for estimating the bandwidth parameter in kernel density estimation (KSE) or kernel regression. It provides a rough approximation of the bandwidth without requiring extensive computation resources or fine-tuning. One common rule of thumb estimator is Silverman rule, which is given by
h = 1.06*σ*n^(-1/5)
where
h is the bandwidth
σ is the standard deviation of the data
n is the number of data points
This rule of thumb is based on assuming a Gaussian kernel and aims to strike a balance between over-smoothing and under-smoothing the data. It is simple to implement and usually provides reasonable bandwidth estimates for a wide range of datasets. However , it is important to note that this rule of thumb may not always have optimal results, especially for non-Gaussian or multimodal distributions. In such cases, a modified bandwidth selection, such as cross-validation or even applying a log transformation (if the data is right-skewed), may be preferable.
How it works:
This indicator computes the bandwidth volatility using returns, which are used in the standard deviation calculation. It then estimates the bandwidth based on either the Silverman rule of thumb or a modified version considering the interquartile range. The percentile ranks of the bandwidth estimate are then used to visualize the volatility levels, identify high and low volatility periods, and show them with colors.
Modified Rule of thumb Bandwidth:
The modified rule of thumb bandwidth formula combines elements of standard deviations and interquartile ranges, scaled by a multiplier of 0.9 and inversely with a number of periods. This modification aims to provide a more robust and adaptable bandwidth estimation method, particularly suitable for financial time series data with potentially skewed or heavy-tailed data.
Formula for Modified Rule of Thumb Bandwidth:
h = 0.9 * min(σ, (IQR/1.34))*n^(-1/5)
This modification introduces the use of the IQR divided by 1.34 as an alternative to the standard deviation. It aims to improve the estimation, mainly when the underlying distribution deviates from a perfect Gaussian distribution.
Analysis
Rule of thumb Bandwidth: Provides a broader perspective on volatility trends, smoothing out short-term fluctuations and focusing more on the overall shape of the density function.
Historical Volatility: Offers a more granular view of volatility, capturing day-to-day or intra-period fluctuations in asset prices and returns.
Modelling Requirements
Rule of thumb Bandwidth: Provides a broader perspective on volatility trends, smoothing out short-term fluctuations and focusing more on the overall shape of the density function.
Historical Volatility: Offers a more granular view of volatility, capturing day-to-day or intra-period fluctuations in asset prices and returns.
Pros of Bandwidth as a volatility measure
Robust to Data Distribution: Bandwidth volatility, especially when estimated using robust methods like Silverman's rule of thumb or its modifications, can be less sensitive to outliers and non-normal distributions compared to some other measures of volatility
Flexibility: It can be applied to a wide range of data types and can adapt to different underlying data distributions, making it versatile for various analytical tasks.
How can traders use this indicator?
In finance, volatility is thought to be a mean-reverting process. So when volatility is at an extreme low, it is expected that a volatility expansion happens, which comes with bigger movements in price, and when volatility is at an extreme high, it is expected for volatility to eventually decrease, leading to smaller price moves, and many traders view this as an area to take profit in.
In the context of this indicator, low volatility is thought of as having the green color, which indicates a low percentile value, and also being below the moving average. High volatility is thought of as having the yellow color and possibly being above the moving average, showing that you can eventually expect volatility to decrease.
Likelihood of Winning - Probability Density FunctionIn developing the "Likelihood of Winning - Probability Density Function (PDF)" indicator, my aim was to offer traders a statistical tool to quantify the probability of reaching target prices. This indicator, grounded in risk assessment principles, enables users to analyze potential outcomes based on the normal distribution, providing insights into market dynamics.
The tool's flexibility allows for customization of the data series, lookback periods, and target settings for both long and short scenarios. It features a color-coded visualization to easily distinguish between probabilities of hitting specified targets, enhancing decision-making in trading strategies.
I'm excited to share this indicator with the trading community, hoping it will enhance data-driven decision-making and offer a deeper understanding of market risks and opportunities. My goal is to continuously improve this tool based on user feedback and market evolution, contributing to more informed trading practices.
This indicator leverages the "NormalDistributionFunctions" library, enabling easy integration into other indicators or strategies. Users can readily embed advanced statistical analysis into their trading tools, fostering innovation within the Pine Script community.
NormalDistributionFunctionsLibrary "NormalDistributionFunctions"
The NormalDistributionFunctions library encompasses a comprehensive suite of statistical tools for financial market analysis. It provides functions to calculate essential statistical measures such as mean, standard deviation, skewness, and kurtosis, alongside advanced functionalities for computing the probability density function (PDF), cumulative distribution function (CDF), Z-score, and confidence intervals. This library is designed to assist in the assessment of market volatility, distribution characteristics of asset returns, and risk management calculations, making it an invaluable resource for traders and financial analysts.
meanAndStdDev(source, length)
Calculates and returns the mean and standard deviation for a given data series over a specified period.
Parameters:
source (float) : float: The data series to analyze.
length (int) : int: The lookback period for the calculation.
Returns: Returns an array where the first element is the mean and the second element is the standard deviation of the data series for the given period.
skewness(source, mean, stdDev, length)
Calculates and returns skewness for a given data series over a specified period.
Parameters:
source (float) : float: The data series to analyze.
mean (float) : float: The mean of the distribution.
stdDev (float) : float: The standard deviation of the distribution.
length (int) : int: The lookback period for the calculation.
Returns: Returns skewness value
kurtosis(source, mean, stdDev, length)
Calculates and returns kurtosis for a given data series over a specified period.
Parameters:
source (float) : float: The data series to analyze.
mean (float) : float: The mean of the distribution.
stdDev (float) : float: The standard deviation of the distribution.
length (int) : int: The lookback period for the calculation.
Returns: Returns kurtosis value
pdf(x, mean, stdDev)
pdf: Calculates the probability density function for a given value within a normal distribution.
Parameters:
x (float) : float: The value to evaluate the PDF at.
mean (float) : float: The mean of the distribution.
stdDev (float) : float: The standard deviation of the distribution.
Returns: Returns the probability density function value for x.
cdf(x, mean, stdDev)
cdf: Calculates the cumulative distribution function for a given value within a normal distribution.
Parameters:
x (float) : float: The value to evaluate the CDF at.
mean (float) : float: The mean of the distribution.
stdDev (float) : float: The standard deviation of the distribution.
Returns: Returns the cumulative distribution function value for x.
confidenceInterval(mean, stdDev, size, confidenceLevel)
Calculates the confidence interval for a data series mean.
Parameters:
mean (float) : float: The mean of the data series.
stdDev (float) : float: The standard deviation of the data series.
size (int) : int: The sample size.
confidenceLevel (float) : float: The confidence level (e.g., 0.95 for 95% confidence).
Returns: Returns the lower and upper bounds of the confidence interval.
ApproximateGaussianSmoothingLibrary "ApproximateGaussianSmoothing"
This library provides a novel smoothing function for time-series data, serving as an alternative to SMA and EMA. Additionally, it provides some statistical processing, using moving averages as expected values in statistics.
'Approximate Gaussian Smoothing' (AGS) is designed to apply weights to time-series data that closely resemble Gaussian smoothing weights. it is easier to calculate than the similar ALMA.
In case AGS is used as a moving average, I named it 'Approximate Gaussian Weighted Moving Average' (AGWMA).
The formula is:
AGWMA = (EMA + EMA(EMA) + EMA(EMA(EMA)) + EMA(EMA(EMA(EMA)))) / 4
The EMA parameter alpha is 5 / (N + 4) , using time period N (or length).
ma(src, length)
Calculate moving average using AGS (AGWMA).
Parameters:
src (float) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: Moving average.
analyse(src, length)
Calculate mean and variance using AGS.
Parameters:
src (float) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: Mean and variance.
analyse(dimensions, sources, length)
Calculate mean and variance covariance matrix using AGS.
Parameters:
dimensions (simple int) : Dimensions of sources to process.
sources (array) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: Mean and variance covariance matrix.
trend(src, length)
Calculate intercept (LSMA) and slope using AGS.
Parameters:
src (float) : Series of values to process.
length (simple int) : Number of bars (length).
Returns: Intercept and slope.
Bandwidth Bands - Silverman's rule of thumbWhat are Bandwidth Bands?
This indicator uses Silverman Rule of Thumb Bandwidth to estimate the width of bands around the rolling moving average which takes in the log transformation of price to remove most of price skewness for the rest of the volatility calculations and then a exp() function is performed to convert it back to a right skewed distribution. These bandwidths bands could offer insights into price volatility and trading extremes.
Silverman rule of thumb bandwidth:
The Silverman Rule of Thumb Bandwidth is a heuristic method used to estimate the optimal bandwidth for kernel density estimation, a statistical technique for estimating the probability density function of a random variable. In the context of financial analysis, such as in this indicator, it helps determine the width of bands around a moving average, providing insights into the level of volatility in the market. This method is particularly useful because it offers a quick and straightforward way to estimate bandwidth without requiring extensive computational resources or complex mathematical calculation
The bandwidth estimator automatically adjust to the characteristics of the data, providing a flexible and dynamic measure of dispersion that can capture variations in volatility over time. Standard deviations alone may not be as adaptive to changes in data distributions. The Bandwidth considers the overall shape and structure of the data distribution rather than just focusing on the spread of data points.
Settings
Source
Sample length
1-4 SD options to disable or enable each band
FVG Detector LibraryLibrary "FVG Detector Library"
🔵 Introduction
To save time and improve accuracy in your scripts for identifying Fair Value Gaps (FVGs), you can utilize this library. Apart from detecting and plotting FVGs, one of the most significant advantages of this script is the ability to filter FVGs, which you'll learn more about below. Additionally, the plotting of each FVG continues until either a new FVG occurs or the current FVG is mitigated.
🔵 Definition
Fair Value Gap (FVG) refers to a situation where three consecutive candlesticks do not overlap. Based on this definition, the minimum conditions for detecting a fair gap in the ascending scenario are that the minimum price of the last candlestick should be greater than the maximum price of the third candlestick, and in the descending scenario, the maximum price of the last candlestick should be smaller than the minimum price of the third candlestick.
If the filter is turned off, all FVGs that meet at least the minimum conditions are identified. This mode is simplistic and results in a high number of identified FVGs.
If the filter is turned on, you have four options to filter FVGs :
1. Very Aggressive : In addition to the initial condition, another condition is added. For ascending FVGs, the maximum price of the last candlestick should be greater than the maximum price of the middle candlestick. Similarly, for descending FVGs, the minimum price of the last candlestick should be smaller than the minimum price of the middle candlestick. In this mode, a very small number of FVGs are eliminated.
2. Aggressive : In addition to the conditions of the Very Aggressive mode, in this mode, the size of the middle candlestick should not be small. This mode eliminates more FVGs compared to the Very Aggressive mode.
3. Defensive : In addition to the conditions of the Very Aggressive mode, in this mode, the size of the middle candlestick should be relatively large, and most of it should consist of the body. Also, for identifying ascending FVGs, the second and third candlesticks must be positive, and for identifying descending FVGs, the second and third candlesticks must be negative. In this mode, a significant number of FVGs are eliminated, and the remaining FVGs have a decent quality.
4. Very Defensive : In addition to the conditions of the Defensive mode, the first and third candlesticks should not resemble very small-bodied doji candlesticks. In this mode, the majority of FVGs are filtered out, and the remaining ones are of higher quality.
By default, we recommend using the Defensive mode.
🔵 How to Use
🟣 Parameters
To utilize this library, you need to provide four input parameters to the function.
"FVGFilter" determines whether you wish to apply a filter on FVGs or not. The possible inputs for this parameter are "On" and "Off", provided as strings.
"FVGFilterType" determines the type of filter to be applied to the found FVGs. These filters include four modes: "Very Defensive", "Defensive", "Aggressive", and "Very Aggressive", respectively exhibiting decreasing sensitivity and indicating a higher number of Fair Value Gaps (FVG).
The parameter "ShowDeFVG" is a Boolean value defined as either "true" or "false". If this value is "true", FVGs are shown during the Bullish Trend; however, if it is "false", they are not displayed.
The parameter "ShowSuFVG" is a Boolean value defined as either "true" or "false". If this value is "true", FVGs are displayed during the Bearish Trend; however, if it is "false", they are not displayed.
FVGDetector(FVGFilter, FVGFilterType, ShowDeFVG, ShowSuFVG)
Parameters:
FVGFilter (string)
FVGFilterType (string)
ShowDeFVG (bool)
ShowSuFVG (bool)
🟣 Import Library
You can use the "FVG Detector" library in your script using the following expression:
import TFlab/FVGDetectorLibrary/1 as FVG
🟣 Input Parameters
The descriptions related to the input parameters were provided in the "Parameter" section. In this section, for your convenience, the code related to the inputs is also included, and you can copy and paste it into your script.
PFVGFilter = input.string('On', 'FVG Filter', )
PFVGFilterType = input.string('Defensive', 'FVG Filter Type', )
PShowDeFVG = input.bool(true, ' Show Demand FVG')
PShowSuFVG = input.bool(true, ' Show Supply FVG')
🟣 Call Function
You can copy the following code into your script to call the FVG function. This code is based on the naming conventions provided in the "Input Parameter" section, so if you want to use exactly this code, you should have similar parameter names or have copied the "Input Parameter" values.
FVG.FVGDetector(PFVGFilter, PFVGFilterType, PShowDeFVG, PShowSuFVG)
Dynamic Momentum GaugeOverview
The Dynamic Momentum Gauge is an indicator designed to provide information and insights into the trend and momentum of a financial asset. While this indicator is not directional , it helps you know when there will be a trend, big move, or when momentum will have a run, and when you should take profits.
How It Works
This indicator calculates momentum and then removes the negative values to focus instead on when the big trend could likely happen and when it could end, or when you should enter a trade based on momentum or exit. Traders can basically use this indicator to time their market entries or exits, and align their strategies with momentum dynamics.
How To Use
As previously mentioned, this is not a directional indicator but more like a timing indicator. This indicator helps you find when the trend moves, and big moves in the markets will occur and its possibly best to exit the trades. For example, if you decide to enter a long trade if the Dynamic Momentum Gauge value is at an extreme low and another momentum indicator that you use has conditions that you would consider to long with, then this indicator is basically telling you that there isn't more space for the momentum to squeeze any longer, can only really expand from that point or stay where it currently is, but this is also a mean reverting process so it does tend to go back up from the low point.
Settings:
Length: This is the length of the momentum, by default its at 100.
Normalization Length: Length of the Normalization which ensures the the values fall within a consistent range.