Standard Deviation-Based Fibonacci Band by zdmre This indicator is designed to better understand market dynamics by focusing on standard deviation and the Fibonacci sequence. This indicator includes the following components to assist investors in analyzing price movements:
Weighted Moving Average (WMA) : The indicator creates a central band by utilizing the weighted moving average of standard deviation. WMA provides a more current and accurate representation by giving greater weight to recent prices. This central band offers insights into the general trend of the market, helping to identify potential buying and selling opportunities.
Fibonacci Bands : The Fibonacci bands located above and below the central band illustrate potential support and resistance levels for prices. These bands enable investors to pinpoint areas where the price may exhibit indecisiveness. When prices move within these bands, it may be challenging for investors to discern the market's preferred direction.
Indecisiveness Representation : When prices fluctuate between the Fibonacci bands, they may reflect a state of indecisiveness. This condition is critical for identifying potential reversal points and trend changes. Investors can evaluate these periods of indecisiveness to develop suitable buying and selling strategies.
This indicator is designed to assist investors in better analyzing market trends and supporting their decision-making processes. The integration of standard deviation and the Fibonacci sequence offers a new perspective on understanding market movements.
#DYOR
อินดิเคเตอร์และกลยุทธ์
The Bar Counter Trend Reversal Strategy [TradeDots]Overview
The Bar Counter Trend Reversal Strategy is designed to identify potential counter-trend reversal points in the market after a series of consecutive rising or falling bars.
By analyzing price movements in conjunction with optional volume confirmation and channel bands (Bollinger Bands or Keltner Channels), this strategy aims to detect overbought or oversold conditions where a trend reversal may occur.
🔹How it Works
Consecutive Price Movements
Rising Bars: The strategy detects when there are a specified number of consecutive rising bars (No. of Rises).
Falling Bars: Similarly, it identifies a specified number of consecutive falling bars (No. of Falls).
Volume Confirmation (Optional)
When enabled, the strategy checks for increasing volume during the consecutive price movements, adding an extra layer of confirmation to the potential reversal signal.
Channel Confirmation (Optional)
Channel Type: Choose between Bollinger Bands ("BB") or Keltner Channels ("KC").
Channel Interaction: The strategy checks if the price interacts with the upper or lower channel lines: For short signals, it looks for price moving above the upper channel line. For long signals, it looks for price moving below the lower channel line.
Customization:
No. of Rises/Falls: Set the number of consecutive bars required to trigger a signal.
Volume Confirmation: Enable or disable volume as a confirmation factor.
Channel Confirmation: Enable or disable channel bands as a confirmation factor.
Channel Settings: Adjust the length and multiplier for the Bollinger Bands or Keltner Channels.
Visual Indicators:
Entry Signals: Triangles plotted on the chart indicate potential entry points:
Green upward triangle for long entries.
Red downward triangle for short entries.
Channel Bands: The upper and lower bands are plotted for visual reference.
Strategy Parameters:
Initial Capital: $10,000.
Position Sizing: 80% of equity per trade.
Commission: 0.01% per trade to simulate realistic trading costs.
🔹Usage
Set up the number of Rises/Falls and choose whether if you want to use channel indicators and volume as the confirmation.
Monitor the chart for triangles indicating potential entry points.
Consider the context of the overall market trend and other technical factors.
Backtesting and Optimization:
Use TradingView's Strategy Tester to evaluate performance.
Adjust parameters to optimize results for different market conditions.
🔹 Considerations and Recommendations
Risk Management:
The strategy does not include built-in stop-loss or take-profit levels. It's recommended to implement your own risk management techniques.
Market Conditions:
Performance may vary in different market environments. Testing and adjustments are advised when applying the strategy to new instruments or timeframes.
No Guarantee of Future Results:
Past performance is not indicative of future results. Always perform due diligence and consider the risks involved in trading.
MACD Enhanced Strategy MTF with Stop Loss [LTB]Test strategy for MACD
This strategy, named "MACD Enhanced Strategy MTF with Stop Loss ," is a modified Moving Average Convergence Divergence (MACD) strategy with enhancements such as multi-timeframe (MTF) analysis, custom scoring, and a dynamic stop loss mechanism. Let’s break down how to effectively use it:
Key Elements of the Strategy
MACD Indicator with Modifications:
The strategy uses MACD, a well-known momentum indicator, with customizable parameters:
fastLength, slowLength, and signalLength represent the standard MACD settings.
Instead of relying solely on MACD crossovers, it introduces scoring parameters for histogram direction (histside), indicator direction (indiside), and signal cross (crossscore). This allows for a more nuanced decision-making process when determining buy and sell signals.
Multi-Timeframe Analysis (MTF):
The strategy compares the current timeframe's MACD score with that of a higher timeframe (HTF). It dynamically selects the higher timeframe based on the current timeframe. For example, if the current chart period is 1, it will select 5 as the higher timeframe.
This MTF approach aims to align trades with broader trends, filtering out false signals that could be present when analyzing only a single timeframe.
Scoring System:
A custom scoring system (count() function) is used to evaluate buy and sell signals. This includes calculations based on the direction and momentum of MACD (indi) and the histogram. The score is used to determine the strength of signals.
Positive scores indicate bullish sentiment, while negative scores indicate bearish sentiment.
This scoring mechanism aims to reduce the influence of noise and provide more reliable entries.
Entry Conditions:
Long Condition: When the Result value (a combination of MTF and current MACD analysis) changes and becomes positive, a long entry is triggered.
Short Condition: When the Result changes and becomes negative, a short entry is initiated.
Stop Loss Mechanism:
The countstop() function calculates dynamic stop loss values for both long and short trades. It is based on the Average True Range (ATR) multiplied by a factor (Mult), providing adaptive stop loss levels depending on market volatility.
The stop loss is plotted on the chart to show potential risk levels for open trades, with the line appearing only if shotsl is enabled.
How to Use the Strategy
To properly use the strategy, follow these steps:
Parameter Optimization:
Adjust the input parameters such as fastLength, slowLength, and signalLength to tune the MACD indicator to the specific asset you’re trading. The values provided are typical defaults, but optimizing these values based on backtesting can help improve performance.
Customize the scoring parameters (crossscore, indiside, histside) to balance how much weight you want to put on the direction, histogram, and cross events of the MACD indicator.
Select Appropriate Timeframes:
This strategy employs a multi-timeframe (MTF) approach, so it's important to understand how the higher timeframe (HTF) is selected based on the current timeframe. For instance, if you are trading on a 5-minute chart, the higher timeframe will be 15 minutes, which helps filter out lower timeframe noise.
Ensure you understand the relationship between the timeframe you’re using and the HTF it automatically selects. The strategy’s effectiveness can vary depending on how these timeframes align with the asset’s overall volatility.
Run Backtests:
Always backtest the strategy over historical data to determine its reliability for the asset and timeframes you’re interested in. Note that the MTF approach may require substantial data to capture how different timeframes interact.
Use the backtest results to adjust the scoring parameters or the Stop Loss Factor (Mult) for better risk management.
Stop Loss Usage:
The stop loss is calculated dynamically using ATR, which means that it adjusts with changing volatility. This can be useful to avoid being stopped out too often during periods of increased volatility.
The shotsl parameter can be set to true to visualize the stop loss line on the chart. This helps to monitor the protection level and make better decisions regarding holding or closing a trade manually.
Entry Signals and Trade Execution:
Look for changes in the Result value to determine entry points. For a long position, the Result needs to become positive, and for a short position, it must be negative.
Note that the strategy's entries are more conservative because it waits for the Result to confirm the direction using multiple factors, which helps filter out false breakouts.
Risk Management:
The adaptive stop loss mechanism reduces the risk by basing the stop level on market volatility. However, you must still consider additional risk management practices such as position sizing and profit targets.
Given the scoring mechanism, it might not enter trades frequently, which means using this strategy may result in fewer but potentially more accurate trades. It’s important to be patient and not force trades that don’t align with the calculated results.
Real-Time Monitoring:
Make sure to monitor trades actively. Since the strategy recalculates the score on each bar, real-time changes in the Result value could provide exit opportunities even if the stop loss isn't triggered.
Summary
The "MACD Enhanced Strategy MTF with Stop Loss " is a sophisticated version of the MACD strategy, enhanced with multi-timeframe analysis and adaptive stop loss. Properly using it involves optimizing MACD and scoring parameters, selecting suitable timeframes, and actively managing entries and exits based on a combination of scoring and volatility-based stop losses. Always conduct thorough backtesting before applying it in a live environment to ensure the strategy performs well on the asset you're trading.
Universal Ratio Trend Matrix [InvestorUnknown]The Universal Ratio Trend Matrix is designed for trend analysis on asset/asset ratios, supporting up to 40 different assets. Its primary purpose is to help identify which assets are outperforming others within a selection, providing a broad overview of market trends through a matrix of ratios. The indicator automatically expands the matrix based on the number of assets chosen, simplifying the process of comparing multiple assets in terms of performance.
Key features include the ability to choose from a narrow selection of indicators to perform the ratio trend analysis, allowing users to apply well-defined metrics to their comparison.
Drawback: Due to the computational intensity involved in calculating ratios across many assets, the indicator has a limitation related to loading speed. TradingView has time limits for calculations, and for users on the basic (free) plan, this could result in frequent errors due to exceeded time limits. To use the indicator effectively, users with any paid plans should run it on timeframes higher than 8h (the lowest timeframe on which it managed to load with 40 assets), as lower timeframes may not reliably load.
Indicators:
RSI_raw: Simple function to calculate the Relative Strength Index (RSI) of a source (asset price).
RSI_sma: Calculates RSI followed by a Simple Moving Average (SMA).
RSI_ema: Calculates RSI followed by an Exponential Moving Average (EMA).
CCI: Calculates the Commodity Channel Index (CCI).
Fisher: Implements the Fisher Transform to normalize prices.
Utility Functions:
f_remove_exchange_name: Strips the exchange name from asset tickers (e.g., "INDEX:BTCUSD" to "BTCUSD").
f_remove_exchange_name(simple string name) =>
string parts = str.split(name, ":")
string result = array.size(parts) > 1 ? array.get(parts, 1) : name
result
f_get_price: Retrieves the closing price of a given asset ticker using request.security().
f_constant_src: Checks if the source data is constant by comparing multiple consecutive values.
Inputs:
General settings allow users to select the number of tickers for analysis (used_assets) and choose the trend indicator (RSI, CCI, Fisher, etc.).
Table settings customize how trend scores are displayed in terms of text size, header visibility, highlighting options, and top-performing asset identification.
The script includes inputs for up to 40 assets, allowing the user to select various cryptocurrencies (e.g., BTCUSD, ETHUSD, SOLUSD) or other assets for trend analysis.
Price Arrays:
Price values for each asset are stored in variables (price_a1 to price_a40) initialized as na. These prices are updated only for the number of assets specified by the user (used_assets).
Trend scores for each asset are stored in separate arrays
// declare price variables as "na"
var float price_a1 = na, var float price_a2 = na, var float price_a3 = na, var float price_a4 = na, var float price_a5 = na
var float price_a6 = na, var float price_a7 = na, var float price_a8 = na, var float price_a9 = na, var float price_a10 = na
var float price_a11 = na, var float price_a12 = na, var float price_a13 = na, var float price_a14 = na, var float price_a15 = na
var float price_a16 = na, var float price_a17 = na, var float price_a18 = na, var float price_a19 = na, var float price_a20 = na
var float price_a21 = na, var float price_a22 = na, var float price_a23 = na, var float price_a24 = na, var float price_a25 = na
var float price_a26 = na, var float price_a27 = na, var float price_a28 = na, var float price_a29 = na, var float price_a30 = na
var float price_a31 = na, var float price_a32 = na, var float price_a33 = na, var float price_a34 = na, var float price_a35 = na
var float price_a36 = na, var float price_a37 = na, var float price_a38 = na, var float price_a39 = na, var float price_a40 = na
// create "empty" arrays to store trend scores
var a1_array = array.new_int(40, 0), var a2_array = array.new_int(40, 0), var a3_array = array.new_int(40, 0), var a4_array = array.new_int(40, 0)
var a5_array = array.new_int(40, 0), var a6_array = array.new_int(40, 0), var a7_array = array.new_int(40, 0), var a8_array = array.new_int(40, 0)
var a9_array = array.new_int(40, 0), var a10_array = array.new_int(40, 0), var a11_array = array.new_int(40, 0), var a12_array = array.new_int(40, 0)
var a13_array = array.new_int(40, 0), var a14_array = array.new_int(40, 0), var a15_array = array.new_int(40, 0), var a16_array = array.new_int(40, 0)
var a17_array = array.new_int(40, 0), var a18_array = array.new_int(40, 0), var a19_array = array.new_int(40, 0), var a20_array = array.new_int(40, 0)
var a21_array = array.new_int(40, 0), var a22_array = array.new_int(40, 0), var a23_array = array.new_int(40, 0), var a24_array = array.new_int(40, 0)
var a25_array = array.new_int(40, 0), var a26_array = array.new_int(40, 0), var a27_array = array.new_int(40, 0), var a28_array = array.new_int(40, 0)
var a29_array = array.new_int(40, 0), var a30_array = array.new_int(40, 0), var a31_array = array.new_int(40, 0), var a32_array = array.new_int(40, 0)
var a33_array = array.new_int(40, 0), var a34_array = array.new_int(40, 0), var a35_array = array.new_int(40, 0), var a36_array = array.new_int(40, 0)
var a37_array = array.new_int(40, 0), var a38_array = array.new_int(40, 0), var a39_array = array.new_int(40, 0), var a40_array = array.new_int(40, 0)
f_get_price(simple string ticker) =>
request.security(ticker, "", close)
// Prices for each USED asset
f_get_asset_price(asset_number, ticker) =>
if (used_assets >= asset_number)
f_get_price(ticker)
else
na
// overwrite empty variables with the prices if "used_assets" is greater or equal to the asset number
if barstate.isconfirmed // use barstate.isconfirmed to avoid "na prices" and calculation errors that result in empty cells in the table
price_a1 := f_get_asset_price(1, asset1), price_a2 := f_get_asset_price(2, asset2), price_a3 := f_get_asset_price(3, asset3), price_a4 := f_get_asset_price(4, asset4)
price_a5 := f_get_asset_price(5, asset5), price_a6 := f_get_asset_price(6, asset6), price_a7 := f_get_asset_price(7, asset7), price_a8 := f_get_asset_price(8, asset8)
price_a9 := f_get_asset_price(9, asset9), price_a10 := f_get_asset_price(10, asset10), price_a11 := f_get_asset_price(11, asset11), price_a12 := f_get_asset_price(12, asset12)
price_a13 := f_get_asset_price(13, asset13), price_a14 := f_get_asset_price(14, asset14), price_a15 := f_get_asset_price(15, asset15), price_a16 := f_get_asset_price(16, asset16)
price_a17 := f_get_asset_price(17, asset17), price_a18 := f_get_asset_price(18, asset18), price_a19 := f_get_asset_price(19, asset19), price_a20 := f_get_asset_price(20, asset20)
price_a21 := f_get_asset_price(21, asset21), price_a22 := f_get_asset_price(22, asset22), price_a23 := f_get_asset_price(23, asset23), price_a24 := f_get_asset_price(24, asset24)
price_a25 := f_get_asset_price(25, asset25), price_a26 := f_get_asset_price(26, asset26), price_a27 := f_get_asset_price(27, asset27), price_a28 := f_get_asset_price(28, asset28)
price_a29 := f_get_asset_price(29, asset29), price_a30 := f_get_asset_price(30, asset30), price_a31 := f_get_asset_price(31, asset31), price_a32 := f_get_asset_price(32, asset32)
price_a33 := f_get_asset_price(33, asset33), price_a34 := f_get_asset_price(34, asset34), price_a35 := f_get_asset_price(35, asset35), price_a36 := f_get_asset_price(36, asset36)
price_a37 := f_get_asset_price(37, asset37), price_a38 := f_get_asset_price(38, asset38), price_a39 := f_get_asset_price(39, asset39), price_a40 := f_get_asset_price(40, asset40)
Universal Indicator Calculation (f_calc_score):
This function allows switching between different trend indicators (RSI, CCI, Fisher) for flexibility.
It uses a switch-case structure to calculate the indicator score, where a positive trend is denoted by 1 and a negative trend by 0. Each indicator has its own logic to determine whether the asset is trending up or down.
// use switch to allow "universality" in indicator selection
f_calc_score(source, trend_indicator, int_1, int_2) =>
int score = na
if (not f_constant_src(source)) and source > 0.0 // Skip if you are using the same assets for ratio (for example BTC/BTC)
x = switch trend_indicator
"RSI (Raw)" => RSI_raw(source, int_1)
"RSI (SMA)" => RSI_sma(source, int_1, int_2)
"RSI (EMA)" => RSI_ema(source, int_1, int_2)
"CCI" => CCI(source, int_1)
"Fisher" => Fisher(source, int_1)
y = switch trend_indicator
"RSI (Raw)" => x > 50 ? 1 : 0
"RSI (SMA)" => x > 50 ? 1 : 0
"RSI (EMA)" => x > 50 ? 1 : 0
"CCI" => x > 0 ? 1 : 0
"Fisher" => x > x ? 1 : 0
score := y
else
score := 0
score
Array Setting Function (f_array_set):
This function populates an array with scores calculated for each asset based on a base price (p_base) divided by the prices of the individual assets.
It processes multiple assets (up to 40), calling the f_calc_score function for each.
// function to set values into the arrays
f_array_set(a_array, p_base) =>
array.set(a_array, 0, f_calc_score(p_base / price_a1, trend_indicator, int_1, int_2))
array.set(a_array, 1, f_calc_score(p_base / price_a2, trend_indicator, int_1, int_2))
array.set(a_array, 2, f_calc_score(p_base / price_a3, trend_indicator, int_1, int_2))
array.set(a_array, 3, f_calc_score(p_base / price_a4, trend_indicator, int_1, int_2))
array.set(a_array, 4, f_calc_score(p_base / price_a5, trend_indicator, int_1, int_2))
array.set(a_array, 5, f_calc_score(p_base / price_a6, trend_indicator, int_1, int_2))
array.set(a_array, 6, f_calc_score(p_base / price_a7, trend_indicator, int_1, int_2))
array.set(a_array, 7, f_calc_score(p_base / price_a8, trend_indicator, int_1, int_2))
array.set(a_array, 8, f_calc_score(p_base / price_a9, trend_indicator, int_1, int_2))
array.set(a_array, 9, f_calc_score(p_base / price_a10, trend_indicator, int_1, int_2))
array.set(a_array, 10, f_calc_score(p_base / price_a11, trend_indicator, int_1, int_2))
array.set(a_array, 11, f_calc_score(p_base / price_a12, trend_indicator, int_1, int_2))
array.set(a_array, 12, f_calc_score(p_base / price_a13, trend_indicator, int_1, int_2))
array.set(a_array, 13, f_calc_score(p_base / price_a14, trend_indicator, int_1, int_2))
array.set(a_array, 14, f_calc_score(p_base / price_a15, trend_indicator, int_1, int_2))
array.set(a_array, 15, f_calc_score(p_base / price_a16, trend_indicator, int_1, int_2))
array.set(a_array, 16, f_calc_score(p_base / price_a17, trend_indicator, int_1, int_2))
array.set(a_array, 17, f_calc_score(p_base / price_a18, trend_indicator, int_1, int_2))
array.set(a_array, 18, f_calc_score(p_base / price_a19, trend_indicator, int_1, int_2))
array.set(a_array, 19, f_calc_score(p_base / price_a20, trend_indicator, int_1, int_2))
array.set(a_array, 20, f_calc_score(p_base / price_a21, trend_indicator, int_1, int_2))
array.set(a_array, 21, f_calc_score(p_base / price_a22, trend_indicator, int_1, int_2))
array.set(a_array, 22, f_calc_score(p_base / price_a23, trend_indicator, int_1, int_2))
array.set(a_array, 23, f_calc_score(p_base / price_a24, trend_indicator, int_1, int_2))
array.set(a_array, 24, f_calc_score(p_base / price_a25, trend_indicator, int_1, int_2))
array.set(a_array, 25, f_calc_score(p_base / price_a26, trend_indicator, int_1, int_2))
array.set(a_array, 26, f_calc_score(p_base / price_a27, trend_indicator, int_1, int_2))
array.set(a_array, 27, f_calc_score(p_base / price_a28, trend_indicator, int_1, int_2))
array.set(a_array, 28, f_calc_score(p_base / price_a29, trend_indicator, int_1, int_2))
array.set(a_array, 29, f_calc_score(p_base / price_a30, trend_indicator, int_1, int_2))
array.set(a_array, 30, f_calc_score(p_base / price_a31, trend_indicator, int_1, int_2))
array.set(a_array, 31, f_calc_score(p_base / price_a32, trend_indicator, int_1, int_2))
array.set(a_array, 32, f_calc_score(p_base / price_a33, trend_indicator, int_1, int_2))
array.set(a_array, 33, f_calc_score(p_base / price_a34, trend_indicator, int_1, int_2))
array.set(a_array, 34, f_calc_score(p_base / price_a35, trend_indicator, int_1, int_2))
array.set(a_array, 35, f_calc_score(p_base / price_a36, trend_indicator, int_1, int_2))
array.set(a_array, 36, f_calc_score(p_base / price_a37, trend_indicator, int_1, int_2))
array.set(a_array, 37, f_calc_score(p_base / price_a38, trend_indicator, int_1, int_2))
array.set(a_array, 38, f_calc_score(p_base / price_a39, trend_indicator, int_1, int_2))
array.set(a_array, 39, f_calc_score(p_base / price_a40, trend_indicator, int_1, int_2))
a_array
Conditional Array Setting (f_arrayset):
This function checks if the number of used assets is greater than or equal to a specified number before populating the arrays.
// only set values into arrays for USED assets
f_arrayset(asset_number, a_array, p_base) =>
if (used_assets >= asset_number)
f_array_set(a_array, p_base)
else
na
Main Logic
The main logic initializes arrays to store scores for each asset. Each array corresponds to one asset's performance score.
Setting Trend Values: The code calls f_arrayset for each asset, populating the respective arrays with calculated scores based on the asset prices.
Combining Arrays: A combined_array is created to hold all the scores from individual asset arrays. This array facilitates further analysis, allowing for an overview of the performance scores of all assets at once.
// create a combined array (work-around since pinescript doesn't support having array of arrays)
var combined_array = array.new_int(40 * 40, 0)
if barstate.islast
for i = 0 to 39
array.set(combined_array, i, array.get(a1_array, i))
array.set(combined_array, i + (40 * 1), array.get(a2_array, i))
array.set(combined_array, i + (40 * 2), array.get(a3_array, i))
array.set(combined_array, i + (40 * 3), array.get(a4_array, i))
array.set(combined_array, i + (40 * 4), array.get(a5_array, i))
array.set(combined_array, i + (40 * 5), array.get(a6_array, i))
array.set(combined_array, i + (40 * 6), array.get(a7_array, i))
array.set(combined_array, i + (40 * 7), array.get(a8_array, i))
array.set(combined_array, i + (40 * 8), array.get(a9_array, i))
array.set(combined_array, i + (40 * 9), array.get(a10_array, i))
array.set(combined_array, i + (40 * 10), array.get(a11_array, i))
array.set(combined_array, i + (40 * 11), array.get(a12_array, i))
array.set(combined_array, i + (40 * 12), array.get(a13_array, i))
array.set(combined_array, i + (40 * 13), array.get(a14_array, i))
array.set(combined_array, i + (40 * 14), array.get(a15_array, i))
array.set(combined_array, i + (40 * 15), array.get(a16_array, i))
array.set(combined_array, i + (40 * 16), array.get(a17_array, i))
array.set(combined_array, i + (40 * 17), array.get(a18_array, i))
array.set(combined_array, i + (40 * 18), array.get(a19_array, i))
array.set(combined_array, i + (40 * 19), array.get(a20_array, i))
array.set(combined_array, i + (40 * 20), array.get(a21_array, i))
array.set(combined_array, i + (40 * 21), array.get(a22_array, i))
array.set(combined_array, i + (40 * 22), array.get(a23_array, i))
array.set(combined_array, i + (40 * 23), array.get(a24_array, i))
array.set(combined_array, i + (40 * 24), array.get(a25_array, i))
array.set(combined_array, i + (40 * 25), array.get(a26_array, i))
array.set(combined_array, i + (40 * 26), array.get(a27_array, i))
array.set(combined_array, i + (40 * 27), array.get(a28_array, i))
array.set(combined_array, i + (40 * 28), array.get(a29_array, i))
array.set(combined_array, i + (40 * 29), array.get(a30_array, i))
array.set(combined_array, i + (40 * 30), array.get(a31_array, i))
array.set(combined_array, i + (40 * 31), array.get(a32_array, i))
array.set(combined_array, i + (40 * 32), array.get(a33_array, i))
array.set(combined_array, i + (40 * 33), array.get(a34_array, i))
array.set(combined_array, i + (40 * 34), array.get(a35_array, i))
array.set(combined_array, i + (40 * 35), array.get(a36_array, i))
array.set(combined_array, i + (40 * 36), array.get(a37_array, i))
array.set(combined_array, i + (40 * 37), array.get(a38_array, i))
array.set(combined_array, i + (40 * 38), array.get(a39_array, i))
array.set(combined_array, i + (40 * 39), array.get(a40_array, i))
Calculating Sums: A separate array_sums is created to store the total score for each asset by summing the values of their respective score arrays. This allows for easy comparison of overall performance.
Ranking Assets: The final part of the code ranks the assets based on their total scores stored in array_sums. It assigns a rank to each asset, where the asset with the highest score receives the highest rank.
// create array for asset RANK based on array.sum
var ranks = array.new_int(used_assets, 0)
// for loop that calculates the rank of each asset
if barstate.islast
for i = 0 to (used_assets - 1)
int rank = 1
for x = 0 to (used_assets - 1)
if i != x
if array.get(array_sums, i) < array.get(array_sums, x)
rank := rank + 1
array.set(ranks, i, rank)
Dynamic Table Creation
Initialization: The table is initialized with a base structure that includes headers for asset names, scores, and ranks. The headers are set to remain constant, ensuring clarity for users as they interpret the displayed data.
Data Population: As scores are calculated for each asset, the corresponding values are dynamically inserted into the table. This is achieved through a loop that iterates over the scores and ranks stored in the combined_array and array_sums, respectively.
Automatic Extending Mechanism
Variable Asset Count: The code checks the number of assets defined by the user. Instead of hardcoding the number of rows in the table, it uses a variable to determine the extent of the data that needs to be displayed. This allows the table to expand or contract based on the number of assets being analyzed.
Dynamic Row Generation: Within the loop that populates the table, the code appends new rows for each asset based on the current asset count. The structure of each row includes the asset name, its score, and its rank, ensuring that the table remains consistent regardless of how many assets are involved.
// Automatically extending table based on the number of used assets
var table table = table.new(position.bottom_center, 50, 50, color.new(color.black, 100), color.white, 3, color.white, 1)
if barstate.islast
if not hide_head
table.cell(table, 0, 0, "Universal Ratio Trend Matrix", text_color = color.white, bgcolor = #010c3b, text_size = fontSize)
table.merge_cells(table, 0, 0, used_assets + 3, 0)
if not hide_inps
table.cell(table, 0, 1,
text = "Inputs: You are using " + str.tostring(trend_indicator) + ", which takes: " + str.tostring(f_get_input(trend_indicator)),
text_color = color.white, text_size = fontSize), table.merge_cells(table, 0, 1, used_assets + 3, 1)
table.cell(table, 0, 2, "Assets", text_color = color.white, text_size = fontSize, bgcolor = #010c3b)
for x = 0 to (used_assets - 1)
table.cell(table, x + 1, 2, text = str.tostring(array.get(assets, x)), text_color = color.white, bgcolor = #010c3b, text_size = fontSize)
table.cell(table, 0, x + 3, text = str.tostring(array.get(assets, x)), text_color = color.white, bgcolor = f_asset_col(array.get(ranks, x)), text_size = fontSize)
for r = 0 to (used_assets - 1)
for c = 0 to (used_assets - 1)
table.cell(table, c + 1, r + 3, text = str.tostring(array.get(combined_array, c + (r * 40))),
text_color = hl_type == "Text" ? f_get_col(array.get(combined_array, c + (r * 40))) : color.white, text_size = fontSize,
bgcolor = hl_type == "Background" ? f_get_col(array.get(combined_array, c + (r * 40))) : na)
for x = 0 to (used_assets - 1)
table.cell(table, x + 1, x + 3, "", bgcolor = #010c3b)
table.cell(table, used_assets + 1, 2, "", bgcolor = #010c3b)
for x = 0 to (used_assets - 1)
table.cell(table, used_assets + 1, x + 3, "==>", text_color = color.white)
table.cell(table, used_assets + 2, 2, "SUM", text_color = color.white, text_size = fontSize, bgcolor = #010c3b)
table.cell(table, used_assets + 3, 2, "RANK", text_color = color.white, text_size = fontSize, bgcolor = #010c3b)
for x = 0 to (used_assets - 1)
table.cell(table, used_assets + 2, x + 3,
text = str.tostring(array.get(array_sums, x)),
text_color = color.white, text_size = fontSize,
bgcolor = f_highlight_sum(array.get(array_sums, x), array.get(ranks, x)))
table.cell(table, used_assets + 3, x + 3,
text = str.tostring(array.get(ranks, x)),
text_color = color.white, text_size = fontSize,
bgcolor = f_highlight_rank(array.get(ranks, x)))
ZERO LAG TRADE SIGNALS by BootcampZeroThe ZERO LAG TRADE SIGNALS by BootcampZero indicator is a versatile tool designed to help traders identify optimal entry and exit points for both short-term scalping and long-term trading across multiple time frames. It combines several well-known technical analysis methods, including moving averages, trend analysis, directional indicators, and adaptive trend calculations, to deliver reliable buy and sell signals.
Short-Term Scalping (Under 5-Minute Time Frames)
For short-term traders who prefer quick trades on lower time frames, such as under 5 minutes, this indicator uses a combination of the EMA (Exponential Moving Average) and SMA (Simple Moving Average) to spot fast trend reversals. The indicator is particularly useful for scalpers because it focuses on detecting short-term price momentum by comparing the faster-moving averages with slower ones, triggering signals based on their crossover.
Buy Signals are generated when a fast-moving EMA crosses above a slower-moving SMA, indicating upward momentum.
Sell Signals are triggered when the fast-moving EMA crosses below the slower-moving SMA, signaling potential downward price movement.
In addition, the Adaptive Trend Finder feature dynamically adjusts to recent price deviations and volatility, making it easier for scalpers to spot the prevailing short-term trend with high confidence. The indicator also uses ADX (Average Directional Index) for momentum confirmation, ensuring that signals are only generated during strong price trends, reducing false positives in sideways markets.
Long-Term Trading (Above 1-Day Charts)
When applied to higher time frames such as daily charts or above, this indicator excels in generating reliable long-term buy and sell signals, perfect for swing traders and long-term investors. The Kaufman Adaptive Moving Average (KAMA) and the Ichimoku Cloud are used to assess long-term trends by filtering out market noise and focusing on sustainable price direction.
KAMA helps to adapt the moving average based on market volatility, providing smoother signals that minimize whipsawing in longer-term trades.
Ichimoku Cloud provides additional trend confirmation by identifying whether the market is bullish or bearish based on the relationship between key lines like the Tenkan-Sen (Conversion Line) and Kijun-Sen (Base Line), and how the current price interacts with the Ichimoku Cloud itself.
The indicator also integrates PPO (Percentage Price Oscillator) to capture divergences between price and momentum, further supporting traders in holding positions for extended periods when the signal strength is robust.
Key Technical Values and Factors for Signals
EMA and SMA Crossover: Fast EMA vs. Slow SMA to detect short-term trend reversals.
ADX: Helps gauge the strength of the trend; signals are only generated in trending markets.
KAMA: Filters noise in long-term trends, providing smooth signals based on market volatility.
Ichimoku Cloud: Offers insight into long-term trends and momentum by analyzing price relative to the cloud.
PPO: Detects divergences between price and momentum for trend continuation or reversal signals.
How It Works
Buy signals are generated when bullish conditions are met, and the indicator confirms momentum with ADX, crossover of the EMAs, or a bullish breakout from the Ichimoku Cloud.
Sell signals are triggered when bearish conditions prevail, confirmed by the same factors in reverse, such as a bearish EMA crossover or weakness in ADX.
By combining these powerful tools, ZERO LAG TRADE SIGNALS by BootcampZero offers traders a comprehensive system for both quick scalping trades and more conservative long-term positioning, providing reliable and adaptive signals across different market conditions.
Magnificent 7 Overall Percentage Change with MA and Angle LabelsMagnificent 7 Overall Percentage Change with MA and Angle Labels
Overview:
The "Magnificent 7 Overall Percentage Change with MA and Angle Labels" indicator tracks the percentage change of seven key tech stocks (Apple, Microsoft, Amazon, NVIDIA, Tesla, Meta, and Alphabet) and displays their overall average percentage change on the chart. It also provides a moving average of this overall change and calculates the angle of the moving average to help traders gauge the momentum and direction of the overall trend.
How it works:
Real-Time Percentage Change: The indicator calculates the percentage change of each of the "Magnificent 7" stocks compared to their previous day's closing price, giving a snapshot of the market's performance.
Overall Average: It then computes the average of the seven stocks' percentage changes to reflect the broader movement of these major tech companies.
Moving Average: The indicator offers a choice of four types of moving averages (SMA, EMA, WMA, or VWMA) to smooth the overall percentage change, allowing traders to focus on the trend rather than short-term fluctuations.
Slope and Angle Calculation: To provide additional insights, the indicator calculates the slope of the moving average and converts it into an angle (in degrees). This can help traders determine the strength of the trend—steeper angles often indicate stronger momentum.
Key Features:
Percentage Change of the "Magnificent 7":
Tracks the percentage change of Apple (AAPL), Microsoft (MSFT), Amazon (AMZN), NVIDIA (NVDA), Tesla (TSLA), Meta (META), and Alphabet (GOOGL) on the current chart's timeframe.
Overall Average Change:
Computes the average percentage change across all seven stocks, giving a combined view of how the most influential tech stocks are performing.
Customizable Moving Averages:
Offers four types of moving averages (SMA, EMA, WMA, VWMA) to provide flexibility in tracking the trend of the overall percentage change.
Angle Calculation:
Measures the angle of the moving average in degrees, which helps assess the strength of the market’s momentum. Alerts and visual cues can be triggered based on the angle's steepness.
Visual Cues:
The percentage change is plotted in green when positive and red when negative, with a background color that changes accordingly. A zero line is plotted for reference.
Use Case:
This indicator is ideal for traders and investors looking to track the collective performance of the most dominant tech companies in the market. It provides real-time insights into how the "Magnificent 7" stocks are moving together and offers clues about potential market momentum based on the direction and angle of their average percentage change.
Customization:
Moving Average Type and Length: Choose between different types of moving averages (SMA, EMA, WMA, VWMA) and adjust the length to suit your preferred timeframe.
Angle Threshold: Set an angle threshold to trigger alerts when the moving average slope becomes too steep, indicating strong momentum.
Alerts:
Alerts can be created based on the crossing of the moving average or when the angle of the moving average exceeds a specified threshold. This ensures traders are notified when the trend is accelerating or decelerating significantly.
Conclusion:
The "Magnificent 7 Overall Percentage Change with MA and Angle Labels" indicator is a powerful tool for those wanting to monitor the performance of the most influential tech stocks, analyze their overall trend, and receive timely alerts when market conditions shift.
Market Volatility Key: CHOP, ATR, VIX & 10Y BondThis script builds upon existing market analysis tools by providing a comprehensive dashboard that combines the Choppiness Index (CHOP), Average True Range (ATR) with a user-selectable timeframe, VIX (Volatility Index), and the 10-year US Treasury bond price in a compact tile format. The color-coded key provides quick visual cues for market conditions—highlighting whether the market is trending or consolidating—allowing traders to make informed decisions quickly.
For example, when trading the Nasdaq (NQ), you might use this indicator to help manage your scalping trades. If you trade on a 10-minute chart but set the ATR timeframe to 1 minute, it helps identify whether there is enough price movement to justify entering a trade. If the ATR is less than 10, it suggests there's not enough range for scalping opportunities, and you may choose to stay out of the trade.
This expanded indicator integrates and enhances existing concepts to deliver a well-rounded view of volatility, trend strength, and market conditions all in one glance, making it an essential tool for both trend-following and scalping strategies.
Day Open vs Previous Day CloseThe concept of comparing the **Day Open** to the **Previous Day Close** is used frequently in technical analysis to gauge the sentiment or momentum at the start of a new trading day.
### Key Terms:
- **Day Open**: The first traded price of an asset when the market opens for the day.
- **Previous Day Close**: The last traded price of an asset when the market closed on the previous day.
### Importance of Day Open vs. Previous Day Close
1. **Market Sentiment Indicator**:
- If the **Day Open** is **higher** than the **Previous Day Close**, it suggests **bullish** sentiment (buyers are willing to pay more than yesterday's closing price).
- If the **Day Open** is **lower** than the **Previous Day Close**, it suggests **bearish** sentiment (sellers are driving prices down compared to the last price from the previous day).
2. **Potential Gaps**:
- A **gap** occurs when there is a significant difference between the Day Open and Previous Day Close, often due to events or news released after the market closed. This gap can indicate strong momentum in either direction.
- **Gap Up**: Open > Close (bullish).
- **Gap Down**: Open < Close (bearish).
3. **Trend Continuation or Reversal**:
- If the market opens above the previous day’s close and continues to rise, it often signals a **continuation of an upward trend**.
- Conversely, if the market opens below and keeps falling, it suggests **downward momentum** is still strong.
4. **Trading Strategies**:
- **Opening Range Breakout**: Traders may look for the price to break above or below the opening range (the price range between the Day Open and the first few candles) to confirm a strong bullish or bearish move.
- **Reversals**: Some traders look for price reversals if the price spikes far above or below the previous day's close, expecting that the market might correct itself and return towards the previous day’s closing levels.
In the context of your **Opening Range Indicator**, the concept of the Day Open sweeping and closing above or below the Previous Day Close is used to identify whether the new day is setting up for a **buy (bullish)** or **sell (bearish)** opportunity.
Volume Density AnalysisVolume Density Analysis
Overview
The "Volume Density Analysis" indicator is designed to provide traders with insights into volume dynamics relative to price movements. By analyzing the density of volume against price spread, this indicator helps identify potential reversal points and extreme volume conditions, enhancing decision-making in trading strategies.
Key Features
Volume Density Calculation: The indicator computes the density of volume by dividing the total volume by the price spread (high - low) for each bar. This allows for a more nuanced understanding of volume activity in relation to price movements.
Extremum Detection: Users can specify the number of bars to consider when identifying extreme volume conditions, allowing for tailored analysis based on market behavior.
Reversal Bar Conditions: The indicator includes options to determine if low or high volume bars must coincide with reversal patterns, providing additional context for potential trade signals.
Dynamic Coloring*: The histogram displays colored bars based on specific conditions:
Blue Bars: Indicate the lowest and highest volume density within a specified range, highlighting significant volume extremes.
Gray Bars: Represent lower or higher volume density that meets reversal criteria.
Green and Red Bars: Indicate bullish or bearish reversal signals based on historical density patterns.
User Inputs
nl: Number of previous lower bars to consider for comparison (default is 8).
nh: Number of previous higher bars to consider for comparison (default is 8).
ext: Number of bars for detecting extremum volume (default is 30).
LReversalBar: Boolean option to determine if low volume bar spread must indicate a reversal.
HReversalBar: Boolean option to determine if high volume bar spread must indicate a reversal.
Suggested Timeframes
M15: Without reversal considerations, use `nl=3`, `nh=3`, and `ext=20`.
M5: Without reversal considerations, use `nl=4`, `nh=4`, and `ext=35`.
M1: Use `nl=8`, `nh=8`, and `ext=58` for more detailed analysis.
Futures Daily Settlement PricesDaily settlement prices reflect the fair market value of the underlying commodity or financial instrument, as determined by buyers and sellers during the settlement period or “close”. The price quoted in the evening news for items like a bush of corn, a barrel of crude oil, or a 10-year U.S. Treasury note frequently use the settlement price for the corresponding futures product that day.
Settlement prices are used to mark traders’ positions to market daily, determining profits or losses. Daily settlement prices play a key role in facilitating price discovery, risk management, and market integrity.
This indicator plots up to 30 settlement prices as well as the date of settlement on your chart, on time frames under 1 hour.
Customizable line types, colors, and label colors.
Ichimoku Wave Oscillator with Custom MAIchimoku Wave Oscillator with Custom MA - Pine Script Description
This script uses various types of moving averages (MA) to implement the concept of Ichimoku wave theory for wave analysis. The user can select from SMA, EMA, WMA, TEMA, SMMA to visualize the difference between short-term, medium-term, and long-term waves, while identifying potential buy and sell signals at crossover points.
Key Features:
MA Type Selection:
The user can select from SMA (Simple Moving Average), EMA (Exponential Moving Average), WMA (Weighted Moving Average), TEMA (Triple Exponential Moving Average), and SMMA (Smoothed Moving Average) to calculate the waves. This script is unique in that it combines TEMA and SMMA, distinguishing it from other simple moving average-based indicators.
TEMA (Triple Exponential Moving Average): Best suited for capturing short-term trends with quick responsiveness.
SMMA (Smoothed Moving Average): Useful for identifying long-term trends with minimal noise, providing more stable signals.
Wave Calculations:
The script calculates three waves: Wave 9-17, Wave 17-26, and Wave 9-26, each of which analyzes different time horizons.
Wave 9-17 (blue): Primarily used for analyzing short-term trends, ideal for detecting quick changes.
Wave 17-26 (red): Used to analyze medium-term trends, providing a more stable market direction.
Wave 9-26 (green): Represents long-term trends, suitable for understanding broader trend shifts.
Baseline (0 Line):
Each wave is visualized around the 0 line, where waves above the line indicate an uptrend and waves below the line indicate a downtrend. This allows for easy identification of trend reversals.
Crossover Signals:
CrossUp: When Wave 9-17 (short-term wave) crosses Wave 17-26 (medium-term wave) upward, it is considered a buy signal, indicating a potential upward trend shift.
CrossDown: When Wave 9-17 (short-term wave) crosses Wave 17-26 downward, it is considered a sell signal, indicating a potential downward trend shift.
Background Color for Signal:
The script visually highlights the signals with background colors. When a buy signal occurs, the background turns green, and when a sell signal occurs, the background turns red. This makes it easier to spot reversal points.
Calculation Method:
The script calculates the difference between moving averages to display the wave oscillation. Wave 9-17, Wave 17-26, and Wave 9-26 represent the difference between the moving averages for different time periods, allowing for analysis of short-term, medium-term, and long-term trends.
Wave 9-17 = MA(9) - MA(17): Represents the difference between the short-term moving averages.
Wave 17-26 = MA(17) - MA(26): Represents the difference between medium-term moving averages.
Wave 9-26 = MA(9) - MA(26): Provides insight into the long-term trend.
This calculation method effectively visualizes the oscillation of waves and helps identify trend reversals at crossover points.
Uniqueness of the Script:
Unlike other moving average-based indicators, this script combines TEMA (Triple Exponential Moving Average) and SMMA (Smoothed Moving Average) to capture both short-term sensitivity and long-term stability in trends. This duality makes the script more versatile for different market conditions.
TEMA is ideal for short-term traders who need quick signals, while SMMA is useful for long-term investors seeking stability and noise reduction. By combining these two, this script provides a more refined analysis of trend changes across various timeframes.
How to Use:
This script is effective for trend analysis and reversal detection. By visualizing the crossover points between the waves, users can spot potential buy and sell signals to make more informed trading decisions.
Scalping strategies can rely on Wave 9-17 to detect quick trend changes, while those looking for medium-term trends can analyze signals from Wave 17-26.
For a broader market overview, Wave 9-26 helps users understand the long-term market trend.
This script is built on the concept of wave theory to anticipate trend changes, making it suitable for various timeframes and strategies. The user can tailor the characteristics of the waves by selecting different MA types, allowing for flexible application across different trading strategies.
Ichimoku Wave Oscillator with Custom MA - Pine Script 설명
이 스크립트는 다양한 이동 평균(MA) 유형을 활용하여 일목 파동론의 개념을 기반으로 파동 분석을 시도하는 지표입니다. 사용자는 SMA, EMA, WMA, TEMA, SMMA 중 원하는 이동 평균을 선택할 수 있으며, 이를 통해 단기, 중기, 장기 파동 간의 차이를 시각화하고, 교차점에서 상승 및 하락 신호를 포착할 수 있습니다.
주요 기능:
이동 평균(MA) 유형 선택:
사용자는 SMA(단순 이동 평균), EMA(지수 이동 평균), WMA(가중 이동 평균), TEMA(삼중 지수 이동 평균), SMMA(평활 이동 평균) 중 하나를 선택하여 파동을 계산할 수 있습니다. 이 스크립트는 TEMA와 SMMA의 독창적인 조합을 통해 기존의 단순한 이동 평균 지표와 차별화됩니다.
TEMA(삼중 지수 이동 평균): 빠른 반응으로 단기 트렌드를 포착하는 데 적합합니다.
SMMA(평활 이동 평균): 장기적인 추세를 파악하는 데 유용하며, 노이즈를 최소화하여 안정적인 신호를 제공합니다.
파동(Wave) 계산:
이 스크립트는 Wave 9-17, Wave 17-26, Wave 9-26의 세 가지 파동을 계산하여 각각 단기, 중기, 장기 추세를 분석합니다.
Wave 9-17 (파란색): 주로 단기 추세를 분석하는 데 사용되며, 빠른 추세 변화를 포착하는 데 유용합니다.
Wave 17-26 (빨간색): 중기 추세를 분석하는 데 사용되며, 좀 더 안정적인 시장 흐름을 보여줍니다.
Wave 9-26 (녹색): 장기 추세를 나타내며, 큰 흐름의 방향성을 파악하는 데 적합합니다.
기준선(0 라인):
각 파동은 0 라인을 기준으로 변동성을 시각화합니다. 0 위에 있는 파동은 상승세, 0 아래에 있는 파동은 하락세를 나타내며, 이를 통해 추세의 전환을 쉽게 확인할 수 있습니다.
파동 교차 신호:
CrossUp: Wave 9-17(단기 파동)이 Wave 17-26(중기 파동)을 상향 교차할 때, 상승 신호로 간주됩니다. 이는 단기적인 추세 변화가 발생할 수 있음을 의미합니다.
CrossDown: Wave 9-17(단기 파동)이 Wave 17-26(중기 파동)을 하향 교차할 때, 하락 신호로 해석됩니다. 이는 시장이 약세로 돌아설 가능성을 나타냅니다.
배경 색상 표시:
교차 신호가 발생할 때, 상승 신호는 녹색 배경, 하락 신호는 빨간색 배경으로 시각적으로 강조되어 사용자가 신호를 쉽게 인식할 수 있습니다.
계산 방식:
이 스크립트는 이동 평균 간의 차이를 계산하여 각 파동의 변동성을 나타냅니다. Wave 9-17, Wave 17-26, Wave 9-26은 각각 설정된 주기의 이동 평균(MA)의 차이를 통해, 시장의 단기, 중기, 장기 추세 변화를 시각적으로 표현합니다.
Wave 9-17 = MA(9) - MA(17): 단기 추세의 차이를 나타냅니다.
Wave 17-26 = MA(17) - MA(26): 중기 추세의 차이를 나타냅니다.
Wave 9-26 = MA(9) - MA(26): 장기적인 추세 방향을 파악할 수 있습니다.
이러한 계산 방식은 파동의 변동성을 파악하는 데 유용하며, 추세의 교차점을 통해 상승/하락 신호를 잡아냅니다.
스크립트의 독창성:
이 스크립트는 기존의 이동 평균 기반 지표들과 달리, TEMA(삼중 지수 이동 평균)와 SMMA(평활 이동 평균)을 함께 사용하여 짧은 주기와 긴 주기의 트렌드를 동시에 파악할 수 있도록 설계되었습니다. 이를 통해 단기 트렌드의 민감한 변화와 장기 트렌드의 안정성을 모두 반영합니다.
TEMA는 단기 트레이더에게 빠르고 민첩한 신호를 제공하며, SMMA는 장기 투자자에게 보다 안정적이고 긴 호흡의 트렌드를 파악하는 데 유리합니다. 두 지표의 결합으로, 다양한 시장 환경에서 추세의 변화를 더 정교하게 분석할 수 있습니다.
사용 방법:
이 스크립트는 추세 분석과 변곡점 포착에 효과적입니다. 각 파동 간의 교차점을 시각적으로 확인하고, 상승 또는 하락 신호를 포착하여 매매 시점 결정을 도울 수 있습니다.
스캘핑 전략에서는 Wave 9-17을 주로 참고하여 빠르게 추세 변화를 잡아내고, 중기 추세를 참고하고 싶은 경우 Wave 17-26을 사용해 신호를 분석할 수 있습니다.
장기적인 시장 흐름을 파악하고자 할 때는 Wave 9-26을 통해 큰 트렌드를 확인할 수 있습니다.
이 스크립트는 파동 이론의 개념을 기반으로 시장의 추세 변화를 예측하는 데 유용하며, 다양한 시간대와 전략에 맞추어 사용할 수 있습니다. 특히, 사용자가 선택한 MA 유형에 따라 파동의 특성을 변화시킬 수 있어, 여러 매매 전략에 유연하게 대응할 수 있습니다.
RoC Momentum CycleRoC Momentum Cycles (RMC) is derived from RoC (Rate of Change) indicator.
Motivation behind RMC: Addressing RoC’s Shortcomings
While the Rate of Change (RoC) indicator is a valuable tool for assessing momentum, it has notable limitations that traders must be aware of. One of the primary challenges with the traditional RoC is its sensitivity to price fluctuations, which can lead to false signals in volatile markets. This often results in premature entries or exits, impacting trading performance.
By smoothing out the RoC calculations and focusing on more consistent signal generation (using SMA on smoothed RoC), RMC offers a more consistent representation of price trends.
Momentum Cycles
RMC helps visualize momentum cycles in a much better way compared to RoC.
Long Momentum Cycle : A cross-over of smoothed RoC (blue line) above averaged signal (orange line) below zero marks start of a new potential upside cycle which ends when the blue line comes back to zero line from above.
Short Momentum Cycle : A cross-under of blue line below orange line above zero marks beginning of a potential downside cycle which ends when the blue line comes back to zero from below.
Third-order moment by TonymontanovThe "Third-order moment" indicator is designed to help traders identify asymmetries and potential turning points in a financial instrument's price distribution over a specified period. By calculating the skewness of the price distribution, this indicator provides insights into the potential future movement direction of the market.
User Parameters:
- Length: This parameter defines the number of bars (or periods) used to compute the mean and third-order moment. A longer length provides a broader historical context, which may smooth out short-term volatility.
- Source: The data input for calculations, defaulting to the closing price of each bar, although users can select alternatives like open, high, low, or any custom value to suit their analysis preferences.
Operational Algorithm:
1. Mean Calculation:
- The indicator begins by calculating the arithmetic mean of the selected data source over the specified period.
2. Third-order Moment Calculation:
- A deviation from the mean is calculated for each data point. These deviations are then cubed to capture any asymmetry in the price distribution.
- The third-order moment is determined by summing these cubed deviations over the specified length and dividing by the number of periods, providing a measure of skewness.
3. Graphical Representation:
- The indicator plots the third-order moment as a column plot. The color of the columns changes based on the sign of the moment: green for positive and red for negative, suggesting bullish and bearish skewness, respectively.
- A zero line is included to help visualize transitions between positive and negative skewness clearly.
- Additionally, the background color shifts depending on whether the third-order moment is above or below zero, further highlighting the prevailing market sentiment.
The "Third-order moment" indicator is a valuable tool for traders looking to gauge the market's skewness, helping identify potential trend continuations or reversals. By understanding the dominance of positive or negative skewness, traders can make more informed decisions.
Asymmetric volatilityThe "Asymmetric Volatility" indicator is designed to visualize the differences in volatility between upward and downward price movements of a selected instrument. It operates on the principle of analyzing price movements over a specified time period, with particular focus on the symmetrical evaluation of both price rises and falls.
User Parameters:
- Length: This parameter specifies the number of bars (candles) used to calculate the average volatility. The larger the value, the longer the time period, and the smoother the volatility data will be.
- Source: This represents the input data for the indicator calculations. By default, the close value of each bar is used, but the user can choose another data source (such as open, high, low, or any custom value).
Operational Algorithm:
1. Movement Calculation:
- UpMoves: Computed as the positive difference between the current bar value and the previous bar value, if it is greater than zero.
- DownMoves: Computed as the positive difference between the previous bar value and the current bar value, if it is greater than zero.
2. Volatility Calculation:
- UpVolatility: This is the arithmetic mean of the UpMoves values over the specified period.
- DownVolatility: This is the arithmetic mean of the DownMoves values over the specified period.
3. Graphical Representation:
- The indicator displays two plots: upward and downward volatility, represented by green and red lines, respectively.
- The background color changes based on which volatility is dominant: a green background indicates that upward volatility prevails, while a red background indicates downward volatility.
The indicator allows traders to quickly assess in which direction the market is more volatile at the moment, which can be useful for making trading decisions and evaluating the current market situation.
DWMA & Normalized DWMA St. Dev.The Distance Weighted Moving Average With Standard Deviations enhanced by Normalizing it (DWMA & NDWMA) is an advanced technical indicator designed to identify trends, potential breakouts, and reversals while accounting for market volatility. By combining a weighted approach to moving averages with dynamic standard deviations and a normalized component, this tool offers a robust framework for both short-term traders and long-term investors. It brings together several layers of trend analysis to provide clearer signals and minimize market noise.
1. DWMA (Distance Weighted Moving Average)
At its core, the DWMA assigns more weight to price points that are closer in value to the current price. Unlike traditional moving averages that focus on time-based proximity, DWMA highlights price similarity, making it more adaptive to sudden changes in the market. This helps to smooth out erratic price movements while staying responsive to meaningful shifts.
2. DWMA SD (Standard Deviation)
The DWMA SD measures how much the DWMA fluctuates from its mean over a specified period. By analyzing these fluctuations, the DWMA SD provides a volatility assessment of the DWMA itself, offering insights into the stability or turbulence of the current trend. This is a critical aspect for traders who want to gauge whether a trend is steady or losing momentum.
3. DWMA WSD (Weighted Standard Deviations)
The DWMA WSD introduces a volatility-based channel around the DWMA by multiplying the standard deviation with user-defined weights. This creates dynamic upper and lower bands, allowing traders to identify potential overbought and oversold conditions. When the price crosses these bands, it signals possible trend reversals or breakout opportunities, helping traders make more informed decisions on entry and exit points.
4. NDWMA (Normalized DWMA)
The Normalized DWMA takes the DWMA one step further by adjusting it relative to the current price level. This normalization ensures that the DWMA remains comparable across different price ranges, whether the asset’s price is high or low. This component is particularly useful for analyzing assets with volatile or widely varying price levels, as it makes trends easier to spot and interpret.
5. NDWMA SD (Standard Deviation)
The NDWMA SD works similarly to the DWMA SD, but it focuses on the volatility of the normalized DWMA. It reflects how much the normalized DWMA fluctuates around its average, providing an additional perspective on market conditions. Traders can use this to detect shifts in the strength of the trend and to anticipate potential changes in direction.
6. Signals
The Signals generated by this indicator combine insights from both the DWMA and NDWMA:
Long Signals (L) occur when the price moves above the DWMA’s upper band and the NDWMA confirms a positive trend. This suggests that the market is gaining momentum, making it a potential buy signal.
Short Signals (S) are triggered when the price falls below the DWMA’s lower band, and the NDWMA shows weakness. This indicates a possible bearish trend, signaling traders to consider selling or shorting.
These signals are designed to filter out false signals and provide more reliable trend confirmations by leveraging the combined power of both moving averages and their volatility bands.
The DWMA & NDWMA indicator provides a sophisticated approach to trend analysis by merging price-weighted moving averages with volatility bands and normalization. Its multi-layered structure offers a detailed perspective on price movements and trends, helping traders identify potential opportunities with greater accuracy.
Custom 4 Moving Averages with Styles & ThresholdsThis Pine Script indicator is designed to provide traders with a unique method of analyzing price action through four customizable moving averages, alongside buy and sell threshold detection. The script is fully original and adds value by allowing traders to configure and visualize multiple MAs with different smoothing options, and by detecting critical buy/sell moments based on the interaction between price and the moving averages.
What the Script Does:
Custom Moving Averages: The script plots four distinct moving averages (MA1, MA2, MA3, and MA4) on the chart. Each MA can be configured for length, offset, and optional smoothing to match different trading strategies. This flexibility allows traders to tailor the script for various timeframes, trend detection, and market conditions.
Buy (BT) and Sell (ST) Threshold Detection: The indicator identifies critical points for buying and selling:
Buy Threshold (BT): The script identifies potential buy points when the current candle's low is above the MA2 from the previous candle, suggesting potential upward momentum.
Sell Threshold (ST): It detects potential sell points when the current MA2 falls below the previous candle’s low, indicating possible downward momentum. These thresholds are clearly marked on the chart with green arrows for BT (Buy) and red arrows for ST (Sell).
Horizontal Threshold Lines: Horizontal lines are drawn when BT or ST conditions are met. These lines help traders visualize support and resistance levels, providing clarity in decision-making. The length of these lines is customizable, allowing users to control how long they remain visible on the chart.
Dynamic Cleanup of Old Lines: To keep the chart clean and reduce clutter, the script automatically removes old BT and ST lines after a set period, ensuring that traders can focus on the most relevant data.
Underlying Concepts:
Moving Averages: Moving averages are a fundamental tool in technical analysis for identifying trends. This script uses various moving averages (calculated from high, low, close, and HL2) and allows for smoothing to adjust the sensitivity to price movements. Traders can apply this flexibility to multiple trading styles, from scalping to swing trading.
Threshold Conditions: The buy and sell conditions in this script are based on simple but effective price action patterns, where the interaction between price and MA2 determines entry or exit points. This approach is useful in trend-following strategies, where traders aim to capitalize on momentum shifts.
How to Use the Script:
Configure Moving Averages: Start by adjusting the lengths, offsets, and smoothing options for each moving average. For short-term trading, shorter MA lengths might be more suitable, while longer MAs can help identify broader trends.
Observe Buy and Sell Signals: Look for green arrows (BT) as potential buy signals and red arrows (ST) as potential sell signals. These signals appear when certain conditions between price and MA2 are met, giving traders clear visual cues for entries and exits.
Support/Resistance Levels: Pay attention to the horizontal lines drawn when BT or ST conditions occur. These lines can act as support or resistance levels, helping you identify potential price targets or stop-loss points.
Why This Script is Useful:
This indicator combines the power of multiple moving averages with customizable features, making it versatile for different market conditions. By adding clear buy and sell signals based on a logical threshold system, the script helps traders make informed decisions with minimal guesswork. Unlike many basic indicators, this one provides flexibility and original insight into market dynamics, making it a valuable tool for both beginner and experienced traders.
Dynamic Price Oscillator [CHE]Dynamic Price Oscillator
Overview:
Welcome to the Dynamic Price Oscillator ! This indicator is designed to help traders identify potential trend reversals and divergences by comparing short-term and long-term price movements in percentage terms. It’s a powerful tool to enhance your trading strategies by spotting bullish and bearish divergences effectively.
Key Features:
Dynamic Oscillator Calculation: The DPO calculates the percentage difference between two EMAs (Exponential Moving Averages), offering insight into the relative strength of price movements.
Bullish & Bearish Divergence Detection:
The indicator highlights divergences between price and the oscillator, allowing you to identify potential reversal points with ease.
Long-Term Divergence Option: Enable or disable long-term divergences to focus on either short-term trends or broader market movements.
High/Low Markers:
Visual markers for significant peaks and troughs in the DPO, helping you quickly spot potential trade setups.
Custom Alerts: Set up alerts for both bullish and bearish divergence signals, ensuring you never miss an important opportunity.
How to Use:
Bullish Divergence: A bullish divergence occurs when price is making lower lows, but the DPO shows higher lows. This can indicate a potential reversal to the upside.
Bearish Divergence: A bearish divergence happens when price is making higher highs, but the DPO shows lower highs. This can signal a potential downside reversal.
Customizable Settings: Adjust the fast and slow EMA periods, smoothing factor, and divergence lookback to fit your personal trading style.
Ideal For:
Swing traders and day traders looking for early signs of market reversals.
Those who want a clear, visual representation of divergence between price and momentum.
Traders who appreciate flexibility with customizable parameters and built-in alerts.
Why Use Dynamic Price Oscillator ?
This indicator gives you the edge by providing a reliable way to measure price momentum and detect divergences that are often missed by other indicators. With the option to enable long-term divergences, you can tailor the indicator to fit both short-term and long-term strategies.
Give it a try and see how the Dynamic Price Oscillator can enhance your trading performance!
Best regards Chervolino
Statistics plot1. setting the price range
At the beginning of the script, set the price range (interval). Price ranges are used to divide prices into several groups (buckets) and record how many prices have been reached within each group. For example, setting the price range to “10” will divide the price into intervals 0-10, 10-20, 20-30, and so on.
The price range can also be set manually by the user or automatically calculated based on the initial price. This allows for flexibility in adjusting price ranges for different assets and different time frames.
2. aggregate the number of times a price is reached
Record how many times the price reached each price range (e.g., 100-110, 110-120, etc.). This aggregate data is stored in a data structure called an array.
Each element of the array corresponds to a price range, and when a price reaches that range, the corresponding array value is incremented by one. This process is performed in real time, tracking price movements.
3. initializing and extending price ranges
The first bar of the script (when the chart is first loaded) divides the price ranges into several groups and initializes a count of 0 for each range.
When a price reaches a new range, the array is expanded as needed to add the new price range. This allows the script to work with any price movement, even if the price range continues to grow.
4. visualize the number of price arrivals with a histogram
The aggregated number of arrivals per price range is visually displayed in the form of a histogram. This histogram is designed to allow the user to see at a glance which price range is being reached most frequently.
For example, if prices frequently reach the 100-110 range, the histogram bar corresponding to that range will appear higher than the other ranges. This allows you to visually identify price “dwell points” or support and resistance levels.
5. display of moving averages
A moving average (MA) of the number of times a price has been reached is drawn above the histogram. Moving averages are indicators that show a smooth trend for the number of price arrivals and are useful for understanding the overall direction of price movements.
The duration of the moving average (how many data points it is calculated based on) can be set by the user. This allows for flexible analysis of short or long term price trends. 6.
6. price range tracking and labeling
The script keeps track of which price range the current price is located in. Based on this, information related to the current price range is displayed on the chart as labels.
In particular, labels indicate the beginning and end points of the price range, including which range the price was in at the beginning and which range the price reached at the end. These labels are a useful feature to visually identify price ranges on the chart.
7. labeling of current price range
To confirm which price range the current price is in, when a price reaches a specific price range, a label corresponding to that price range is displayed. This label indicates the position of the price in real-time, allowing traders to visually track where the current price is in the area.
8. calculating the start and end points of the range
The script calculates the start and end points of a range with a non-zero number of price arrivals to find the minimum and maximum of the range. This calculation allows you to see where prices are concentrated within a range.
9. out-of-range price processing
When a price reaches outside the range, the script automatically adds the array element corresponding to that price range and inserts the data in the appropriate location for the count. This allows the script to follow the price as it moves unexpectedly.
Elliott Wave Oscillator with Peak DetectionThe Elliott Wave Oscillator with Derivative Peak Detection and Breakout Bands is a technical indicator that blends traditional Elliott Wave theory with modern derivative-based peak detection and breakout bands for a clearer view of market trends.
Key Components:
Elliott Wave Oscillator (EWO):
The core of the indicator is based on the difference between two simple moving averages (SMA): a short-term SMA (default length: 5) and a long-term SMA (default length: 35).
This difference is expressed either as an absolute value or a percentage of the current price, depending on the user’s input.
Smoothing:
The EWO is smoothed using an Exponential Moving Average (EMA) to filter out noise and provide a clearer trend direction.
The smoothing length is adaptive based on the current chart's timeframe (e.g., longer smoothing for daily charts).
Derivative Peak Detection:
The smoothed EWO is analyzed for peaks (positive) and troughs (negative) by calculating the derivative (rate of change) between consecutive values.
Peaks are detected when the derivative transitions from positive to negative, while troughs are identified when the derivative switches from negative to positive.
Tolerance levels are adjustable and vary by timeframe to avoid false signals.
Breakout Bands:
Upper and lower breakout bands are dynamically generated based on the smoothed EWO.
The bands help to filter significant peaks and troughs, only highlighting those that occur beyond the breakout levels.
Users can choose to display these bands and use them to filter out less significant peaks and troughs.
Visualization:
The original, unsmoothed EWO is plotted as a histogram, with positive values in green and negative values in red.
The smoothed EWO is plotted as a blue line, providing a clearer view of the underlying trend.
The breakout bands, if enabled, are plotted as white lines to visualize the upper and lower bounds of the oscillator's movement.
Positive peaks and negative troughs that meet the filtering criteria are marked with purple triangles (for peaks) and red triangles (for troughs) on the chart.
Customization Options:
Timeframe-based Smoothing and Tolerance: Different smoothing lengths and tolerance levels can be set for daily, hourly, and 5-minute charts.
Breakout Bands: Users can toggle the display of breakout bands and adjust their visual properties.
Peak Filtering: Peaks and troughs can be filtered based on whether they break out beyond the bands, or all peaks can be shown.
This indicator provides a unique blend of trend detection through the Elliott Wave Oscillator and derivative analysis to highlight significant market reversals while offering breakout bands as a filtering mechanism for false signals.
SMA Angle AlertsSMA Angle Alerts
Overview:
The "SMA Angle Alerts" indicator measures the angle of the Simple Moving Average (SMA) over a specified number of bars, helping traders identify when the market is gaining or losing momentum. The indicator provides real-time alerts when the angle of the SMA crosses user-defined thresholds, indicating strong upward or downward movements in the trend.
How it works:
SMA Calculation: The indicator calculates the Simple Moving Average (SMA) of the closing price over a customizable length.
Angle Calculation: It determines the slope of the SMA by measuring the price change over a set number of bars and converts that slope into an angle (in degrees).
Alerts: Alerts are triggered when the SMA angle crosses above or below specified thresholds, allowing traders to react to significant trend changes in real time.
Key Features:
Customizable SMA and Angle Threshold:
The length of the SMA and the threshold for the angle can be customized to fit your trading strategy.
Real-Time Alerts:
Alerts are triggered when the angle of the SMA crosses upward or downward by more than the defined threshold, providing actionable insights into trend strength and direction.
Visual Markers:
The chart visually highlights points where the angle of the SMA exceeds the threshold, with "UP" and "DOWN" labels to mark when the angle is steep enough to signal significant trend changes.
Background Color Alerts:
The chart’s background color changes when the angle exceeds the thresholds—green for upward crosses and red for downward crosses—allowing traders to quickly spot moments of interest.
Plotting the Angle:
The slope of the SMA is plotted in degrees, giving traders a visual representation of the market's momentum. Horizontal lines mark the upper and lower angle thresholds, offering a clear view of when price momentum is accelerating or decelerating.
Use Case:
This indicator is ideal for traders looking to catch strong trend reversals, breakouts, or momentum shifts. It can be used across multiple timeframes to monitor market momentum and identify key moments when the trend is gaining strength in either direction.
Customization:
SMA Length: Adjust the length of the SMA to suit different timeframes or asset classes.
Angle Threshold: Define the angle at which alerts are triggered, allowing you to focus on strong upward or downward movements.
Bars to Check: Customize how many bars are used to calculate the slope and angle of the SMA.
Alerts:
Set alerts to notify you when the SMA is angling up or down by more than your specified threshold, ensuring that you never miss a significant trend shift.
Crypto Volatility Bitcoin Correlation Strategy Description:
The Crypto Volatility Bitcoin Correlation Strategy is designed to leverage market volatility specifically in Bitcoin (BTC) using a combination of volatility indicators and trend-following techniques. This strategy utilizes the VIXFix (a volatility indicator adapted for crypto markets) and the BVOL7D (Bitcoin 7-Day Volatility Index from BitMEX) to identify periods of high volatility, while confirming trends with the Exponential Moving Average (EMA). These components work together to offer a comprehensive system that traders can use to enter positions when volatility and trends are aligned in their favor.
Key Features:
VIXFix (Volatility Index for Crypto Markets): This indicator measures the highest price of Bitcoin over a set period and compares it with the current low price to gauge market volatility. A rise in VIXFix indicates increasing market volatility, signaling that large price movements could occur.
BVOL7D (Bitcoin 7-Day Volatility Index): This volatility index, provided by BitMEX, measures the volatility of Bitcoin over the past 7 days. It helps traders monitor the recent volatility trend in the market, particularly useful when making short-term trading decisions.
Exponential Moving Average (EMA): The 50-period EMA acts as a trend indicator. When the price is above the EMA, it suggests the market is in an uptrend, and when the price is below the EMA, it suggests a downtrend.
How It Works:
Long Entry: A long position is triggered when both the VIXFix and BVOL7D indicators are rising, signaling increased volatility, and the price is above the 50-period EMA, confirming that the market is trending upward.
Exit: The strategy exits the position when the price crosses below the 50-period EMA, which signals a potential weakening of the uptrend and a decrease in volatility.
This strategy ensures that traders only enter positions when the volatility aligns with a clear trend, minimizing the risk of entering trades during periods of market uncertainty.
Testing and Timeframe:
This strategy has been tested on Bitcoin using the daily timeframe, which provides a longer-term perspective on market trends and volatility. However, users can adjust the timeframe according to their trading preferences. It is crucial to note that this strategy does not include comprehensive risk management, aside from the exit condition when the price crosses below the EMA. Users are strongly advised to implement their own risk management techniques, such as setting appropriate stop-loss levels, to safeguard their positions during high volatility periods.
Utility:
The Crypto Volatility Bitcoin Correlation Strategy is particularly well-suited for traders who aim to capitalize on the high volatility often seen in the Bitcoin market. By combining volatility measurements (VIXFix and BVOL7D) with a trend-following mechanism (EMA), this strategy helps identify optimal moments for entering and exiting trades. This approach ensures that traders participate in potentially profitable market moves while minimizing exposure during times of uncertainty.
Use Cases:
Volatility-Based Entries: Traders looking to take advantage of market volatility spikes will find this strategy useful for timing entry points during market swings.
Trend Confirmation: By using the EMA as a confirmation tool, traders can avoid entering trades that go against the trend, which can result in significant losses during volatile market conditions.
Risk Management: While the strategy exits when price falls below the EMA, it is important to recognize that this is not a full risk management system. Traders should use caution and integrate additional risk measures, such as stop-losses and position sizing, to better manage potential losses.
How to Use:
Step 1: Monitor the VIXFix and BVOL7D indicators. When both are rising and the Bitcoin price is above the EMA, the strategy will trigger a long entry, indicating that the market is experiencing increased volatility with a confirmed uptrend.
Step 2: Exit the position when the price drops below the 50-period EMA, signaling that the trend may be reversing or weakening, reducing the likelihood of continued upward price movement.
This strategy is open-source and is intended to help traders navigate volatile market conditions, particularly in Bitcoin, using proven indicators for volatility and trend confirmation.
Risk Disclaimer:
This strategy has been tested on the daily timeframe of Bitcoin, but users should be aware that it does not include built-in risk management except for the below-EMA exit condition. Users should be extremely cautious when using this strategy and are encouraged to implement their own risk management, such as using stop-losses, position sizing, and setting appropriate limits. Trading involves significant risk, and this strategy does not guarantee profits or prevent losses. Past performance is not indicative of future results. Always test any strategy in a demo environment before applying it to live markets.
Candle Speed and AccelerationCandle Speed and Acceleration Indicator
This indicator calculates the speed and acceleration of candlesticks in points per minute (P/M), providing traders with insights into the momentum and volatility of price movements during the trading session.
Features:
Speed Calculation: Measures the change in price per minute, helping you understand how quickly the market is moving.
Acceleration Measurement: Tracks the change in speed between consecutive candles, offering an additional layer of momentum analysis.
Real-Time Display: Shows the current, previous, and second previous candles' speed and acceleration in a table on the chart.
Crosshair Integration: Displays speed and acceleration at the crosshair location, offering instant feedback as you hover over the chart.
Alerts: Notifies you when candle speed exceeds a customizable threshold, helping you catch significant market moves as they happen.
Permanent Markers: Marks candles on the chart when the speed threshold is exceeded, visually highlighting high-speed candles.
This tool is essential for traders who want to analyze the momentum and acceleration of market movements, providing clear visual cues and alerts for potential trading opportunities.
SMA, VWAP with Buy/Sell Signals - First Signal OnlyIndicator: SMA, VWAP with First Buy/Sell Signals
Overview:
This indicator plots two Simple Moving Averages (SMA 20 and SMA 200) and the Volume-Weighted Average Price (VWAP) on the chart, with fully customizable colors and line thickness. Additionally, it provides buy and sell signals based on the price action relative to these indicators.
Buy Signal:
A buy signal is generated when a green candle (bullish candle) closes above the SMA 20, SMA 200, and VWAP without touching them (i.e., the low of the candle is above all three). This signal will only be plotted for the first such candle of the day to avoid signal clutter.
Sell Signal:
A sell signal is generated when a candle closes below the SMA 20, SMA 200, and VWAP without touching them (i.e., the high of the candle is below all three). Similar to the buy signal, it will only be plotted for the first qualifying candle of the day.
Customization:
SMAs and VWAP: Users can adjust the lengths, colors, and line thickness of the SMAs and VWAP to suit their preferences.
Signal Shape: You can choose from different shapes (arrow, circle, or cross) to represent the buy and sell signals on the chart.
Key Features:
First Candle Only: Both buy and sell signals are generated only for the first candle that satisfies the conditions, ensuring clean and actionable signals.
Visual Customization: Full control over the appearance of the indicator, including signal shapes and line properties.
Works Across Assets: This indicator is applicable to any asset (stocks, forex, crypto) where price action relative to moving averages and VWAP is important.