capital_managementLibrary "capital_management"
TODO: add library description here
Volume_calculation(precent_risk, order_entry_price, stop_loss_price)
TODO: Volume calculation function by placing orders with fiven % risk
Parameters:
precent_risk (float)
order_entry_price (float)
stop_loss_price (float)
Returns: stop_loss_price: Price that place stop loss order
インジケーターとストラテジー
Blockchain Fundamentals: Global LiquidityGlobal Liquidity Indicator Overview
This indicator provides a comprehensive technical analysis of liquidity trends by deriving a Global Liquidity metric from multiple data sources. It applies a suite of technical indicators directly on this liquidity measure, rather than on price data. When this metric is expanding Bitcoin and crypto tends to bullish conditions.
Features:
1. Global Liquidity Calculation
Data Integration: Combines multiple market data sources using a ratio-based formula to produce a unique liquidity measure.
Custom Metric: This liquidity metric serves as the foundational input for further technical analysis.
2. Timeframe Customization
User-Selected Period: Users can select the data timeframe (default is 2 months) to ensure consistency and flexibility in analysis.
3. Additional Technical Indicators
RSI, Momentum, ROC, MACD, and Stochastic:
Each indicator is computed using the Global Liquidity series rather than price.
User-selectable toggles allow for enabling or disabling each individual indicator as desired.
4. Enhanced MACD Visualization
Dynamic Histogram Coloring:
The MACD histogram color adjusts dynamically: brighter hues indicate rising histogram values while darker hues indicate falling values.
When the histogram is above zero, green is used; when below zero, red is applied, offering immediate visual insight into momentum shifts.
Conclusion
This indicator is an enlightening tool for understanding liquidity dynamics, aiding in macroeconomic analysis and investment decision-making by highlighting shifts in liquidity conditions and market momentum.
Fractal Trend Anticipator (FTA)How to Use FTA
Purpose:
FTA is designed to detect when a consolidating (or choppy) market—with a high choppiness index—is poised to break into a trend as indicated by an RSI crossover.
Signals:
Bullish Breakout: When the Choppiness Index is above your set threshold and the RSI crosses upward over 50, a bullish arrow (triangle up) appears below the bar.
Bearish Breakout: Conversely, when the RSI crosses downward from above 50 under high choppiness, a bearish arrow (triangle down) appears above the bar.
Trading Insight:
In crypto markets, when price is range-bound, a sudden release of momentum can be captured early by FTA. Use these signals as early alerts to join moves as they begin—whether you plan to ride a short-term spike or a medium-term trend.
Feel free to adjust the and parameters to suit your trading style and asset volatility. Enjoy trading with your updated Fractal Trend Anticipator!
Volatility-Adjusted Momentum Oscillator (VAMO)Concept & Rationale: This indicator combines momentum and volatility into one oscillator. The idea is that a price move accompanied by high volatility has greater significance. We use Rate of Change (ROC) for momentum and Average True Range (ATR) for volatility, multiplying them to gauge “volatility-weighted momentum.” This concept is inspired by the Weighted Momentum & Volatility Indicator, which multiplies normalized ROC and ATR values. The result is shown as a histogram oscillating around zero – rising green bars indicate bullish momentum, while falling red bars indicate bearish momentum. When the histogram crosses above or below zero, it provides clear buy/sell signals. Higher magnitude bars suggest a stronger trend move. Crypto markets often see volatility spikes preceding big moves, so VAMO aims to capture those moments when momentum and volatility align for a powerful breakout.
Key Features:
Momentum-Volatility Fusion: Measures momentum (price ROC) adjusted by volatility (ATR). Strong trends register prominently only when price change is significant and volatility is elevated.
Intuitive Histogram: Plotted as a color-coded histogram around a zero line – green bars above zero for bullish trends, red bars below zero for bearish. This makes it easy to visualize trend strength and direction at a glance.
Clear Signals: A cross above 0 signals a buy, and below 0 signals a sell. Traders can also watch for the histogram peaking and then shrinking as an early sign of a trend reversal (e.g. bars switching from growing to shrinking while still positive could mean bullish momentum is waning).
Optimized for Volatility: Because ATR is built-in, the oscillator naturally adapts to crypto volatility. In calm periods, signals will be smaller (reducing noise), whereas during volatile swings the indicator accentuates the move, helping predict big price swings.
Customization: The lookback period is adjustable. Shorter periods (e.g. 5-10) make it more sensitive for scalping, while longer periods (20+) smooth it out for swing trading.
How to Use: When VAMO bars turn green and push above zero, it indicates bullish momentum with strong volatility – a cue that price is likely to rally in the near term. Conversely, red bars below zero signal bearish pressure. For example, if a coin’s price has been flat and then VAMO spikes green above zero, it suggests an explosive upward move is brewing. Traders can enter on the zero-line cross (or on the first green bar) and consider exiting when the histogram peaks and starts shrinking (signaling momentum slowdown). In sideways markets, VAMO will hover near zero – staying out during those low-volatility periods helps avoid false signals. This indicator’s strength is catching the moment when a quiet market turns volatile in one direction, which often precedes the next few candlesticks of sustained movement.
Markov + Monte Carlo Simulation with EVMarkov Monte Carlo Projection (MMCP) – A Probabilistic Approach to Price Forecasting
Introduction: A New Approach to Price Projection
The Markov Monte Carlo Projection (MMCP) is an advanced stochastic forecasting tool that models potential future price paths using a combination of Markov Chain transition probabilities and Monte Carlo simulations. Unlike traditional technical indicators that rely on fixed formulas, MMCP employs probability distributions and simulated price movement paths to estimate future price behavior dynamically.
This indicator is designed to adapt to changing market conditions and provides traders with a probabilistic framework rather than a fixed forecast. By incorporating volatility modeling, MMCP enables traders to size projections proportionally to recent price action, making it an adaptive and flexible forecasting tool.
Mathematical Foundations
Markov Chains: Modeling Probability of Price Movements
A Markov Chain is a stochastic process where the probability of transitioning to the next state depends only on the current state and not on past states (i.e., it is memoryless).
For price movement, MMCP analyzes the past N bars (set by the lookback window) to determine the transition probabilities of price moving up, down, or remaining the same based on past behavior:
Pup=Number of Up MovesTotal Moves
Pup=Total MovesNumber of Up Moves
Pdown=Number of Down MovesTotal Moves
Pdown=Total MovesNumber of Down Moves
Psame=1−(Pup+Pdown)
Psame=1−(Pup+Pdown)
These probabilities guide how future price movements are simulated, ensuring that projections reflect historical price behavior tendencies.
Monte Carlo Simulations: Generating Possible Futures
Monte Carlo simulations involve running many random trials to estimate possible outcomes. Each trial simulates a future price path by:
Randomly selecting a direction based on the Markov probabilities Pup,Pdown,PsamePup,Pdown,Psame.
Determining the magnitude of the price movement using a normally distributed volatility model.
Iterating this process across multiple forecast bars to simulate a range of potential price paths.
This process does not predict a single outcome, but rather generates a probability-weighted range of future price possibilities.
Volatility Modeling: Scaling Movements Proportionally
Why We Use Standard Deviation (σσ)
Price movement is inherently volatile, and the magnitude of price shifts must be scaled relative to recent volatility. MMCP calculates rolling price returns and then derives the standard deviation of those returns:
σ=stdev(price returns,lookback)
σ=stdev(price returns,lookback)
The Volatility Multiplier allows users to adjust the impact of this volatility on projected movements. This makes the indicator adaptive to different asset price ranges.
Key User Adjustments
1. Volatility Multiplier – Tuning Projections for Different Assets
The scale of the Volatility Multiplier must be tuned for each asset because it is relative to the magnitude of price action. For example:
Low-priced assets (e.g., $2.50 stocks) → A multiplier of 0.1 works best.
Mid-priced assets (e.g., $250 stocks) → A multiplier of 3 works best.
High-priced assets (e.g., Bitcoin) → A multiplier of 1000 works best.
🔹 If projections seem too extreme, decrease the multiplier.
🔹 If projections seem too flat, increase the multiplier.
The Volatility Multiplier can also be fine-tuned to make the projected signal proportionate to the immediately preceding price action.
2. Expected Value (EV) Path – Analyzing Aggregate Future Probabilities
The EV Line is a computed average of all simulated paths, giving traders an expected mean trajectory.
If you find that the EV Line is not visible, try increasing the volatility multiplier to make it more pronounced.
3. Projection Inversion – Enhancing Analysis with Paired Indicators
A unique feature of MMCP is the projection inversion toggle, designed to allow traders to run multiple instances of the indicator in tandem.
When one instance is set to normal projection and another to inverted projection, traders can pair them together using identical settings (except inversion). This setup allows for a mirrored probability perspective and enhances visualizing volatility dynamics.
Additionally, traders can use multiple sets of paired indicators, each with a different lookback window, to build a multi-layered, probability-driven market visualization. This dynamic approach provides an evolving structure of probable price movement in different time frames, offering deeper insights into potential market conditions.
How MMCP Works in Real-Time
Each new bar triggers a fresh Monte Carlo simulation, meaning that projections organically evolve with the market. This ensures that MMCP is always responding to current conditions, rather than applying static assumptions.
How to Use MMCP in Trading
✔ Identifying Potential Reversal & Continuation Zones
If most Monte Carlo paths project upward, bullish momentum is likely.
If most Monte Carlo paths project downward, bearish momentum is likely.
The Expected Value (EV) Line can help confirm the most probable trajectory.
✔ Analyzing Market Sentiment in Real Time
Use multiple instances of MMCP with different lookback windows to capture short-term vs. long-term sentiment.
Enable projection inversion to analyze potential mirrored moves.
✔ Fine-Tuning MMCP for Your Strategy
Adjust the Volatility Multiplier to match the price scale of your asset.
Increase the number of simulations to improve statistical robustness.
Use shorter lookback windows for more responsive predictions, or longer windows for more stable forecasts.
Why MMCP is a Game-Changer
✅ Dynamic & Probabilistic – Unlike fixed indicators, MMCP adapts in real-time.
✅ Fully Stochastic – MMCP embraces uncertainty using Markov models & Monte Carlo simulations.
✅ Customizable for Any Asset – Adjust the Volatility Multiplier for small or large price movements.
✅ Live Updates – The projection organically evolves with every new price bar.
✅ Multi-Perspective Analysis – Traders can run paired normal and inverted projections for deeper insights.
By tuning Volatility Multiplier, Lookback Window, and Projection Inversion, traders can customize MMCP to fit their strategy.
Final Thoughts
The Markov Monte Carlo Projection (MMCP) is not about making absolute predictions—it is about understanding probability distributions in price action.
By leveraging Monte Carlo simulations, Markov transition probabilities, and dynamic volatility modeling, MMCP gives traders a powerful probability-based edge in forecasting potential price movement.
Enhanced Bollinger Bands Strategy with SL/TP// Title: Enhanced Bollinger Bands Strategy with SL/TP
// Description:
// This strategy is based on the classic Bollinger Bands indicator and incorporates Stop Loss (SL) and Take Profit (TP) levels for automated trading. It identifies potential long and short entry points based on price crossing the lower and upper Bollinger Bands, respectively. The strategy allows users to customize several parameters to suit different market conditions and risk tolerances.
// Key Features:
// * **Bollinger Bands:** Uses Simple Moving Average (SMA) as the basis and calculates upper and lower bands based on a user-defined standard deviation multiplier.
// * **Customizable Parameters:** Offers extensive customization, including SMA length, standard deviation multiplier, Stop Loss (SL) in pips, and Take Profit (TP) in pips.
// * **Long/Short Position Control:** Allows users to independently enable or disable long and short positions.
// * **Stop Loss and Take Profit:** Implements Stop Loss and Take Profit levels based on pip values to manage risk and secure profits. Entry prices are set to the band levels on signals.
// * **Visualizations:** Provides options to display Bollinger Bands and entry signals on the chart for easy analysis.
// Strategy Logic:
// 1. **Bollinger Bands Calculation:** The strategy calculates the Bollinger Bands using the specified SMA length and standard deviation multiplier.
// 2. **Entry Conditions:**
// * **Long Entry:** Enters a long position when the closing price crosses above the lower Bollinger Band and the `Enable Long Positions` setting is enabled.
// * **Short Entry:** Enters a short position when the closing price crosses below the upper Bollinger Band and the `Enable Short Positions` setting is enabled.
// 3. **Exit Conditions:**
// * **Stop Loss:** Exits the position if the price reaches the Stop Loss level, calculated based on the input `Stop Loss (Pips)`.
// * **Take Profit:** Exits the position if the price reaches the Take Profit level, calculated based on the input `Take Profit (Pips)`.
// Input Parameters:
// * **SMA Length (length):** The length of the Simple Moving Average used to calculate the Bollinger Bands (default: 20).
// * **Standard Deviation Multiplier (mult):** The multiplier applied to the standard deviation to determine the width of the Bollinger Bands (default: 2.0).
// * **Enable Long Positions (enableLong):** A boolean value to enable or disable long positions (default: true).
// * **Enable Short Positions (enableShort):** A boolean value to enable or disable short positions (default: true).
// * **Pip Value (pipValue):** The value of a pip for the traded instrument. This is crucial for accurate Stop Loss and Take Profit calculations (default: 0.0001 for most currency pairs). **Important: Adjust this value to match the specific instrument you are trading.**
// * **Stop Loss (Pips) (slPips):** The Stop Loss level in pips (default: 10).
// * **Take Profit (Pips) (tpPips):** The Take Profit level in pips (default: 20).
// * **Show Bollinger Bands (showBands):** A boolean value to show or hide the Bollinger Bands on the chart (default: true).
// * **Show Entry Signals (showSignals):** A boolean value to show or hide entry signals on the chart (default: true).
// How to Use:
// 1. Add the strategy to your TradingView chart.
// 2. Adjust the input parameters to optimize the strategy for your chosen instrument and timeframe. Pay close attention to the `Pip Value`.
// 3. Backtest the strategy over different periods to evaluate its performance.
// 4. Use the `Enable Long Positions` and `Enable Short Positions` settings to customize the strategy for specific market conditions (e.g., only long positions in an uptrend).
// Important Notes and Disclaimers:
// * **Backtesting Results:** Past performance is not indicative of future results. Backtesting results can be affected by various factors, including market volatility, slippage, and transaction costs.
// * **Risk Management:** This strategy is provided for informational and educational purposes only and should not be considered financial advice. Always use proper risk management techniques when trading. Adjust Stop Loss and Take Profit levels according to your risk tolerance.
// * **Slippage:** The strategy takes into account slippage by specifying a slippage parameter on the `strategy` declaration. However, real-world slippage may vary.
// * **Market Conditions:** The performance of this strategy can vary significantly depending on market conditions. It may perform well in trending markets but poorly in ranging or choppy markets.
// * **Pip Value Accuracy:** **Ensure the `Pip Value` is correctly set for the specific instrument you are trading. Incorrect pip value will result in incorrect stop loss and take profit placement.** This is critical.
// * **Broker Compatibility:** The strategy's performance may vary depending on your broker's execution policies and fees.
// * **Disclaimer:** I am not a financial advisor, and this script is not financial advice. Use this strategy at your own risk. I am not responsible for any losses incurred while using this strategy.
Zerg range filter credit to Kivanc turkish pinecoder for base indicator i reworked with chatgpt and some common sense
this indicator similar to the ADX but i think its better visually to keep you out of market conditions that are unfavorable.
i made original indicator to work in a 0-100 enviroment (before it was a zero middle line oscillator) and added background coloring that has a lower and higher threshold setting. i also added a smoothing moving average. this will trigger threshold levels (not the core oscillator)
above higher level would indicate trending market conditions and its purple. these are the areas where you might want to buy low period moving average bounces like 10 or 21 ema
lower band will paint indicator background blue and its cold, meaning range bound trade ideas are likely play out better. selling resistance and buying horizontal supports for example.
you are encourage to play with lookback period and change thresholds until you find something that works for your trading.
on the picture above it illustrates how i intended its usage.
it also shows divergences which was not intended but also a function.
you can also observe as the oscillator likes to coil up into a tight range (horizontal or a wedge formation) and when these break their trendlines explosive moves are incoming usually.
if you have a trading system and can generate a lot of signals but want to filter out some loser trades this could be the indicator you were looking for.
i hope this will be inline with community guidelines. my other publishing got removed unfortunately
𝓜𝓐 𝓢𝓶𝓸𝓸𝓽𝓱𝓮𝓭 𝓡𝓢𝓘 𝓕𝓸𝓻 𝓛𝓸𝓸𝓹MA Smoothed Source For RSI Loop | Crypto_Mercenary_
Conceptual Foundation and Innovation
The "MA Smoothed Source For RSI Loop" indicator developed by Crypto_Mercenary_ innovates by smoothing the source data used for RSI calculation with various moving averages before feeding it into a for-loop scoring system. Rather than smoothing the RSI itself, this approach focuses on pre-processing the price data to reduce noise, thereby providing a cleaner input for RSI computation. The for-loop then evaluates this smoothed RSI to generate momentum signals, offering traders a refined method for detecting market trends and potential reversals.
Technical Composition and Calculation
The indicator's functionality is divided into two main parts:
Source Smoothing: Before calculating RSI, the source data (typically close price) is smoothed using one of several moving averages (EMA, SMA, WMA, VWMA, HMA, RMA, DEMA, or none) as selected by the user. This smoothing aims to filter out short-term volatility, providing a more consistent base for RSI calculation.
RSI Calculation and For-Loop Scoring:
RSI: Calculated using the smoothed source data over a user-defined length.
For-Loop Mechanism: A loop runs from a to b, comparing the current RSI value with past values of this smoothed RSI. A score (counter) is generated, which increases or decreases based on whether the current RSI exceeds or falls below past values. If the weighted option is activated, this comparison gives more weight to recent data points, adjusting the score accordingly.
The final score is then potentially normalized for better interpretation, compared against thresholds to determine market momentum signals.
Features and User Inputs
This indicator is highly customizable, allowing traders to tailor its behavior:
Weighted Calculation: Option to adjust scoring to favor recent price action.
RSI Length: Sets the period for RSI calculation.
Source: The price data to be smoothed before RSI calculation, default is close.
MA Type: Choice from various moving averages to smooth the source data.
Smooth Length: Length of the moving average used for smoothing.
For Loop Range: Defines the historical range (a to b) for the scoring loop.
Thresholds: Custom thresholds to define when signals for uptrends or downtrends are generated.
Practical Applications
This indicator is particularly beneficial for:
Identifying Momentum Shifts: The scoring system helps in detecting potential changes in market momentum.
Noise Reduction: By smoothing the source data, it aims to provide more reliable RSI signals in volatile markets.
Trend Analysis: Assists in confirming or challenging the current market trend based on the smoothed RSI's performance.
Advantages and Strategic Value
The "MA Smoothed Source For RSI Loop" offers an advantage by focusing on cleaning the input data for RSI, which can lead to more accurate momentum readings. Its flexibility in configuration allows traders to adapt the indicator to different market conditions or asset volatilities, enhancing its strategic value in trading decisions.
Alerts and Visual Cues
Visual Signals: The indicator plots the loop score, with colors indicating uptrends (gold) or downtrends (blue). Horizontal lines at thresholds and shaded areas between them provide visual aids for trend analysis.
**No explicit alerts in the script, but users can set up custom alerts based on the signals.
Summary and Usage Tips
The "MA Smoothed Source For RSI Loop | Crypto_Mercenary_" provides a nuanced approach to RSI by smoothing the price data before its calculation, resulting in potentially more reliable signals. Traders can use this indicator to gain a clearer picture of market momentum, adjusting parameters to fit different market behaviors or trading strategies. Remember, the effectiveness of this tool largely depends on its customization to the specific market context.
Note: Backtests are based on past results and do not guarantee future performance.
Opening Range Breakout (ORB)This is an Opening Range Break indicator. Best if used on a 5 minute chart. It plots the opening 30 minutes high and low of a ticker. (meaning mostly for stocks, options, etfs) and then it alerts a buy signal upon break of opening high and a sell signal upon break of opening low. This is a day trading type of indicator and there is a new opening range everyday.
Cognitive Echo IndexCognitive Echo Index – User Guide
Overview
The Cognitive Echo Index is a composite indicator that combines several technical aspects—including price deviation from a moving average, normalized volatility (via ATR), and volume variations—to create a single numeric value. The output is scaled between -100 and +100, offering insights into market momentum and potential trend reversals.
How It Works
Price Component:
The indicator calculates the percentage change between the current price and its 14-period simple moving average (SMA). This helps identify how far the price deviates from its recent trend.
Volatility Component:
Using the Average True Range (ATR) over a 14-period, the script normalizes current ATR against its 14-period SMA. This shows relative volatility, highlighting unusual market activity.
Volume Component:
It computes the percentage change between the current volume and its 14-period SMA to detect spikes or drops in trading activity.
Composite Calculation:
The three components are summed together to produce the final index value, which is then clipped to remain between -100 and +100.
Interpreting the Indicator
Indicator Value Scale:
Positive Values (0 to +100):
Suggest that bullish forces are stronger. Higher values (e.g., above +50) could indicate a strong bullish sentiment.
Negative Values (0 to -100):
Indicate bearish pressures. Lower values (e.g., below -50) may signal strong bearish conditions.
Zero Level:
The midline indicates a balanced market condition with no dominant trend.
Key Horizontal Levels:
+50 Level:
When the indicator crosses above +50, it can be interpreted as a strong bullish signal.
-50 Level:
When the indicator crosses below -50, it can be considered a strong bearish signal.
Usage Tips
Confirmation Tool:
Use the Cognitive Echo Index as an additional confirmation tool in conjunction with other technical indicators or chart patterns to make more informed trading decisions.
Parameter Adjustments:
The script uses a 14-period setting for the moving average, ATR, and volume SMA by default. Depending on your trading timeframe or asset, consider tweaking these periods for better sensitivity.
Trend Analysis:
Watch how the indicator behaves during major price moves. A divergence between the index and the price trend (e.g., price rises while the index falls) may suggest a potential reversal or a false breakout.
Risk Management:
Always incorporate sound risk management practices. Use stop losses and position sizing rules, and consider the indicator as one part of your overall trading strategy.
Customization
Adjusting the Weights:
Although the current version gives equal weight to all three components, advanced users can modify the script to apply different weights to the price, volatility, and volume components based on historical performance or specific market conditions.
Adding Additional Inputs:
Future versions could incorporate external sentiment data or other technical factors if accessible. For now, the indicator focuses on technical inputs available directly within TradingView.
By following this guide, traders can integrate the Cognitive Echo Index into their TradingView platform to gain a unique perspective on market momentum and potential turning points. Enjoy testing and refining the indicator to better suit your trading style!
Color candle by time
This indicator, written in Pine Script v5, allows you to highlight candles (using a user-selected color) that fall within a user-defined time range. Candles outside this range maintain their original appearance.
How it Works and Key Benefits:
- Time Interval Customization: By specifying start and end hours/minutes, you can emphasize only the desired market session.
- Choice of Preferred Color: The body, wicks, and borders of the candles within the selected range are uniformly colored, based on the user’s chosen tone.
- Enhanced Focus on Price Action: By focusing on the most relevant trading hours, your analysis becomes more streamlined and intuitive, without altering the rest of the session’s candle appearance.
!! DO NOT FORGET TO SELECT THE OPTION: 'BRING TO FRONT' IN THE INDICATOR'S VISUAL ORDER !!
Crypto Candle Low Leverage TrackerCrypto Candle Low Leverage Tracker
The Candle Low Leverage Indicator is a powerful tool for long position traders seeking to manage risk effectively when using leverage. By evaluating the current candle's low price, this indicator helps traders make more informed decisions about potential entry points, stop losses, and leverage levels. The indicator matches the low of the candle to the leverage needed for liquidation, giving you a clear view of how leverage impacts your position.
This indicator provides two critical insights:
% from Candle Low: Tracks how much the price has moved from the low of the current candle. For long position traders, this percentage is crucial for understanding how far the price has come off the low and deciding whether it’s safe to enter a position or if further price action is needed.
Leverage Needed: Estimates the leverage required to reach the candle's low as the liquidation price. Long traders can use this information to adjust leverage to a safer level, ensuring they don’t overexpose themselves to liquidation risks by matching leverage to the candle’s low.
Key Features:
Customizable table positioning (top, middle, bottom).
Toggle options to show/hide % from Candle Low and Leverage Needed.
Visual indicators with color changes: green for positive change, red for negative change, and blue for leverage requirements.
Ideal for long traders, this tool helps evaluate market conditions, manage risks, and calculate the best leverage to use in long trades, ensuring that leverage aligns with the candle’s low to prevent unnecessary liquidations.
OAT Multiple Alert ConditionsOverview:
The OAT Multiple Alert Conditions indicator is designed to enhance TradingView’s alert functionality by allowing users to set multiple conditions for webhook-based alerts. This script enables traders to define up to four independent conditions using different event types (e.g., crossing, greater than, rising, etc.), making it ideal for automated trading strategies and webhook integrations.
Features:
✅ Supports up to 4 independent conditions.
✅ Multiple event types: Crossing, Crossing Up, Crossing Down, Greater Than, Less Than, Rising, Falling.
✅ Choose between value-based or source-based conditions.
✅ Custom timeframes for each condition.
✅ Optional session filtering and expiration settings.
✅ Visual markers for triggered conditions.
✅ Alerts for individual conditions or all conditions being met.
How It Works:
Configure each condition by selecting the event type and input values.
Define whether the alert should trigger on bar close or real-time.
Enable session filtering to limit alerts to specific trading hours.
Set an expiration date for alerts if needed.
Alerts can be sent via TradingView’s webhook feature for automated execution.
Intended Use:
This script is a utility tool for traders using automated strategies with the Options Auto Trader. It does not generate trading signals or provide financial advice. It is designed to enhance alert flexibility and efficiency for trading through webhooks.
License & Compliance:
This script is published under the Mozilla Public License 2.0 and follows TradingView’s guidelines. It does not execute trades but simply provides an enhanced alerting mechanism.
Gap Detection Indicator V.1This indicator is designed to detect gaps between candles on the chart. It detects all gaps that are higher than the specified percentage setting, draws a line passing through only the starting and ending points of the last gap, and paints between these lines.
If any candle closes above the gap starting level, the lines between the lines are colored green; If any candle closes below the gap starting level, the lines between the lines are colored red.
UPDATE1:
In addition, two more gap levels were added. A date range was added to enable control within the specified date range.
Bionic -- Expected Weekly Levels (Public)This script will draw lines for Expected Weekly Levels based upon Previous Friday Close, Implied Volatility (EOD Friday), and the square root of Days to Expire (always 7) / 365.
Script will draw 2 high and low levels:
*1st levels are 1 standard deviation from the Previous Friday Close.
* 2nd levels are 2 standard deviation from the Previous Friday Close.
There are also a 1/2 Low and 1/2 Low 1st level. These are 1/2 a standard deviation and act more as a point of interest level. 1/2 levels have 34% probability.
Configurations:
* All lines styles are individually configurable
* All lines can individually be turned on/off
* Text for all lines can be changed
* Global config allows for the
* Lines to show the price on the label
* Lines to have text in the label
* Hide or show all labels
* Lines offset from price is configurable
* Label size is configurable
Turtle Soup Model [PhenLabs]📊 Turtle Soup Model
Version: PineScript™ v6
Description
The Turtle Soup Model is an innovative technical analysis tool that combines market structure analysis with inter-market comparison and gap detection. Unlike traditional structure indicators, it validates market movements against a comparison symbol (default: ES1!) to identify high-probability trading opportunities. The indicator features a unique “soup pattern” detection system, comprehensive gap analysis, and real-time structure breaks visualization.
Innovation Points:
First indicator to combine structure analysis with gap detection and inter-market validation
Advanced memory management system for efficient long-term analysis
Sophisticated pattern recognition with multi-market confirmation
Real-time structure break detection with comparative validation
🔧 Core Components
Structure Analysis: Advanced pivot detection with inter-market validation
Gap Detection: Sophisticated gap identification and classification system
Inversion Patterns: “Soup pattern” recognition for reversal opportunities
Visual System: Dynamic rendering of structure levels and gaps
Alert Framework: Multi-condition notification system
🚨 Key Features 🚨
The indicator provides comprehensive analysis through:
Structure Levels: Validated support and resistance zones
Gap Patterns: Identification of significant market gaps
Inversion Signals: Detection of potential reversal points
Real-time Comparison: Continuous inter-market analysis
Visual Alerts: Dynamic structure break notifications
📈 Visualization
Structure Lines: Color-coded for highs and lows
Gap Boxes: Visual representation of gap zones
Inversion Patterns: Clear marking of potential reversal points
Comparison Overlay: Inter-market divergence visualization
Alert Indicators: Visual signals for structure breaks
💡Example
📌 Usage Guidelines
The indicator offers multiple customization options:
Structure Settings:
Pivot Period: Adjustable for different market conditions
Comparison Symbol: Customizable reference market
Visual Style: Configurable colors and line widths
Gap Analysis:
Signal Mode: Choice between close and wick-based signals
Box Rendering: Automatic gap zone visualization
Middle Line: Reference point for gap measurements
✅ Best Practices:
🚨Use comparison symbol from related market🚨
Monitor both structure breaks and gap inversions
Combine signals for higher probability trades
Pay attention to inter-market divergences
⚠️ Limitations
Requires comparison symbol data
Performance depends on market correlation
Best suited for liquid markets
What Makes This Unique
Inter-market Validation: Uses comparison symbol for signal confirmation
Gap Integration: Combines structure and gap analysis
Soup Pattern Detection: Identifies specific reversal patterns
Dynamic Structure Management: Automatically updates and removes invalid levels
Memory-Efficient Design: Optimized for long-term chart analysis
🔧 How It Works
The indicator processes market data through three main components:
1. Structure Analysis:
Detects pivot points with comparison validation
Tracks structure levels with array management
Identifies and processes structure breaks
2. Gap Analysis:
Identifies significant market gaps
Processes gap inversions
Manages gap zones visualization
3. Pattern Recognition:
Detects “soup” patterns
Validates with comparison market
Generates structure break signals
💡 Note: The indicator performs best when used with correlated comparison symbols and appropriate timeframe selection. Its unique inter-market validation system provides additional confirmation for traditional structure-based trading strategies.
Live Economic CalendarLive Economic Calendar
This TradingView indicator provides real-time economic news events directly on your charts, helping traders stay informed about key market-moving data. Built on the original Forex Factory utility by toodegrees, this version enhances functionality with customizable alerts and improved visualizations.
Key Features:
Real-Time Economic News: Displays upcoming economic events from Forex Factory, categorized by impact level (High, Medium, Low, Holiday).
Custom Alerts: Set alerts before and after news events to stay prepared for market volatility.
Timezone Adjustments: Adjust news event times to match your local timezone for accurate scheduling.
Currency-Specific News: Automatically filters news based on the currency pair you’re viewing, with manual options for specific currencies.
Flexible Display Options: Choose to display news for today, this week, or a custom period. Customize labels, lines, and tables directly on the chart.
Impact Visualization: Visual cues (lines, labels, background shading) for different impact levels to highlight significant market events.
Credits:
• Original Forex Factory Utility by toodegrees
• Alerts and enhancements by Nachodog
This Pine Script™ code is licensed under the Mozilla Public License 2.0: mozilla.org
Dynamic SL - 1 Pip (Up and Down)The Dynamic SL - 1 Pip Up and Down indicator creates two dynamic lines that follow the price at a distance of 1 pip above and below the closing price. This feature can be particularly useful for traders who want to visualize small stop-loss (SL) levels or track price movement in a highly responsive manner.
Unlike traditional stop-loss indicators, this script ensures that the lines only last for 5 seconds, keeping the chart clean and focusing only on the most relevant price movement.
Key Features
✔ Dynamic Stop-Loss Visualization:
The script draws a green line above the price (+1 pip).
A red line below the price (-1 pip) is also drawn.
✔ Auto-Clearing for a Clean Chart:
Each line lasts for 5 seconds only before automatically disappearing.
This prevents unnecessary clutter on the chart and ensures only the latest price movements are visualized.
✔ Adaptable to Multiple Assets:
Automatically calculates the pip size based on the instrument type:
Forex → Uses 0.0001 per pip.
Futures & Stocks → Uses the minimum tick size.
✔ Ideal for High-Frequency Traders & Scalpers:
Designed for 1-minute (M1) or lower timeframes where traders need to monitor price action closely.
Helps visualize ultra-tight stop-loss levels in scalping strategies.
BTC Future Gamma-Weighted Momentum Model (BGMM)The BTC Future Gamma-Weighted Momentum Model (BGMM) is a quantitative trading strategy that utilizes the Gamma-weighted average price (GWAP) in conjunction with a momentum-based approach to predict price movements in the Bitcoin futures market. The model combines the concept of weighted price movements with trend identification, where the Gamma factor amplifies the weight assigned to recent prices. It leverages the idea that historical price trends and weighting mechanisms can be utilized to forecast future price behavior.
Theoretical Background:
1. Momentum in Financial Markets:
Momentum is a well-established concept in financial market theory, referring to the tendency of assets to continue moving in the same direction after initiating a trend. Any observed market return over a given time period is likely to continue in the same direction, a phenomenon known as the “momentum effect.” Deviations from a mean or trend provide potential trading opportunities, particularly in highly volatile assets like Bitcoin.
Numerous empirical studies have demonstrated that momentum strategies, based on price movements, especially those correlating long-term and short-term trends, can yield significant returns (Jegadeesh & Titman, 1993). Given Bitcoin’s volatile nature, it is an ideal candidate for momentum-based strategies.
2. Gamma-Weighted Price Strategies:
Gamma weighting is an advanced method of applying weights to price data, where past price movements are weighted by a Gamma factor. This weighting allows for the reinforcement or reduction of the influence of historical prices based on an exponential function. The Gamma factor (ranging from 0.5 to 1.5) controls how much emphasis is placed on recent data: a value closer to 1 applies an even weighting across periods, while a value closer to 0 diminishes the influence of past prices.
Gamma-based models are used in financial analysis and modeling to enhance a model’s adaptability to changing market dynamics. This weighting mechanism is particularly advantageous in volatile markets such as Bitcoin futures, as it facilitates quick adaptation to changing market conditions (Black-Scholes, 1973).
Strategy Mechanism:
The BTC Future Gamma-Weighted Momentum Model (BGMM) utilizes an adaptive weighting strategy, where the Bitcoin futures prices are weighted according to the Gamma factor to calculate the Gamma-Weighted Average Price (GWAP). The GWAP is derived as a weighted average of prices over a specific number of periods, with more weight assigned to recent periods. The calculated GWAP serves as a reference value, and trading decisions are based on whether the current market price is above or below this level.
1. Long Position Conditions:
A long position is initiated when the Bitcoin price is above the GWAP and a positive price movement is observed over the last three periods. This indicates that an upward trend is in place, and the market is likely to continue in the direction of the momentum.
2. Short Position Conditions:
A short position is initiated when the Bitcoin price is below the GWAP and a negative price movement is observed over the last three periods. This suggests that a downtrend is occurring, and a continuation of the negative price movement is expected.
Backtesting and Application to Bitcoin Futures:
The model has been tested exclusively on the Bitcoin futures market due to Bitcoin’s high volatility and strong trend behavior. These characteristics make the market particularly suitable for momentum strategies, as strong upward or downward movements are often followed by persistent trends that can be captured by a momentum-based approach.
Backtests of the BGMM on the Bitcoin futures market indicate that the model achieves above-average returns during periods of strong momentum, especially when the Gamma factor is optimized to suit the specific dynamics of the Bitcoin market. The high volatility of Bitcoin, combined with adaptive weighting, allows the model to respond quickly to price changes and maximize trading opportunities.
Scientific Citations and Sources:
• Jegadeesh, N., & Titman, S. (1993). Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency. The Journal of Finance, 48(1), 65–91.
• Black, F., & Scholes, M. (1973). The Pricing of Options and Corporate Liabilities. Journal of Political Economy, 81(3), 637–654.
• Fama, E. F., & French, K. R. (1992). The Cross-Section of Expected Stock Returns. The Journal of Finance, 47(2), 427–465.
GWAP (Gamma Weighted Average Price)Gamma Weighted Average Price (GWAP) Indicator
The Gamma Weighted Average Price (GWAP) is a dynamic financial indicator that applies exponentially decaying weights to historical prices to calculate a weighted average. The method leverages the exponential decay function, controlled by a gamma factor, to prioritize recent price data while gradually diminishing the influence of older observations. This approach builds upon techniques commonly found in time-series analysis, including Exponentially Weighted Moving Averages (EWMA), which are extensively used in financial modeling (Campbell, Lo & MacKinlay, 1997).
Theoretical Context and Justification
The gamma-weighted approach follows principles similar to those in Exponentially Weighted Moving Averages (EWMA), often used in volatility modeling, where weights decay exponentially over time. The exponential decay model can improve signal responsiveness compared to simple moving averages (Hyndman & Athanasopoulos, 2018). This design helps capture recent market dynamics without ignoring past trends, a common requirement in high-frequency trading systems (Bandi & Russell, 2006).
Practical Applications
1. Trend Detection:
The GWAP can help identify bullish and bearish trends:
• When the price is above GWAP, the market exhibits bullish momentum.
• Conversely, when the price is below GWAP, bearish momentum prevails.
2. Volatility Filtering:
Because of the gamma weighting mechanism, GWAP reduces the noise commonly seen in volatile markets, making it a useful tool for traders looking to smooth price fluctuations while retaining actionable signals.
3. Crossovers for Trade Signals:
Similar to moving average strategies, traders can use price crossovers with the GWAP as trade signals:
• Buy Signal: When the price crosses above the GWAP.
• Sell Signal: When the price crosses below the GWAP.
4. Adaptive Gamma Weighting:
The gamma factor allows for further customization.
• Higher gamma values (>1) place greater emphasis on older data, suitable for long-term trend analysis.
• Lower gamma values (<1) heavily weight recent price movements, ideal for fast-moving markets.
Example Use Case
A trader analyzing the S&P 500 may use a gamma factor of 0.92 with a 14-period GWAP to detect shifts in market sentiment during periods of heightened volatility. When the index price crosses above the GWAP, this could signal a potential recovery, prompting a buy entry. Conversely, when the price moves below the GWAP during a correction, it may suggest a short-selling opportunity.
Scientific References
• Campbell, J. Y., Lo, A. W., & MacKinlay, A. C. (1997). The Econometrics of Financial Markets. Princeton University Press.
• Hyndman, R. J., & Athanasopoulos, G. (2018). Forecasting: Principles and Practice. OTexts.
• Bandi, F. M., & Russell, J. R. (2006). Microstructure Noise, Realized Variance, and Optimal Sampling. Econometrica.
VWAP + KCVolume Weighted Average Price (VWAP) is a technical analysis tool used to measure the average price weighted by volume. VWAP is typically used with intraday charts as a way to determine the general direction of intraday prices. It's similar to a moving average in that when price is above VWAP, prices are rising and when price is below VWAP, prices are falling. VWAP is primarily used by technical analysts to identify market trend.
The Keltner Channels (KC) indicator is a banded indicator similar to Bollinger Bands and Moving Average Envelopes. They consist of an Upper Envelope above a Middle Line as well as a Lower Envelope below the Middle Line. The Middle Line is a moving average of price over a user-defined time period. Either a simple moving average or an exponential moving average are typically used. The Upper and Lower Envelopes are set a (user-defined multiple) of a range away from the Middle Line. This can be a multiple of the daily high/low range, or more commonly a multiple of the Average True Range.
Fib Speed Resistance Fan"Fib Speed Resistance Fan," automatically draws Fibonacci Speed Resistance Fan lines based on the first and third candles of the trading session. Here’s a breakdown of its functionality:
Functionality
Session Start Time Identification
The script identifies the first candle at 9:15 AM using timestamp(), which ensures it captures the market's opening candle.
Candle Indexing
It determines the index of the first candle (firstCandleIndex) using ta.barssince(time >= sessionStart).
The third candle is found by adding two bars to the first candle's index (thirdCandleIndex = firstCandleIndex + 2).
Ensuring Single Execution
A boolean flag hasDrawn ensures that the lines are drawn only once and do not update on future candles.
Validating Data
It checks if the firstCandleIndex and thirdCandleIndex are valid (validSession).
If conditions are met, it extracts the highs and lows of the first and third candles.
Fibonacci Calculation
The script calculates a 0.75 level price between the first candle high/low and third candle low/high.
This level helps in drawing intermediate Fibonacci fan lines.
Drawing the Fibonacci Speed Resistance Fan
If conditions are valid and hasDrawn is false, the script draws:
Main fan lines from:
First candle high → Third candle low (Blue line)
First candle low → Third candle high (Blue line)
Sma Indicator with Ratio (pr)SMA Indicator with Ratio (PR) is a technical analysis tool designed to provide insights into the relationship between multiple Simple Moving Averages (SMAs) across different time frames. This indicator combines three key SMAs: the 111-period SMA, 730-period SMA, and 1400-period SMA. Additionally, it introduces a ratio-based approach, where the 730-period SMA is multiplied by factors of 2, 3, 4, and 5, allowing users to analyze potential market trends and price movements in relation to different SMA levels.
What Does This Indicator Do?
The primary function of this indicator is to track the movement of prices in relation to several SMAs with varying periods. By visualizing these SMAs, users can quickly identify:
Short-term trends (111-period SMA)
Medium-term trends (730-period SMA)
Long-term trends (1400-period SMA)
Additionally, the multiplied versions of the 730-period SMA provide deeper insights into potential price reactions at different levels of market volatility.
How Does It Work?
The 111-period SMA tracks the shorter-term price trend and can be used for identifying quick market movements.
The 730-period SMA represents a longer-term trend, helping users gauge overall market sentiment and direction.
The 1400-period SMA acts as a very long-term trend line, giving users a broad perspective on the market’s movement.
The ratio-based SMAs (2x, 3x, 4x, 5x of the 730-period SMA) allow for an enhanced understanding of how the price reacts to higher or lower volatility levels. These ratios are useful for identifying key support and resistance zones in a dynamic market environment.
Why Use This Indicator?
This indicator is useful for traders and analysts who want to track the interaction of price with different moving averages, enabling them to make more informed decisions about potential trend reversals or continuations. The added ratio-based values enhance the ability to predict how the market might react at different levels.
How to Use It?
Trend Confirmation: Traders can use the indicator to confirm the direction of the market. If the price is above the 111, 730, or 1400-period SMA, it may indicate an uptrend, and if below, a downtrend.
Support/Resistance Levels: The multiplied versions of the 730-period SMA (2x, 3x, 4x, 5x) can be used as dynamic support or resistance levels. When the price approaches or crosses these levels, it might indicate a change in the trend.
Volatility Insights: By observing how the price behaves relative to these SMAs, traders can gauge market volatility. Higher multiples of the 730-period SMA can signal more volatile periods where price movements are more pronounced.