Indicators and strategies
Feigenbaum Lyapunov POWERParamètres utilisateur :
Longueur des Prix (length_price): Période pour la normalisation des prix.
Longueur du Volume (length_volume): Période pour la normalisation des volumes.
Constante de Feigenbaum (feigenbaum_constant): Valeur utilisée pour les calculs logistiques.
Seuil Lyapunov (lyapunov_threshold): Seuil pour déterminer les phases imprévisibles.
Niveau de Fractalité (fractality_level): Nombre de niveaux pour l'analyse fractale.
Niveau de Profondeur du Carnet d'Ordres (depth_level): Période pour calculer la profondeur approximative.
Période RSI (rsi_length): Période pour calculer le RSI.
Période Stochastic RSI (stoch_rsi_length): Période pour calculer le Stochastic RSI.
Période K pour Stochastic RSI (stoch_rsi_k_period): Période pour la moyenne mobile K du Stochastic RSI.
Période D pour Stochastic RSI (stoch_rsi_d_period): Période pour la moyenne mobile D du Stochastic RSI.
Fonctions et calculs principaux :
Normalisation des prix et volumes : Les prix et volumes sont normalisés pour la période spécifiée.
Calcul logistique (Feigenbaum) : Utilisation de la constante de Feigenbaum pour modéliser les prix et volumes chaotiques.
Coefficients de Lyapunov : Mesure des différences entre les prix et volumes chaotiques actuels et précédents.
Analyse fractale : Moyenne des écarts pour plusieurs niveaux de fractalité.
Profondeur du carnet d'ordres : Approximation basée sur l'écart entre les prix d'achat et de vente.
Identification des phases : Détection des phases imprévisibles, de repos et prévisibles basées sur les coefficients de Lyapunov et la fractalité.
Signaux d'achat et de vente : Basés sur les moyennes mobiles du volume et les croisements du Stochastic RSI.
Affichage :
Couleurs des phases : Utilisation de couleurs pour représenter les différentes phases du marché.
Moyenne mobile du volume : Utilisée pour détecter les signaux d'achat et de vente.
Signaux Stochastic RSI : Basés sur les croisements du Stochastic RSI.
Visualisation des coefficients : Affichage des coefficients de Lyapunov, fractalité et profondeur.
Ce script fournit une analyse complexe des phases de marché en utilisant des concepts avancés tels que la théorie du chaos (Feigenbaum) et la fractalité. Il aide à identifier les moments opportuns pour acheter ou vendre en fonction des signaux générés par les indicateurs calculés.
Best Buffett Ratio w/ Std-Dev Offset + Conditional PlotSummary:
This script provides a visually clear way to track the so-called “Buffett Ratio,”
a popular market valuation gauge which compares the total US stock market cap
to the country’s GDP. In addition, it plots a “hardcoded” long-term trend line,
along with fixed standard-deviation bands (in log space), and uses background colors
to signal potentially overvalued or undervalued zones.
What Is the Buffett Ratio?
Often credited to Warren Buffett, the Buffett Ratio (or Buffett Indicator) measures:
(Total US Stock Market Capitalization) / (US GDP)
• A higher ratio typically means equities are more expensive relative to the size of the economy.
• A lower ratio suggests equities may be more attractively valued compared to GDP.
Historically, the ratio has tended to drift upward over many decades,
as the US economy and stock markets grow, but it still oscillates around some trend over time.
How to Use
1) Add to Chart:
- In TradingView, simply apply the indicator (it internally fetches CRSPTM1 & GDP data).
2) Tweak Inputs:
- Log Offset for 1σ: Adjust how wide the ±1σ/±2σ bands appear around the trend.
- Anchor Points: Edit startYear , endYear , startRatio , endRatio
if you want a different slope or different “fair value” anchors.
3) Interpretation:
- If the indicator is above +2σ (red line) , it’s historically “very expensive,”
often leading to lower future returns over the long term.
- If it’s below –2σ (green line) , it’s historically “deep undervaluation,”
often pointing to better future returns over time.
- The intermediate zones show degrees of mild over- or undervaluation.
How This Script Works
1) Buffett Ratio Calculation:
- The script requests data from TradingView’s built-in CRSPTM1 index (total US market cap).
- It also requests US GDP data via request.economic("US", "GDP") .
- If GDP data is missing, the ratio becomes na on that bar.
2) Hardcoded Trend Line:
- Rather than a rolling average, the script uses two “anchors” (e.g. 1950 → 0.30 ratio, 2024 → 1.25 ratio)
and solves for a single log-growth rate to produce a steady upward slope.
3) Fixed Standard Deviations in Log Space:
- The script takes the log of the trend line, then applies a fixed offset for ±1σ and ±2σ,
creating proportional bands that do not “expand/contract” from a rolling window.
4) Conditional Plotting:
- The script only begins plotting once the Buffett Ratio actually has data (around 2011).
5) Color-Coded Zones:
- Above +2σ: red background (historically very expensive)
- Between +1σ and +2σ: yellow background (moderately expensive)
- Between –1σ and +1σ: no background color (around normal)
- Between –2σ and –1σ: aqua background (moderately undervalued)
- Below –2σ: green background (historically deep undervaluation)
Final Notes
• Data Limitations: US GDP data and CRSPTM1 only go back so far, so this starts around 2011.
• Long-Term vs. Short-Term: Best viewed on monthly/quarterly charts and interpreted over years.
• Tuning: If you believe structural changes have shifted the ratio’s fair slope,
adjust the code’s anchors or log offsets.
Enjoy, and use responsibly!
Moving Average Crossover + Candlestick ConfirmationThis script uses two customizable moving averages (Short MA and Long MA) to generate clear Buy and Sell signals based on crossovers. When the Short MA crosses above the Long MA, a Buy Signal is triggered, and when the Short MA crosses below the Long MA, a Sell Signal is triggered.
Features include:
Customizable moving average lengths for precise tuning.
Visual Buy (green) and Sell (red) labels on the chart.
Optional background color highlighting for trend changes.
Alert conditions for Buy and Sell signals, allowing for real-time notifications.
Ideal for traders who want a simple and reliable moving average crossover strategy!
Countdown Candle RRS// Countdown Candle RRS Indicator
//
// This indicator displays a countdown timer for the current candle on the chart.
// It shows the remaining time until the current candle closes, providing traders
// with a visual reference for time-based decision making.
//
// Features:
// - Customizable countdown display (size, position, and color)
// - Adapts to different timeframes (daily, hourly, and minute-based)
// - Displays time in appropriate format based on the chart timeframe
// - Daily or higher: XdHH:MM:SS (e.g., 2d05:30:15)
// - Hourly: HH:MM:SS
// - Minute or lower: MM:SS
// - Updates in real-time on the last candle
//
// Usage:
// - Add this indicator to your chart to see the countdown timer
// - Use the input options to customize the appearance and position of the timer
// - The timer will update on each tick, showing the time remaining until the current candle closes
//
// Note: This indicator is particularly useful for traders who need precise timing
// for entry or exit decisions, especially in fast-moving markets or when using
// specific time-based strategies.
//
// Author: reza rashidi
// Version: 1.0
Money Maykah -- MA slopesThe idea behind this script is to play with the idea of summing integration (IT) and differentiation (DT) of a T3 signal (smoothed with sma or ema). The sum is IT + DT.
Obviously this is not exactly these mathematical concepts, but what occurs is that it generates an oscillator that somewhat gets rid of skew in the oscillations in the market.
There is a signal IDE which sums the full IT + DT which shows a longer term oscillation. This will have a much larger range of numbers in amplitude so it may be a little annoying to move the scale around by hand. I don't care to fix this right now but I'm sure it can be done quite easily for someone else.
I was also playing with the idea of using a Normalization oscillator with this and seeing how the two compare and whether they could be used in some sort of strategy. Both have unpredictable behaviors but hey the market is unpredictable so have at it!
Relative Strength Screener V3relative strength vs spy screener list. based on a set of stocks, higher number is more strength vs spy.
Metaphor Vigour Ratio### **Script Name:** Metaphor Vigour Ratio
**Short Title:** Metaphor Vigour Ratio
**Author:** Sovit Manjani, CMT
**Description:**
The Metaphor Vigour Ratio (MVRatio) is a powerful Relative Strength Indicator designed for assessing normalized relative strength. It is versatile and can be applied to any script or used to rank symbols based on their intermarket relative strength.
---
### **Features:**
1. **Bullish and Bearish Signals:**
- **Above 100:** Indicates a bullish trend.
- **Below 100:** Indicates a bearish trend.
2. **Trend Analysis with Slope:**
- **Slope Rising:** Suggests bullish momentum.
- **Slope Falling:** Suggests bearish momentum.
3. **Stock Selection Strategy:**
- Identify and rank stocks based on the MVRatio. For example, buy the top 10 stocks of Nifty with the highest MVRatio values for strong performance potential.
---
### **Inputs:**
1. **Fast EMA Period (RSEMAFast):** Default set to 10. Controls the sensitivity of the Fast Moving Average.
2. **Slow EMA Period (RSEMASlow):** Default set to 30. Provides a stable trend base with the Slow Moving Average.
3. **Smooth EMA Period (SmoothEMA):** Default set to 3. Smooths the MVRatio for better clarity.
4. **Close Source:** Default is the closing price, but it can be customized as needed.
5. **Comparative Symbol (ComparativeTickerId):** Default is "NSE:NIFTY," allowing comparison against a benchmark index.
---
### **Calculation Logic:**
1. **Relative Strength (RS):**
- Calculated as the ratio of the base symbol's price to the comparative symbol's price.
2. **Exponential Moving Averages (FastMA and SlowMA):**
- Applied to the RS to smooth and differentiate trends.
3. **Metaphor Vigour Ratio (MVRatio):**
- Computed as the ratio of FastMA to SlowMA, scaled by 100, and further smoothed using SmoothEMA.
---
### **Visualization:**
1. **MVRatio Plot (Blue):**
- Represents the relative strength dynamics.
2. **Reference Line at 100 (Gray):**
- Helps quickly identify bullish (above 100) and bearish (below 100) zones.
---
### **How to Use:**
1. Add the indicator to your chart from TradingView's Pine Script editor.
2. Compare the performance of any symbol relative to a benchmark (e.g., Nifty).
3. Analyze trends, slopes, and ranking based on MVRatio values to make informed trading decisions.
---
**Note:** This indicator is for educational purposes and should be used alongside other analysis methods to make trading decisions.
3 Line Strike (TheTrdFloor) / Owl of Profit remakeThis script is based on the TMA Overlay by Arty and converted to a simple strategy example. A huge thank you to TheTrdFloor for the inspiration!
Features:
Detects Bullish and Bearish 3 Line Strike patterns:
Bullish: Three consecutive red candles followed by a large green engulfing candle.
Bearish: Three consecutive green candles followed by a large red engulfing candle.
Identifies Bullish and Bearish Engulfing Candles (optional).
Includes alert conditions for all signals, supporting automation or monitoring.
Plots visual markers for signals, with an optional meme icon overlay.
Strategy entries are executed based on signal detections.
Customization Options:
Enable/disable specific patterns/signals (e.g., 3 Line Strike or Engulfing Candles).
Choose between meme icons or standard chart shapes.
This strategy is designed for educational and testing purposes. Use it as a foundation for further customization and backtesting on your preferred markets.
Happy trading!
SPY/TLT Strategy█ STRATEGY OVERVIEW
The "SPY/TLT Strategy" is a trend-following crossover strategy designed to trade the relationship between TLT and its Simple Moving Average (SMA). The default configuration uses TLT (iShares 20+ Year Treasury Bond ETF) with a 20-period SMA, entering long positions on bullish crossovers and exiting on bearish crossunders. **This strategy is NOT optimized and performs best in trending markets.**
█ KEY FEATURES
SMA Crossover System: Uses price/SMA relationship for signal generation (Default: 20-period)
Dynamic Time Window: Configurable backtesting period (Default: 2014-2099)
Equity-Based Position Sizing: Default 100% equity allocation per trade
Real-Time Visual Feedback: Price/SMA plot with trend-state background coloring
Event-Driven Execution: Processes orders at bar close for accurate backtesting
█ SIGNAL GENERATION
1. LONG ENTRY CONDITION
TLT closing price crosses ABOVE SMA
Occurs within specified time window
Generates market order at next bar open
2. EXIT CONDITION
TLT closing price crosses BELOW SMA
Closes all open positions immediately
█ ADDITIONAL SETTINGS
SMA Period: Simple Moving Average length (Default: 20)
Start Time and End Time: The time window for trade execution (Default: 1 Jan 2014 - 1 Jan 2099)
Security Symbol: Ticker for analysis (Default: TLT)
█ PERFORMANCE OVERVIEW
Ideal Market Conditions: Strong trending environments
Potential Drawbacks: Whipsaws in range-bound markets
Backtesting results should be analyzed to optimize the MA Period and EMA Filter settings for specific instruments
Enhanced UT Bot with Long & Short TradesThis Pine Script implements a UT Bot Strategy based on ATR (Average True Range) trailing stop levels to generate buy and sell signals. It features:
Customizable Sensitivity:
Adjust the Key Value and ATR Period to control signal sensitivity.
Trailing Stop Logic:
A dynamic trailing stop tracks price movements based on ATR, switching between buy and sell zones.
Trade Automation:
Uses strategy.entry and strategy.close to automate long and short trades.
Triggers webhook alerts for buy and sell signals (UT Bot Buy and UT Bot Sell).
Visual Signals:
Displays trailing stop levels on the chart.
Plots buy/sell labels when crossover or crossunder events occur.
Webhook Integration:
Supports automated trade execution via webhook alerts.
Ideal for traders looking for a simple yet effective ATR-based trading strategy that works with automated systems like webhook triggers.
SALIM BUY/SELL MA5+MA9
The information provided does not constitute a recommendation regarding the suitability of investing in any financial products or instruments, nor does it serve as a substitute for the user's discretion. It should not be considered as advice and/or a recommendation to buy or sell securities or any financial products
Fear & Greed Index (Zeiierman) copyThe Fear & Greed Index (Zeiierman) is a sentiment analysis tool designed to measure market emotions, ranging from extreme fear to extreme greed. It typically aggregates various market indicators—such as volatility, momentum, demand, and technical analysis—to determine the prevailing sentiment among investors.
Extreme Fear: Suggests that investors are highly pessimistic, which may indicate a potential buying opportunity.
Fear: Shows a cautious or bearish market sentiment.
Neutral: Reflects a balanced market outlook.
Greed: Indicates rising optimism and potentially overbought conditions.
Extreme Greed: Suggests excessive investor confidence, which could be a sign of an overheated market and possible corrections.
Scalping Entry with TP/SL (1:2 R:R) [v6]
Entry Conditions:
A Buy entry is triggered when the price crosses above the EMA (trend confirmation).
A Sell entry is triggered when the price crosses below the EMA.
Stop Loss (SL):
Calculated using ATR (Average True Range) multiplied by a factor you can adjust (atrMultiplier).
Take Profit (TP):
Calculated using a fixed Risk-to-Reward ratio (riskRewardRatio), defaulted to 1:2.
Visualization:
Entry lines (solid green for Buy, red for Sell).
TP lines (blue dotted) and SL lines (red or green dotted).
Labels for entry points (BUY/SELL).