Dual EMA (EMA Average)Simple EMA visual with 2 EMAs + Average
Includes:
2 EMAs with timeframe settings
EMA Midline - an average of EMAs
shaded space between EMA lines
Chỉ báo và chiến lược
Ripster EMA Cloud A+ Setup + Exit Plan + Buy/Sell TriggersUsing the Ripster Cloud Method, a conditional system that helps with entries and exits
自動斐波回測Auto Fibonacci Backtest Explanation
Auto Fibonacci Backtest is an automated process in financial trading that tests Fibonacci strategies using historical data to simulate performance and evaluate effectiveness under various market conditions. Below is a detailed explanation of its core concepts, methods, tools, and applications, suitable for traders in stocks, forex, cryptocurrencies, and other markets.
What is Auto Fibonacci Backtest?
Fibonacci backtesting refers to trading strategies that use Fibonacci retracement (Retracement) or extension (Extension) levels (such as 23.6%, 38.2%, 61.8%, etc.) as entry, exit, or stop-loss points. The automation aspect involves software or scripts that execute the backtest automatically, avoiding manual calculations and handling large volumes of historical data (e.g., years or tens of thousands of candlesticks) to compute metrics like win rate, profit-loss ratio, and maximum drawdown.
Purpose: Validate Fibonacci strategies based on past performance, optimize parameters (such as retracement level selection), and predict potential future risks, rather than relying on subjective judgment.
Difference from Manual Backtesting: Automated backtesting can handle complex logic (e.g., combining multiple Fibonacci levels or trend filters) and generate statistical reports, saving time.
Backtesting Process
Auto Fibonacci backtesting typically follows these steps:
Define Strategy Rules:
Entry: Price retraces to a specific Fibonacci level (e.g., 61.8%) and shows confirmation signals (e.g., candlestick reversal or RSI oversold).
Exit: Reaches extension levels (e.g., 161.8%) or take-profit/stop-loss.
Filters: Execute only in trending markets (e.g., using moving averages to confirm trend direction) to avoid false signals in ranging markets.
Example Strategy: In an uptrend, enter long on retracement to 38.2% Fibonacci level, target 161.8% extension, stop-loss below 78.6% retracement.
Prepare Data:
Historical OHLC (Open-High-Low-Close) data, downloadable from sources like Yahoo Finance, Alpha Vantage, or trading platforms.
Time Range: At least 1-5 years of data, covering bull and bear markets.
Automated Execution:
Use programming languages (e.g., Python) or built-in platform tools to simulate each trade and calculate cumulative returns.
Key Metrics:
Win Rate: Percentage of profitable trades (e.g., >50%).
Profit-Loss Ratio: Average profit / average loss (target >1.5).
Maximum Drawdown: Largest equity curve decline (<20% is ideal).
Sharpe Ratio: Risk-adjusted return (>1 indicates good performance).
Optimization and Validation:
Parameter Optimization: Test different Fibonacci level combinations (e.g., using walk-forward optimization).
Forward Testing: After backtesting, validate with unseen data to avoid overfitting.
Monte Carlo Simulation: Randomly reshuffle data to assess strategy robustness.
Common Tools and Platforms
Python + Libraries:
Backtrader or Zipline: Open-source backtesting frameworks that support custom Fibonacci indicators.
TA-Lib: For calculating Fibonacci levels.
Example Code Snippet (Python):
pythonimport backtrader as bt
import pandas as pd
class FibStrategy(bt.Strategy):
def __init__(self):
self.fib_levels = # Retracement levels
def next(self):
# Calculate Fibonacci retracement (simplified example)
high = self.data.high.get(size=20) # Recent high
low = self.data.low.get(size=20) # Recent low
# Logic: Buy if price nears 61.8% level
if self.data.close <= high * (1 - 0.618) + low * 0.618:
self.buy()
# Load data and run backtest
cerebro = bt.Cerebro()
data = bt.feeds.PandasData(dataname=pd.read_csv('stock_data.csv'))
cerebro.adddata(data)
cerebro.addstrategy(FibStrategy)
cerebro.run()
cerebro.plot()
Advantages: Free, flexible, and integrable with machine learning for optimization.
TradingView:
Write automated Fibonacci strategies in Pine Script, with built-in backtester showing net profit, win rate, etc.
Example: Search for "Auto Fib Retracement Strategy" to apply and adjust parameters directly.
MetaTrader 4/5 (MT4/MT5):
Download EAs (Expert Advisors) like "Fibonacci Backtester" to automatically scan historical data.
Supports Monte Carlo simulation and multi-currency testing.
Others:
QuantConnect or Amibroker: Cloud-based backtesting with Fibonacci plugins.
Excel/VBA: Suitable for beginners, but slower for large datasets.
Strategy Examples
Simple Fibonacci Trend Following:
Trend: Price breaks above 20-day MA for uptrend.
Entry: Retracement to 50% Fibonacci level.
Exit: 161.8% extension or trailing stop.
Backtest Result Example (Hypothetical BTC/USD, 2020-2025 data): Win rate 55%, annualized return 25%, max drawdown 15%.
Advanced: Multi-Timeframe Combination:
Daily chart for trend confirmation, 1-hour chart for Fibonacci entry points.
Use Python optimization: Test 23.6%-78.6% range to select the best combination.
MetricDescriptionTarget ValueWin RatePercentage of profitable trades>50%Profit-Loss RatioAverage profit / loss>1.5Maximum DrawdownLargest capital loss<20%Sharpe RatioRisk-adjusted return>1.0
Advantages
Objectivity: Data-driven, avoiding emotional bias.
Efficiency: Automates thousands of trades for quick strategy iteration.
Risk Insights: Identifies Fibonacci weaknesses in different markets (e.g., bull vs. bear).
Limitations
Overfitting Risk: Strategies may fit historical data only; requires forward testing.
Slippage and Commissions: Backtests often exclude real trading costs, overestimating performance.
Market Changes: Fibonacci relies on historical patterns and can't predict black swan events.
Data Quality: Requires high-quality data to avoid biases.
Implementation Tips
Getting Started: Begin with TradingView's free backtesting for simple strategies.
Advanced: Learn Python Backtrader and add risk management (e.g., 1% risk per position).
Note: Backtesting is for reference only and doesn't guarantee future results. Test in demo accounts before live trading.
自動斐波擴展思考了8sAuto Fibonacci Extension Explanation
Auto Fibonacci Extension is a technical analysis tool used in financial markets (such as stocks, forex, commodities, and cryptocurrencies) to automatically calculate and draw Fibonacci extension levels, helping traders identify potential target prices or reversal areas after price trend continuations. Below is a detailed explanation of its core concepts, functions, and applications:
What is Auto Fibonacci Extension?
The Auto Fibonacci Extension indicator is based on the Fibonacci sequence, which derives specific ratios (such as 23.6%, 38.2%, 50%, 61.8%, 100%, 161.8%, 200%, and 261.8%) that are considered important reference points for price behavior in financial markets. Unlike traditional Fibonacci tools that require manual setting of start and end points, the Auto Fibonacci Extension indicator can automatically identify and draw these levels based on historical fluctuations on the price chart (e.g., recent highs and lows calculated by indicators like ZigZag), saving time and reducing human error.
Functions and Features
Automated Calculation and Drawing:
The Auto Fibonacci Extension indicator automatically draws extension levels based on key points on the price chart (usually highs and lows calculated by technical indicators like ZigZag).
No need for traders to manually select start point (A), end point (B), and retracement point (C); the indicator automatically identifies trend direction and retracement amplitude, then calculates potential price targets.
Key Levels:
Common Retracement Levels: 23.6%, 38.2%, 50%, 61.8%, and 78.6%, used to identify support or resistance after price retracements.
Common Extension Levels: 61.8%, 100%, 161.8%, 200%, and 261.8%, used to predict potential targets that prices may reach after trend continuation.
Flexibility and Customization:
Traders can adjust settings, such as which extension levels to display, line colors, widths, and styles.
Some indicators (like MT4/MT5 versions) allow setting alerts to notify traders when prices touch specific Fibonacci levels.
Options to reverse calculation direction (e.g., switching from bullish to bearish trend) or extend lines (left or right).
Applicable Markets and Timeframes:
Suitable for various financial markets (stocks, forex, futures, cryptocurrencies, etc.) and all timeframes (minute charts, daily charts, weekly charts, etc.), fitting day trading, swing trading, or long-term investing.
Calculation Method
The calculation of the Auto Fibonacci Extension indicator is based on Fibonacci ratios, with no fixed formula, but typically involves the following steps:
Identify Trend (A to B):
The indicator automatically detects the "A to B" movement on the price chart, i.e., the start point (A, usually a swing high or low) and end point (B, trend pause or reversal point) of the trend.
Determine Retracement Point (C):
Point C is the position where the price retraces from point B, often marked using Fibonacci retracement levels (e.g., 38.2% or 61.8%).
Calculate Extension Levels:
Based on points A, B, C, the indicator calculates extension targets in the trend direction. For example, the 161.8% extension level indicates that the price may extend from point C in the trend direction to 161.8% of the A-B swing height.
How to Use Auto Fibonacci Extension?
Trend Confirmation:
Before applying the indicator, traders should confirm the market trend (upward or downward), using other technical tools (such as moving averages or trendlines) for assistance.
Apply Indicator:
Enable the Auto Fibonacci Extension indicator on trading platforms (such as TradingView, MetaTrader 4/5, or NinjaTrader), and the system will automatically draw the levels.
Find Trading Opportunities:
Entry Points: When the price retraces to a key Fibonacci level (e.g., 61.8%) and shows reversal signals (such as candlestick patterns or technical indicator confirmations), consider entering trades in the trend direction.
Exit Points: Use extension levels (such as 161.8% or 200%) as potential profit-taking targets.
Stop Loss Settings: Set stop losses below the retracement level (bullish) or above (bearish) to manage risk.
Combine with Other Tools:
Combine the Auto Fibonacci Extension indicator with other technical analysis tools (such as moving averages, RSI, MACD, or support/resistance levels) to improve trading decision accuracy.
Trading Strategy Examples
Trend Continuation Strategy:
In an uptrend, when the price retraces from the high (B) to the 61.8% level (C) and shows rebound signals, traders can consider going long, with target prices set at 161.8% or 200% extension levels.
In a downtrend, when the price retraces to 38.2% or 50% levels and continues falling, consider shorting, with targets at 161.8% extension levels.
Range Trading Strategy:
In ranging markets, use 0% and 100% levels as support and resistance, and look for breakout or rebound opportunities when prices approach these levels.
Risk Management:
Set stop-loss and take-profit orders, ensuring a risk-reward ratio of at least 1:2. For example, if the stop loss is set below the 61.8% retracement level, the take profit can be set at the 161.8% extension level.
Advantages
Efficiency: Automation reduces time and errors in manual drawing.
Versatility: Applicable to multiple markets and timeframes, suitable for different trading styles.
Visualization: Clearly shows potential support, resistance, and target prices, helping traders make quick decisions.
Limitations
Not Foolproof: Fibonacci levels do not always accurately predict price behavior; combine with other analysis methods.
Market Dependency: More effective in strong trend markets; may produce more false signals in ranging markets.
Subjectivity: Although automated, selecting trend start points and parameter settings may still affect results.
Where to Use?
TradingView: Select "Auto Fib Extension" under the "Indicators" option, customize parameters, and view source code.
MetaTrader 4/5: Download the Auto Fibonacci Extension indicator, which automatically draws retracement and extension levels, supporting alert functions.
NinjaTrader: Provides free Auto Fibonacci Extension indicators, customizable levels and styles.
Summary
The Auto Fibonacci Extension indicator is a powerful and efficient tool that helps traders identify potential price targets and reversal areas through automated Fibonacci level drawing. It is particularly suitable for trend market traders but needs to be combined with other technical analysis tools and strict risk management strategies to improve success rates. Traders should familiarize themselves with its settings and test in demo accounts to ensure adaptation to their trading style.
Score de Confluência (Long) - By M.LolasCompilação de fatores de entrada verdadeira em Long.
By M.Lolas
Combined: AlphaTrend + SuperTrend + SRSI FilterThis indicator combines Supertrend + Alphatrend and the GP indicator. When the GP indicator meets the threshold, if there is a Supertrend signal, that signal is kept; otherwise, it is filtered out.”
byquan GP maxmin+Supertrend“This indicator combines Supertrend and the GP indicator. When the GP indicator meets the threshold, if there is a Supertrend signal, that signal is kept; otherwise, it is filtered out.”
Student Wyckoff Paunch barStudent Wyckoff Paunch bar
I will modify the indicator code according to your requirements: remove the display of ADX lines and threshold levels, leave only the coloring of bars in blue color if ADX is above Weak Threshold or Strong Threshold, and keep the customizable parameters in the menu. The code will be rewritten for Pine Script v6 to match the current version, retaining the ADX calculation logic and adding bar coloring via bgcolor(). The comments will be simple and instructional as indicated in the instructions.
BTC 20-Week MA Ratio OscillatorPlots the ratio of price to its 20-week SMA on a fixed 0–6 scale. A value of 1.0 = parity with the 20-week MA. Helps identify long-term overextensions relative to trend.
EMA Golden Cross by BiraEMA Crossover Status Panel
This Pine Script v6 indicator provides a comprehensive overview of Exponential Moving Average (EMA) crossovers across multiple timeframes, displayed conveniently in a customizable panel on your chart. It helps traders quickly identify bullish or bearish trends based on the relationship between a fast EMA (default 50) and a slow EMA (default 200).
Features:
Multi-Timeframe Analysis: Monitors EMA50/EMA200 crossovers on 2-hour, 4-hour, 12-hour, 1-day, 1-week, and 2-week timeframes.
Visual Status Panel: A clear, concise panel (positioned in the middle-right by default) shows the latest crossover status for each timeframe:
"Bullish" (Green): Indicates the fast EMA has crossed above the slow EMA.
"Bearish" (Red): Indicates the fast EMA has crossed below the slow EMA.
"N/A" (Gray): No recent significant crossover detected or data unavailable.
Customizable EMAs: Easily adjust the fast and slow EMA periods (e.g., EMA20 and EMA100) via the indicator's input settings to suit your trading strategy.
Clean and Commented Code: The script is well-structured, commented, and designed for easy modification.
How to Use:
Simply add this indicator to your TradingView chart. The panel will automatically appear, providing real-time EMA crossover status across the selected timeframes, aiding in your multi-timeframe analysis and trend identification.
Score de Confluência - By M.LolasIndicador criado dentro de uma estrategia específica, baseada em backtest real.
By M.Lolas
SL + 2 Entradas (50/50) + 2 TPs – Estratégia Manual By M.LolasIndicador criado dentro de uma estrategia específica, baseada em backtest real.
By M.Lolas
three_line_strike_lib"three_line_strike_lib"
This script is a Pine Script v5 library that identifies and visualizes classic candlestick reversal patterns—Three Line Strike and Engulfing Candles—for use in custom indicators or strategies.
Key Features
Candle Color Detection: Determines whether each candle is bullish (+1), bearish (-1), or neutral/doji (0).
Engulfing Logic:
Bearish Engulfing: A green candle followed by a larger red candle.
Bullish Engulfing: A red candle followed by a larger green candle.
The body size comparison ensures that only meaningful engulfing events are flagged.
Three Line Strike (3LS):
Bearish 3LS: Three consecutive bullish candles followed by a bearish engulfing candle.
Bullish 3LS: Three consecutive bearish candles followed by a bullish engulfing candle.
Customizable Plots:
Choose between standard shapes or fun meme icons (🍆 for bullish, 🍑 for bearish) to mark detected patterns on the chart.
Toggle display of Three Line Strike patterns and “Big A$$” (Engulfing) candles independently.
Alert Support: Signals can be tied to TradingView alerts for real-time notifications.
Usage
Import this library into your own Pine Script to access the exported functions:
candleColorIndex(barIndex) – returns candle color index.
isEngulfing(checkBearish) – checks for engulfing patterns.
isBearishEngulfing() / isBullishEngulfing() – shortcut functions.
is3LSBear() / is3LSBull() – detects Three Line Strike signals.
With the provided input toggles and plotting logic, traders can quickly highlight potential reversal or trend continuation points on any timeframe. This tool is especially useful for price action traders and scalpers seeking visual confirmation of these well-known candlestick setups.
Swing Cross NotifierThis indicator identifies swing highs and lows on the chart and draws horizontal lines at these levels.
It is designed to send an alert when the price first crosses a swing level and then closes with a reversal candle within a user-defined number of bars.
**How to Use for Alerts:**
1. Add the indicator to your chart.
2. Create an Alert.
3. In the "Condition" dropdown, select this script's name.
4. Choose "Any alert() function call".
5. Set the trigger to "Once Per Bar Close".
Daily Low Risk Calculator + ATR % CheckStoploss indicator for swing traders, I can't really explain any further
BTC RSI 35 이하 + 음봉 직후 양봉 (중복방지, 일봉 20일선 위)//@version=5
indicator("BTC RSI 35 이하 + 음봉 직후 양봉 (중복방지, 일봉 20일선 위)", overlay=true)
// === 일봉 기준 조건 ===
dailyClose = request.security(syminfo.tickerid, "D", close) // 일봉 종가
dailyMA20 = request.security(syminfo.tickerid, "D", ta.sma(close, 20)) // 일봉 20일선
aboveDailyMA = dailyClose > dailyMA20 // 일봉 종가가 20일선 위일 때만 true
// === RSI 계산 (1시간봉) ===
rsiLength = 14
rsi = ta.rsi(close, rsiLength)
// === 상태 변수 ===
var bool armed = false
var bool locked = false
// RSI 35 이하 → 무장(armed)
if (rsi <= 35)
armed := true
// RSI 40 이상 → 리셋
if (rsi >= 40)
armed := false
locked := false
// === BUY 조건 정의 (1시간봉 + 일봉 조건) ===
bearishPrev = close < open // 직전 봉 음봉
bullishNow = close > open // 현재 봉 양봉
buySignal = armed and not locked and bearishPrev and bullishNow and aboveDailyMA
// BUY 발생 시 잠금
if (buySignal)
locked := true
// === 차트 표시 ===
plotshape(buySignal, title="BUY", location=location.belowbar,
color=color.lime, style=shape.labelup, text="BUY", size=size.tiny)
// === 얼러트 조건 ===
alertcondition(buySignal, title="BUY Alert",
message="RSI 35 이하 + 음봉 직후 양봉 + 일봉 20일선 위 (1시간)")
Real Yields vs Gold vs DXYThis indicator overlays U.S. real yields, gold prices, and the U.S. Dollar Index (DXY) on the same chart, with optional normalization (raw values, Z-Score, or % change since start). It pulls macroeconomic data directly from the Federal Reserve Economic Data (FRED) (TIPS yields, nominal Treasuries, and breakeven inflation) and compares it against market feeds for gold and the dollar.
⸻
📌 What it shows you
1. Real Yields (teal line):
• The inflation-adjusted interest rate.
• Higher real yields typically reduce gold’s appeal (since gold doesn’t yield anything).
• Lower real yields usually support gold, as holding non-yielding assets becomes more attractive.
2. Gold (orange line, with optional MA):
• Spot gold (or futures) price series.
• Often moves inversely to real yields, but can diverge when inflation fears or safe-haven demand dominate.
3. U.S. Dollar Index (DXY) (blue line):
• The strength of the U.S. dollar versus major currencies.
• A strong USD often pressures gold (since it’s priced in dollars).
• Weakness in the USD often supports gold.
4. Reference Lines (0, +3, –3):
• In Z-Score mode, these act as statistical boundaries.
• Movements beyond +3 or –3 standard deviations usually signal extreme, unsustainable conditions.
📌 Why it matters for macro outlook
This indicator lets you see the three most important macro forces on gold in one pane:
• Real yields → reflect Fed policy, inflation expectations, and bond market pricing.
• DXY → reflects capital flows into or out of the USD.
• Gold → reacts to both, serving as a hedge, safe-haven, or inflation play.
By watching how these move together or diverge, you can answer key macro questions:
• Is gold moving inversely to real yields (normal regime)?
• Is gold rising even when real yields rise (inflation stress or risk aversion)?
• Is the dollar breaking the relationship (e.g., strong USD pushing gold lower despite falling yields)?
• Are we at statistical extremes (beyond ±3 Z-score), signaling stretched positioning?
⸻
✅ In short: This indicator is a macro overlay tool. It tells the story of how bond markets (real yields), currency markets (USD), and commodities (gold) interact — and whether gold’s behavior is consistent with macro fundamentals or signaling something unusual.
ema_stoploss_libLibrary "ema_stoploss_lib"
This library derives stop-loss levels from a dynamic list of EMA lengths. It computes each EMA internally (so dynamic lengths are allowed), keeps strict side filtering (long: only EMAs below the source; short: only EMAs above), sorts by distance to the source, and returns the n-th nearest value plus the original index of that EMA length.
get_stop_loss(index)
Initializes (once) a default length list:
21, 50, 100, 200, 250, 500, 750, 1000.
Returns:
sl_buy / sl_sell: selected EMA values
nearest_buy_idx / nearest_sell_idx: 0-based indices in the original lensArr
Parameters & Notes
Index (input in the example; default 2) is 0-based:
0 = nearest, 1 = second nearest, 2 = third, etc.
If there aren’t enough EMAs on the requested side, the value becomes na (plot will skip that bar).
Strict filtering means no fallback to the opposite side.
Performance:
EMA updates are O(n) per bar (n = number of lengths).
Sorting is O(k²) (k = candidates on the chosen side) — negligible for small lists.
Indicador de Confluência - M. LolasIndicador com finalidade específica em um projeto específico. By M. Lolas.