SMA Backtest Optimizer [Mr_Rakun]The SMA Backtest Optimizer is a powerful Pine Script tool designed to systematically analyze and compare various Simple Moving Average (SMA) periods to identify the most profitable configuration for trading strategies. This indicator tests multiple SMA periods (from 10 to 100) using a crossover strategy where buys occur when price crosses above the SMA and sells when price crosses below it.
Key Features:
Tests 10 different SMA periods to determine optimal settings
Calculates profit/loss based on a defined starting capital
Tracks total profit and number of trades for each period
Visually highlights the best performing SMA on your chart
Displays comprehensive results in an easy-to-read table
Labels the chart with key performance metrics
This code serves as a core framework that traders can customize for their specific needs. You can easily modify the strategy parameters, test different technical indicators, adjust capital settings, or implement more complex entry/exit rules. The optimization methodology can be applied to virtually any trading approach you wish to evaluate.
Feel free to adapt this framework to test your own trading ideas and discover which parameters work best in different market conditions.
Medie mobili
AltCoin Index Correlation🧠 AltCoin Index Correlation — Strategy Overview
AltCoin Index Correlation is a dynamic EMA-based trading strategy designed primarily for altcoins, but also adaptable to stocks and indices, thanks to its flexible reference index system.
🧭 Strategy Philosophy
The core idea behind this strategy is simple yet powerful:
Price action becomes more meaningful when it aligns with broader market context.
This script analyzes the correlation between the asset’s trend and a reference index trend, using dual EMA (Exponential Moving Average) crossovers for both.
When both the altcoin and the reference index (e.g. Altcoin Dominance, BTC Dominance, Total Market Cap, or even indices like the NASDAQ 100 or S&P 500) are aligned in trend direction, the script considers it a high-confidence setup.
It also includes:
Optional inverse correlation logic (for contrarian setups)
Custom leverage settings (e.g., 1x, 1.8x, etc.)
A dynamic scale-out mechanism during weakening trends
Date filtering for controlled backtests
A live performance dashboard with equity, PnL, win rate, drawdown, APR, and more
⚙️ Default Settings & Backtest Results
Timeframe tested: 1H
Test date: May 20, 2025
Sample: 100 high-cap altcoins
Reference index: CRYPTOCAP:OTHERS.D (Altcoin Dominance)
Leverage: 1.8x (180% of capital used)
📊 With default settings:
Win rate: ~80%
Higher profits, due to increased exposure
Best suited for confident trend followers with higher risk tolerance
📉 With fixed capital or 1x leverage:
Win rate improves to ~90%
Lower returns, but greater capital preservation
Ideal for conservative or risk-managed trading styles
🔄 Versatility
While tailored for altcoins, this strategy supports traditional markets as well:
Easily switch the reference index to OANDA:NAS100USD or S&P 500 for stock correlation trading
Adjust EMA lengths and leverage to match the asset class and volatility profile
🧩 Suggested Use
Best used on trending markets (not sideways)
Ideal for 1H timeframes, but adjustable
Suitable for traders who want a rules-based, macro-aware entry/exit system
Try it out, customize it to your style, try different settings and share your results with the community!
Feedback is welcome — and improvements are always in progress.
🚀 ### Check my profile for other juicy hints and original strategies. ### 🚀
Levels & Flow📌 Overview
Levels & Flow is a visual trading tool that combines daily pivot levels with a dynamic EMA ribbon to help traders identify structure, momentum, and key decision zones in the market.
This script is designed for discretionary traders who rely on clean visual cues for intraday and swing trading strategies.
⚙️ Key Features
Daily Pivot, Support, and Resistance Lines
Automatically plots the daily pivot level based on the previous day’s OHLC data, along with calculated support and resistance levels.
Fibonacci Retracement Levels
Two dashed lines above and below the pivot represent the retracement of the pivot-resistance and pivot-support range, forming the boundaries of the “no-trade zone.”
No-Trade Zone (Shaded Box)
A gray shaded box between the two Fibonacci levels to visually mark a high-chop/low-conviction zone.
Trend-Based Candle Coloring (Current Day Only)
Candles are colored green if the close is above the pivot, red if below (only on the current trading day).
Bullish/Bearish Trend Label
A small table in the bottom-right corner displays “Bullish” or “Bearish” depending on whether price is above or below the pivot.
20-EMA Gradient Ribbon
A stack of 20 EMAs, each smoothed and color-coded from blue to green to reflect short- to long-term trend alignment.
Cumulative EMA with Adaptive Weighting
An intelligent moving average line that adjusts weight distribution among the 20 EMAs based on recent predictive accuracy using a learning rate and lookback period.
🧠 How It Works
📍 Levels
The script calculates daily pivot, resistance, and support levels using standard formulas:
Pivot = (High + Low + Close) / 3
Resistance = (2 × Pivot) – Low
Support = (2 × Pivot) – High
These levels update each day and extend 143 bars to the right.
📏 Fib Lines
Fib Up = Pivot + (Resistance – Pivot) × 0.382
Fib Down = Pivot – (Pivot – Support) × 0.382
These lines form the “no-trade zone” box.
📈 EMA Ribbon
20 EMAs starting from the user-defined Base Length, each incremented by 1
Each EMA is smoothed using the Smoothing Period
Color-coded from blue to green for intuitive visual flow
Filled between EMAs to visualize trend strength and alignment
🧠 Cumulative EMA Learning
Each EMA’s historical error is calculated over a Lookback Period
Lower-error EMAs receive higher weight; weights are normalized to sum to 1
The result is a cumulative EMA that adapts based on historical predictive power
🔧 User Inputs
Input
Base EMA Length: Sets the period for the shortest EMA (default: 20)
Smoothing Period: Smooths all EMAs and the cumulative EMA
Lookback for Learning: Number of bars to evaluate EMA prediction accuracy
Learning Rate: Adjusts how quickly weights shift in favor of more accurate EMAs
✅ How to Use It
Use the pivot level to define directional bias.
Watch for price breakouts above resistance or breakdowns below support to consider entry.
Avoid trading inside the shaded zone, where direction is less reliable.
Use the EMA ribbon gradient to confirm short/long alignment.
The cumulative EMA helps define trend with noise reduction.
🧪 Best For
Intraday traders who want to blend structure with flow
Swing traders needing clean daily levels with dynamic confirmation
Anyone looking to avoid choppy zones and improve visual clarity
⚠️ Disclaimer
This script is for educational and informational purposes only. It does not constitute financial advice or a trading recommendation. Always test scripts in simulation or on demo accounts before live use. Use at your own risk.
MTF Trend + Crossover AlertsMulti-Timeframe Trend Dashboard + Crossover Signals
This indicator provides a clean, real-time visual dashboard of trend directions across multiple timeframes (1m, 5m, 15m, 30m, 1H, 4H, 1D), based on moving average crossovers.
🔹 Trend Detection Logic:
When the fast MA is above the slow MA → Bullish trend 🚀
When the fast MA is below the slow MA → Bearish trend 🐻
When both are equal or ranging → Neutral
📊 Dashboard Features:
Displays trend status for each selected timeframe
Color-coded cells (green = bullish, red = bearish, gray = neutral)
Includes emojis for visual clarity
🔔 Buy/Sell Alerts:
On the active chart timeframe, buy and sell signals are plotted when the fast MA crosses above or below the slow MA. You can also enable TradingView alerts based on these events.
🧩 Customizable Inputs:
Fast MA period
Slow MA period
MA type (EMA or SMA)
🔧 Ideal for traders who want a quick snapshot of market structure across multiple timeframes and receive real-time crossover signals on their current chart.
Simple Buy/Sell SignalsThe code works by continuously monitoring the relationship between two moving averages (MAs) on live price data — a fast MA (shorter period) and a slow MA (longer period). These MAs smooth out price action to help identify trends. Here's how it functions step-by-step:
Inputs: The user selects the MA type (SMA or EMA) and the lengths (periods) for the fast and slow MAs.
Calculation: The script calculates the chosen MAs using real-time closing prices.
Signal Logic: It detects a Buy signal when the fast MA crosses above the slow MA (crossover) and a Sell signal when the fast MA crosses below the slow MA (crossunder).
Plotting: When a signal occurs, the script plots a green "BUY" arrow below the candle or a red "SELL" arrow above it.
Alerts: It includes alert conditions so users can receive notifications when a buy or sell condition is met.
muraThis indicator is based on moving averages over a certain period using Fibonacci numbers. Pivot points are provided for active trading, which help to trade from the levels.
The indicator takes into account the trend direction, identifies key levels and possible targets.
You can also easily set up notifications for trend changes and receive them in the tradingview app or as an audio signal on your computer. This will help you not to miss anything in the market.
The moving averages with a uniquely recognized trend. 6 moving averages create 3 important trends. The first trend is local from your time frame, the second is global from your time frame and the third trend is predicated for tracking the global trend on an older time frame.
I have identified ways to trade my indicator:
- On a 4-hour time frame you can open trades in one direction with a change in the global trend. That is, if the red trend changes to green, it is time to open longs and vice versa.
- The global trend works best when paired with the local trend. That is, if the global trend is green, we wait until the local trend becomes green and then open longs, as well as in the opposite direction.
- Opening positions when the local trend changes towards the global trend also works well on a 12 hour time frame.
This indicator can be used on any timeframes from 1 minute to 1 year. You can also select levels for trading:
- intraday
- intra-week
- within a month
Note:
- Before you start trading, I strongly recommend you to do your own analysis on your own time frame or pairs
- Recommended for use with additional technical analysis tools
Distance % from SMATunable indicator which tells you how far away the price is from a moving average.
Twin Range Filter StrategyThis is the strategy version of the popular Twin Range Filter by colinmck.
Recommended use with Renko Candlesticks.
Source:
AI Cloud Market Indicator + FVG & OB + ZonesAI Robot Indicator
Tradingview Indicator
EMA
SMA
Supertrend
MAHESH BORADE EMA 9/21 Crossover with VWAPMAHESH BORADE EMA 9/21 Crossover with VWAP
When EMA 9 cross upward to EMA 21 then Buy
When EMA 9 cross downward to EMA 21 then Sell
wma+ tendance🟢 Wma+ tendance– Trend Ribbon with Weighted Moving Averages and Alerts
Description:
Wma+ tendance is a visual trend indicator that uses two Weighted Moving Averages (WMA) – a fast and a slow one – to clearly highlight market direction. It fills the space between the two WMAs with dynamic colors and includes alerts for trend changes.
🟩 Green: Uptrend – the fast WMA is above the slow WMA, and both are rising.
🟥 Red: Downtrend – the fast WMA is below the slow WMA, and both are falling.
⬜ Gray: No clear trend – indicating potential sideways or consolidating price action.
Features:
Trend ribbon visualized between fast and slow WMAs
Alerts for bullish and bearish trend detection
Customizable inputs for MA lengths and price source
Use cases:
Spot early trend formations
Combine with other indicators for confirmation
Adaptable for intraday and swing trading strategies
This script helps traders stay on the right side of the trend with minimal noise and real-time alerts.
Scalping EMA + RSI Strategy (Long & Short)Scalping EMA with RSI Strategy.
Entry Criteria: Indicators, price action, or patterns triggering entries.
Stop Loss (SL): Fixed pips, ATR-based, or swing low/high.
Take Profit (TP): Fixed reward, trailing stop, or dynamic levels.
RRR Target: e.g., 1:1.5 or 1:2.
Weekly Swing Momentum Strategy (India)Use 1D timeframe
Use daily chart (1D) to place trades.
Each trade is expected to last a few days to a week.
8/21 EMA Crossover + VWAP + 200 EMA8/21 EMA crossover with VWAP and slow moving average confirmation
Bullish Bearish Signal with EMA Color + Labels Bullish & Bearish Signal with Dynamic EMA + MACD/RSI Confluence
This indicator provides clear BUY and SELL signals based on the confluence of trend, momentum, and strength — perfect for traders who want high-probability entries with minimal noise.
🔍 Key Features:
Dynamic EMA 200 Color
The EMA line changes color based on market bias:
🔵 Blue = Bullish Trend
🔴 Red = Bearish Trend
⚪ Gray = Neutral
BUY Signal Conditions:
Price is above EMA 200 (uptrend confirmation)
MACD line crosses above the Signal line (momentum shift)
RSI is above 50 (bullish strength)
SELL Signal Conditions:
Price is below EMA 200 (downtrend confirmation)
MACD line crosses below the Signal line
RSI is below 50 (bearish strength)
Stylish BUY/SELL Labels
Clean, readable markers appear directly on the chart at key turning points.
🎯 Ideal For:
Trend-following strategies
Scalpers and swing traders looking for cleaner entries
Confirming signals from your existing setup
Let the market tell you when it's ready — this tool helps you enter only when trend, momentum, and strength agree.
Happy trading! 🚀
wma+ tendance🟢 wma+ tendance – Trend Ribbon with Weighted Moving Averages
Description:
Wma+ tendance is an indicator based on two Weighted Moving Averages (WMA) – a fast and a slow one – designed to visualize market trends in a clear and intuitive way. It dynamically colors the space between the two curves according to the market direction:
🟩 Green: Uptrend (fast WMA is above the slow WMA, and both are rising)
🟥 Red: Downtrend (fast WMA is below the slow WMA, and both are falling)
⬜ Gray: No clear trend (neutral market or consolidation)
Usage:
Identify trend phases or consolidation periods
Combine with other technical signals to optimize entries/exits
Suitable for both day trading and swing trading
Customizable settings:
Price source (close, open, etc.)
Length of the moving averages (fast and slow)
Triple MA (SMA, EMA, WMA)A triple Moving Average, simple, exponential and weighted. All in one with fills in between.
MARibbonMARibbon インジケーターについて
この「MARibbon」は、3本の移動平均線(MA1、MA2、MA3)を描画し、特にMA2とMA3の関係性に注目して、背景色でトレンドの強弱や転換のサインを視覚的に分かりやすく表示するインジケーターです。
主な特徴
3種類の移動平均線を表示可能
MA1(白色、期間40、太さ2)
MA2(水色、期間200、太さ4)
MA3(ピンク色、期間800、太さ4)
各MAの期間・種類(SMA、EMA、WMA、RMA)・タイムフレームは自由に設定可能。
MA2とMA3の関係性に応じて、チャート背景に色付きのリボン(帯)を表示。
背景リボンの意味
MA2 > MA3(ゴールデンクロス状況)
→ 背景を薄い緑色にして、上昇トレンドの可能性を示唆。
MA3 > MA2(デッドクロス状況)
→ 背景を薄い赤色にして、下降トレンドの可能性を示唆。
それ以外(等しい場合など)は背景色なし(透明)で表示。
入力可能な設定
各移動平均線の期間
各移動平均線の種類(SMA、EMA、WMA、RMA)
各移動平均線のタイムフレーム(デフォルトはチャートと同じ)
使い方
任意の銘柄・時間足のチャートにインジケーターを適用。
必要に応じて、3本の移動平均の期間・種類・時間足を調整。
MA2とMA3の位置関係によって、チャート背景の色が変わり、トレンドの強弱を直感的に把握可能。
MARibbon is a custom indicator that plots three moving averages (MA1, MA2, MA3) and visually fills the space between MA2 and MA3 with color bands to indicate trend strength and direction.
Each MA supports custom type (SMA / EMA / WMA / RMA), length, and timeframe.
A green band appears when MA2 is above MA3.
A red band appears when MA3 is above MA2.
This clean and minimal design helps traders easily visualize overlapping trends and potential crossovers.
💡 Use Cases:
Visually confirm confluence of long- and short-term trends
Identify ribbon-like zones of trend strength
Support for MA cross strategy analysis
Deep Blue Sea Refactor [ALLDYN]Deep Blue Sea Refactor
A dynamic trend visualization tool that layers weighted moving averages and a stylized Ichimoku-inspired cloud to help traders map market momentum and structure across multiple timeframes.
🌀 Why Use It:
Visualizes the “depth” of market trend using color-coded momentum layers
Highlights short-term acceleration (WMA 5 vs 13) and medium- to long-term commitment (WMA 36 to 1440)
Identifies cloud compression and breakout potential via custom trend envelopes
Includes alert conditions for fast WMA crossovers (momentum shifts)
🎯 Who It’s For:
Visual traders who rely on color, rhythm, and structure
Swing, intraday, and scalpers looking to time entries off WMA confluence
Those who value clean, toggle-based control over complexity
📊 Features:
Short / Mid / Long-term WMA toggles
Color-adjusted cloud layers with transparency ranking
Legend table with MA explanations
Alerts for WMA 5/13 crossovers
💡 Inspired by the depth of the ocean: shallow = fast reaction, deep = structural confluence. Part of the FxAST Toolset Suite by @alldyn_pip_king.
Swing Exit System with Legend Dashboard — Smart + Stylish“They say it’s more important when you buy than when you sell — but this script begs to differ.”
In the real world of trading, the exit is often more important than the entry. A bad exit can turn a winning trade into a loss. A late exit can leave you bag-holding. A premature exit can cause regret as the trade runs without you. That’s where this script steps in — built to guide you through intelligent, data-driven exits with visual clarity and confidence.
🧠 What This Script Does
This is a swing trade exit assistant, not just a signal plotter. It uses seven distinct exit conditions — all grounded in technical structure and momentum — to alert you when it's time to consider reducing or closing a position. Each condition is visualized using a unique, color-coded triangle on the chart for quick interpretation. All signals are also listed in a dynamic legend panel.
🎯 The Exit Signals Include:
10 SMA Break (🟠) – Signals short-term momentum loss
20 SMA Break (🔵) – Stronger loss of trend support
SMA Cross (🔴) – Fast SMA crossing below slow SMA = trend weakening
ATR Stop Hit (🟥) – Price breaks below a trailing ATR stop
RSI Momentum Fade (🟣) – RSI drops below 50 after being overbought
RSI Bearish Divergence (🟪) – Momentum diverges from price
Lower High / Lower Low (⚫️) – Classic bearish market structure
Each triangle matches the color of its entry in the exit legend dashboard, which appears as a floating table on the lower right of the screen for maximum clarity without clutter.
📊 Also Displayed:
Live ATR value – Helps evaluate volatility and stop distance
Fast SMA (10) & Slow SMA (20) – See trend context and potential crossovers
Upper/lower ATR bands for visual trailing stops
🧰 Why This Matters
This script isn’t about blindly following signals — it’s about supporting decision-making. It helps you exit trades with intention, not emotion. It’s built for:
Swing traders who hold for 2–10 bars
Traders using multi-condition filters
Visual thinkers who want signal and structure in sync
Exit too early and you leave money on the table. Exit too late and you give it all back. This tool gives you the structure to exit when the chart says so, not when your nerves do.
Opening Range Break (ORB)📈 Opening Range Break (ORB) with Session Levels & Alerts
This indicator highlights key trading sessions (London, London–NY Overlap, NY PM) with automatic high/low range tracking, optional labels, and breakout alerts.
Features:
✅ Session range plotting (custom time & color)
🟦 Weekly high/low levels (optional)
🔔 Breakout + retest alert system (customizable per session)
📊 200 EMA trend overlay
🔥 Real candle high/low support even when using Heikin Ashi (toggle on/off)
Perfect for intraday traders looking to catch session breakouts or price action around key levels.
EMA(120,200)Indicator: EMA(120,200) for Bitcoin Pullback Strategy
Description:
This indicator plots two Exponential Moving Averages (EMAs) on the Bitcoin price chart:
EMA 120 (short-term trend)
EMA 200 (long-term trend)
The purpose is to identify potential buying opportunities ("go long") when Bitcoin's price pulls back to the "channel" between EMA 120 and EMA 200.
Key Features:
EMA Calculation:
ema120 = ta.ema(close, 120) → 120-period EMA (faster, reacts to recent price).
ema200 = ta.ema(close, 200) → 200-period EMA (slower, broader trend).
Visualization:
Both EMAs are plotted as white lines (color=#ffffff) with a thickness of 2.
Trading Logic (Implied):
When Bitcoin's price retraces (pulls back) to the zone between EMA 120 and EMA 200, traders may consider entering long positions, assuming the overall uptrend remains intact.
This strategy leverages the idea that EMAs act as dynamic support levels during uptrends.
How to Use It:
Uptrend Confirmation:
Ensure EMA 120 is above EMA 200 (bullish alignment).
Pullback Entry:
Wait for the price to dip near the EMA 120-200 channel.