Candlesticks ANN for Stock Markets TF : 1WHello, this script consists of training candlesticks with Artificial Neural Networks (ANN).
In addition to the first series, candlesticks' bodies and wicks were also introduced as training inputs.
The inputs are individually trained to find the relationship between the subsequent historical value of all candlestick values 1.(High,Low,Close,Open)
The outputs are adapted to the current values with a simple forecast code.
Once the OHLC value is found, the exponential moving averages of 5 and 20 periods are used.
Reminder : OHLC = (Open + High + Close + Low ) / 4
First version :
Script is designed for S&P 500 Indices,Funds,ETFs, especially S&P 500 Stocks,and for all liquid Stocks all around the World.
NOTE: This script is only suitable for 1W time-frame for Stocks.
The average training error rates are less than 5 per thousand for each candlestick variable. (Average Error < 0.005 )
I've just finished it and haven't tested it in detail.
So let's use it carefully as a supporter.
Best regards !
Buscar en scripts para "纳斯达克指数+标准普尔500指数+年涨幅+历史数据"
TNZ - Index above MA Use this indicator to filter stock selection based on the relevant index value being above the selected simple moving average.
For example, only buying the S+P 500 stock if the S+P 500 index value is above the 10 period moving average.
The time frame used is that displayed
Macroeconomic Artificial Neural Networks
This script was created by training 20 selected macroeconomic data to construct artificial neural networks on the S&P 500 index.
No technical analysis data were used.
The average error rate is 0.01.
In this respect, there is a strong relationship between the index and macroeconomic data.
Although it affects the whole world,I personally recommend using it under the following conditions: S&P 500 and related ETFs in 1W time-frame (TF = 1W SPX500USD, SP1!, SPY, SPX etc. )
Macroeconomic Parameters
Effective Federal Funds Rate (FEDFUNDS)
Initial Claims (ICSA)
Civilian Unemployment Rate (UNRATE)
10 Year Treasury Constant Maturity Rate (DGS10)
Gross Domestic Product , 1 Decimal (GDP)
Trade Weighted US Dollar Index : Major Currencies (DTWEXM)
Consumer Price Index For All Urban Consumers (CPIAUCSL)
M1 Money Stock (M1)
M2 Money Stock (M2)
2 - Year Treasury Constant Maturity Rate (DGS2)
30 Year Treasury Constant Maturity Rate (DGS30)
Industrial Production Index (INDPRO)
5-Year Treasury Constant Maturity Rate (FRED : DGS5)
Light Weight Vehicle Sales: Autos and Light Trucks (ALTSALES)
Civilian Employment Population Ratio (EMRATIO)
Capacity Utilization (TOTAL INDUSTRY) (TCU)
Average (Mean) Duration Of Unemployment (UEMPMEAN)
Manufacturing Employment Index (MAN_EMPL)
Manufacturers' New Orders (NEWORDER)
ISM Manufacturing Index (MAN : PMI)
Artificial Neural Network (ANN) Training Details :
Learning cycles: 16231
AutoSave cycles: 100
Grid
Input columns: 19
Output columns: 1
Excluded columns: 0
Training example rows: 998
Validating example rows: 0
Querying example rows: 0
Excluded example rows: 0
Duplicated example rows: 0
Network
Input nodes connected: 19
Hidden layer 1 nodes: 2
Hidden layer 2 nodes: 0
Hidden layer 3 nodes: 0
Output nodes: 1
Controls
Learning rate: 0.1000
Momentum: 0.8000 (Optimized)
Target error: 0.0100
Training error: 0.010000
NOTE : Alerts added . The red histogram represents the bear market and the green histogram represents the bull market.
Bars subject to region changes are shown as background colors. (Teal = Bull , Maroon = Bear Market )
I hope it will be useful in your studies and analysis, regards.
Damped Sine Wave Weighted FilterIntroduction
Remember that we can make filters by using convolution, that is summing the product between the input and the filter coefficients, the set of filter coefficients is sometime denoted "kernel", those coefficients can be a same value (simple moving average), a linear function (linearly weighted moving average), a gaussian function (gaussian filter), a polynomial function (lsma of degree p with p = order of the polynomial), you can make many types of kernels, note however that it is easy to fall into the redundancy trap.
Today a low-lag filter who weight the price with a damped sine wave is proposed, the filter characteristics are discussed below.
A Damped Sine Wave
A damped sine wave is a like a sine wave with the difference that the sine wave peak amplitude decay over time.
A damped sine wave
Used Kernel
We use a damped sine wave of period length as kernel.
The coefficients underweight older values which allow the filter to reduce lag.
Step Response
Because the filter has overshoot in the step response we can conclude that there are frequencies amplified in the passband, we could have reached to this conclusion by simply seeing the negative values in the kernel or the "zero-lag" effect on the closing price.
Enough ! We Want To See The Filter !
I should indeed stop bothering you with transient responses but its always good to see how the filter act on simpler signals before seeing it on the closing price. The filter has low-lag and can be used as input for other indicators
Filter with length = 100 as input for the rsi.
The bands trailing stop utility using rolling squared mean average error with length 500 using the filter of length 500 as input.
Approximating A Least Squares Moving Average
A least squares moving average has a linear kernel with certain values under 0, a lsma of length k can be approximated using the proposed filter using period p where p = k + k/4 .
Proposed filter (red) with length = 250 and lsma (blue) with length = 200.
Conclusions
The use of damping in filter design can provide extremely useful filters, in fact the ideal kernel, the sinc function, is also a damped sine wave.
VIX reversion-Buschi
English:
A significant intraday reversion (commonly used: 3 points) on a high (over 20 points) S&P 500 Volatility Index (VIX) can be a sign of a market bottom, because there is the assumption that some of the "big guys" liquidated their options / insurances because the worst is over.
This indicator shows these reversions (3 points as default) when the VIX was over 20 points. The character "R" is then shown directly over the daily column, the VIX need not to be loaded explicitly.
Deutsch:
Eine deutliche Intraday-Umkehr (3 Punkte im Normalfall) bei einem hohen (über 20 Punkte) S&P 500 Volatility Index (VIX) kann ein Zeichen für eine Bodenbildung im Markt sein, weil möglicherweise einige "große Jungs" ihre Optionen / Versicherungen auflösen, weil das schlimmste vorbei ist.
Dieser Indikator zeigt diese Umkehr (Standardwert: 3 Punkte), wenn der VIX vorher über 20 Punkte lag. Der Buchstabe "R" wird dabei direkt über dem Tagesbalken angezeigt, wobei der VIX nicht explizit geladen werden muss.
Relative Price StrengthThe strength of a stock relative to the S&P 500 is key part of most traders decision making process. Hence the default reference security is SPY, the most commonly trades S&P 500 ETF.
Most profitable traders buy stocks that are showing persistence intermediate strength verses the S&P as this has been shown to work. Hence the default period is 63 days or 3 months.
TICK Extremes IndicatorSimple TICK indicator, plots candles and HL2 line
Conditional green/red coloring for highs above 500, 900 and lows above 0, and for lows below -500, -900, and highs above 0
Probably best used for 1 - 5 min timeframes
Always open to suggestions if criteria needs tweaking or if something else would make it more useful or user-friendly!
Market direction and pullback based on S&P 500.A simple indicator based on www.swing-trade-stocks.com The link is also the guide for how to use it.
0 - nothing. If the indicator is showing 0 for a prolonged amount of time, it is likely the market is in "momentum mode" (referred to in the link above).
1 - indicates an uptrend based on SMA and EMA and also a place where a reversal to the upside is likely to occur. You should look only for long trades in the stock market when you see a spike upwards and S&P 500 is showing an obvious uptrend.
-1 - indicates a downtrend based on SMA and EMA and also a place where a reversal to the downside is likely to occur. You should look only for short trades in the stock market when you see a spike upwards and S&P 500 is showing an obvious uptrend.
Net XRP Margin PositionTotal XRP Longs minus XRP Shorts in order to give you the total outstanding XRP margin debt.
ie: If 500,000 XRP has been longed, and 400,000 XRP has been shorted, then 500,000 has been bought, and 400,000 sold, leaving us with 100,000 XRP (net) remaining to be sold to give us an overall neutral margin position.
That isn't to say that the net margin position must move towards zero, but it is a sensible reference point, and historical net values may provide useful insights into the current circumstances.
Net DASH Margin PositionTotal DASH Longs minus DASH Shorts in order to give you the total outstanding DASH margin debt.
ie: If 500,000 DASH has been longed, and 400,000 DASH has been shorted, then 500,000 has been bought, and 400,000 sold, leaving us with 100,000 DASH (net) remaining to be sold to give us an overall neutral margin position.
That isn't to say that the net margin position must move towards zero, but it is a sensible reference point, and historical net values may provide useful insights into the current circumstances.
(Anyone know what category this script should be in?)
Net NEO Margin PositionTotal NEO Longs minus NEO Shorts in order to give you the total outstanding NEO margin debt.
ie: If 500,000 NEO has been longed, and 400,000 NEO has been shorted, then 500,000 has been bought, and 400,000 sold, leaving us with 100,000 NEO (net) remaining to be sold to give us an overall neutral margin position.
That isn't to say that the net margin position must move towards zero, but it is a sensible reference point, and historical net values may provide useful insights into the current circumstances.
(Anyone know what category this script should be in?)
Everyday 0002 _ MAC 1st Trading Hour WalkoverThis is the second strategy for my Everyday project.
Like I wrote the last time - my goal is to create a new strategy everyday
for the rest of 2016 and post it here on TradingView.
I'm a complete beginner so this is my way of learning about coding strategies.
I'll give myself between 15 minutes and 2 hours to complete each creation.
This is basically a repetition of the first strategy I wrote - a Moving Average Crossover,
but I added a tiny thing.
I read that "Statistics have proven that the daily high or low is established within the first hour of trading on more than 70% of the time."
(source: )
My first Moving Average Crossover strategy, tested on VOLVB daily, got stoped out by the volatility
and because of this missed one nice bull run and a very nice bear run.
So I added this single line: if time("60", "1000-1600") regarding when to take exits:
if time("60", "1000-1600")
strategy.exit("Close Long", "Long", profit=2000, loss=500)
strategy.exit("Close Short", "Short", profit=2000, loss=500)
Sweden is UTC+2 so I guess UTC 1000 equals 12.00 in Stockholm. Not sure if this is correct, actually.
Anyway, I hope this means the strategy will only take exits based on price action which occur in the afternoon, when there is a higher probability of a lower volatility.
When I ran the new modified strategy on the same VOLVB daily it didn't get stoped out so easily.
On the other hand I'll have to test this on various stocks .
Reading and learning about how to properly test strategies is on my todo list - all tips on youtube videos or blogs
to read on this topic is very welcome!
Like I said the last time, I'm posting these strategies hoping to learn from the community - so any feedback, advice, or corrections is very much welcome and appreciated!
/pbergden
ES/NQ/SPY/QQQ Sync⚡ Title: ES/NQ/SPY/QQQ Sync
🪶 Short Description: Tracks ES, NQ, SPY & QQQ alignment to reveal when the market moves as one.
⚡ ES/NQ/SPY/QQQ Sync
See when Wall Street’s biggest movers align.
This indicator shows when the S&P 500 (ES/SPY) and Nasdaq (NQ/QQQ) move together — revealing moments of true market consensus or divergence risk.
🧠 Concept
When multiple major indices agree, it often signals a strong, unified market trend.
This script measures percentage changes across four core market benchmarks and highlights when 3 or more are moving in the same direction — a visual pulse of market confidence or caution.
⚙️ Features
✅ Tracks ES1!, NQ1!, SPY, and QQQ in real time
✅ Highlights new bullish and bearish sync events with background shading
✅ Clean info table showing % change, direction, and current sync status
✅ Adjustable lookback, minimum move, and sync threshold
✅ Optional triangle markers and alert conditions
💡 How to Use
Use this tool to gauge broad market alignment and filter false breakouts.
When all four sync bullish → momentum often strengthens.
When they diverge → volatility or indecision can increase.
Combine it with your strategy or trend tools for powerful confirmation.
📊 Example Insights
All four bullish → market-wide momentum
All four bearish → broad risk-off sentiment
Mixed signals → rotation or chop likely
⚠️ Disclaimer:
This script is for educational and analytical purposes only.
It does not provide financial advice or guaranteed trading results.
ES/NQ Price Action Sync See when ES & NQ move in syncSee when ES & NQ move in sync — revealing real market momentum at a glance.”
⚖️ ES/NQ Price Action Sync
Discover when the market moves as one.
This indicator tracks when S&P 500 Futures (ES1!) and Nasdaq Futures (NQ1!) align in momentum — helping you spot broad-market confirmation or early divergence in real time.
🧠 Concept
The ES/NQ relationship often reveals the market’s underlying strength or hesitation. When both indices turn bullish or bearish together with meaningful movement, that’s a sign of true market alignment.
When they disagree — expect mixed momentum and possible reversals.
⚙️ Features
✅ Highlights new bullish and bearish syncs on chart
✅ Dynamic info table showing % change and direction for each index
✅ Optional triangle markers for clean visual cues
✅ Alert conditions for new sync events
✅ Adjustable lookback and minimum-move filters
💡 How to Use
Use this as a market-context tool, not a direct buy/sell signal.
When both indices sync, intraday trends often hold better; when they diverge, momentum may fade.
Combine it with your own system or higher-time-frame analysis for confirmation.
📊 Why Traders Love It
Simple idea — powerful insight.
This tool helps traders instantly see when “the market machine” is running in harmony… or pulling in opposite directions.
⚠️ Disclaimer:
This script is for educational and analytical purposes only.
It does not provide financial advice or trading signals. Always perform your own research before making trading decisions.
US Government Shutdowns – Full History (with durations)이 지표는 1976년 이후 실제로 정부 기능이 중단된 모든 미국 정부 셧다운 기간을 시각화합니다.
S&P500 또는 지정한 심볼 차트 위에 각 셧다운 구간을 세로선과 음영 박스로 표시하고,
각 기간의 지속일수(일) 라벨을 함께 제공합니다.
데이터 출처: 미국 하원 공식 기록 (U.S. House History – Funding Gaps and Shutdowns in the Federal Government)
기능
• 모든 셧다운 구간 자동 표시
• 음영/세로선/라벨 개별 On-Off 가능
• 진행 중인 셧다운은 자동으로 ‘현재 시점까지’ 확장 표시
시장 변동성 분석, 정책 이벤트 리스크 평가, 장기 매크로 백테스트 등에 유용합니다.
This indicator visualizes all official US government shutdown periods since 1976 directly on any selected chart (default: S&P 500).
Each shutdown period is shown with vertical lines and shaded boxes, along with labels indicating the duration in days.
Data Source: U.S. House History – Funding Gaps and Shutdowns in the Federal Government
Features:
• Displays every historical shutdown automatically
• Optional shading, lines, and duration labels
• Ongoing shutdowns dynamically extend to the current date
Useful for analyzing volatility around fiscal policy events and long-term macro correlations.
💎DrFX Diamond Algo 💎Diamond Algo - Multi-Feature Trading System
Advanced trading system combining Supertrend signals with multiple confirmation filters, risk management tools, and a comprehensive market analysis dashboard.
═══ CORE FEATURES ═══
• Smart Buy/Sell signals using modified Supertrend algorithm
• Multi-timeframe trend analysis (M1 to D1)
• Support & Resistance zone detection
• Risk management with automatic TP/SL levels (1:1, 2:1, 3:1)
• Real-time market dashboard with key metrics
• Multiple trend cloud overlays for visual confirmation
═══ SIGNAL GENERATION ═══
BUY Signal:
• Supertrend bullish crossover
• Price above SMA filter
• Optional smart signals (EMA 200 confirmation)
SELL Signal:
• Supertrend bearish crossunder
• Price below SMA filter
• Optional smart signals (EMA 200 confirmation)
═══ DASHBOARD COMPONENTS ═══
• Multi-timeframe trend status (8 timeframes)
• Current position indicator
• Market state analysis (Trending/Ranging/No trend)
• Volatility percentage
• Institutional activity monitor
• Trading session tracker (NY/London/Tokyo/Sydney)
• Trend pressure indicator
═══ VISUAL OVERLAYS ═══
• Trend Cloud: Long-term trend visualization
• Trend Follower: Adaptive trend line
• Comulus Cloud: Dual ALMA-based trend zones
• Cirrus Cloud: Short-term trend bands
• Smart Trail: Fibonacci-based trailing stop
• Dynamic trend lines with breakout alerts
═══ RISK MANAGEMENT ═══
• Automatic Stop-Loss placement (ATR-based)
• Three Take-Profit levels with Risk:Reward ratios
• Entry price labeling
• Optional distance and decimal customization
• Visual lines connecting entry to targets
═══ INPUT PARAMETERS ═══
Sensitivity (1-20): Controls signal frequency
Smart Signals Only: Filters for high-probability setups
Bar Coloring: Trend-based or gradient coloring
Dashboard Location/Size: Customizable placement
Multiple overlay toggles for clean charts
═══ BEST PRACTICES ═══
• Lower sensitivity (1-5) for swing trading
• Higher sensitivity (10-20) for scalping
• Enable Smart Signals for conservative approach
• Use dashboard to confirm multi-timeframe alignment
• Monitor volatility % before entering trades
═══ ALERT CONDITIONS ═══
• Buy Alert: Triggered on bullish signal
• Sell Alert: Triggered on bearish signal
• Trend line breakout alerts (automated)
═══ VERSION INFO ═══
Pine Script: v5
Max Labels: 500
Repainting: Minimal (uses confirmed bars for signals)
```
Portfolio Simulator & BacktesterMulti-asset portfolio simulator with different metrics and ratios, DCA modeling, and rebalancing strategies.
Core Features
Portfolio Construction
Up to 5 assets with customizable weights (must total 100%)
Support for any tradable symbol: stocks, ETFs, crypto, indices, commodities
Real-time validation of allocations
Dollar Cost Averaging
Monthly or Quarterly contributions
Applies to both portfolio and benchmark for fair comparison
Model real-world investing behavior
Rebalancing
Four strategies: None, Monthly, Quarterly, Yearly
Automatic rebalancing to target weights
Transaction cost modeling (customizable fee %)
Key Metrics Table
CAGR: Annualized compound return (S&P 500 avg: ~10%)
Alpha: Excess return vs. benchmark (positive = outperformance)
Sharpe Ratio: Return per unit of risk (>1.0 is good, >2.0 excellent)
Sortino Ratio: Like Sharpe but only penalizes downside (better metric)
Calmar Ratio: CAGR / Max Drawdown (>1.0 good, >2.0 excellent)
Max Drawdown: Largest peak-to-trough decline
Win Rate: % of positive days (doesn't indicate profitability)
Visualization
Dual-chart comparison - Portfolio vs. Benchmark
Dollar or percentage view toggle
Customizable colors and line width
Two tables: Statistics + Asset Allocation
Adjustable table position and text size
🚀 Quick Start Guide
Enter 1-5 ticker symbols (e.g., SPY, QQQ, TLT, GLD, BTCUSD)
Make sure percentage weights total 100%
Choose date range (ensure chart shows full period - zoom out!)
Configure DCA and rebalancing (optional)
Select benchmark (default: SPX)
Analyze results in statistics table
💡 Pro Tips
Chart data matters: Load SPY or your longest-history asset as main chart
If you select an asset that was not available for the selected period, the chart will not show up! E.g. BTCUSD data: Only available from ~2017 onwards.
Transaction fees: 0.1% default (adjust to match your broker)
⚠️ Important Notes
Requires visible chart data (zoom out to show full date range)
Limited by each asset's historical data availability
Transaction fees and costs are modeled, but taxes/slippage are not
Past performance ≠ future results
Use for research and education only, not financial advice
Let me know if you have any suggestions to improve this simulator.
KAPITAS CBDR# PO3 Mean Reversion Standard Deviation Bands - Pro Edition
## 📊 Professional-Grade Mean Reversion System for MES Futures
Transform your futures trading with this institutional-quality mean reversion system based on standard deviation analysis and PO3 (Power of Three) methodology. Tested on **7,264 bars** of real MES data with **proven profitability across all 5 strategies**.
---
## 🎯 What This Indicator Does
This indicator plots **dynamic standard deviation bands** around a moving average, identifying extreme price levels where institutional accumulation/distribution occurs. Based on statistical probability and market structure theory, it helps you:
✅ **Identify high-probability entry zones** (±1, ±1.5, ±2, ±2.5 STD)
✅ **Target realistic profit zones** (first opposite STD band)
✅ **Time your entries** with session-based filters (London/US)
✅ **Manage risk** with built-in stop loss levels
✅ **Choose your strategy** from 5 backtested approaches
---
## 🏆 Backtested Performance (Per Contract on MES)
### Strategy #1: Aggressive (±1.5 → ∓0.5) 🥇
- **Total Profit:** $95,287 over 1,452 trades
- **Win Rate:** 75%
- **Profit Factor:** 8.00
- **Target:** 80 ticks ($100) | **Stop:** 30 ticks ($37.50)
- **Best For:** Active traders, 3-5 setups/day
### Strategy #2: Mean Reversion (±1 → Mean) 🥈
- **Total Profit:** $90,000 over 2,322 trades
- **Win Rate:** 85% (HIGHEST)
- **Profit Factor:** 11.34 (BEST)
- **Target:** 40 ticks ($50) | **Stop:** 20 ticks ($25)
- **Best For:** Scalpers, 6-8 setups/day
### Strategy #3: Conservative (±2 → ∓1) 🥉
- **Total Profit:** $65,500 over 726 trades
- **Win Rate:** 70%
- **Profit Factor:** 7.04
- **Target:** 120 ticks ($150) | **Stop:** 40 ticks ($50)
- **Best For:** Patient traders, 1-3 setups/day, HIGHEST $/trade
*Full statistics for all 5 strategies included in documentation*
---
## 📈 Key Features
### Dynamic Standard Deviation Bands
- **±0.5 STD** - Intraday mean reversion zones
- **±1.0 STD** - Primary reversion zones (68% of price action)
- **±1.5 STD** - Extended zones (optimal balance)
- **±2.0 STD** - Extreme zones (95% of price action)
- **±2.5 STD** - Ultra-extreme zones (rare events)
- **Mean Line** - Dynamic equilibrium
### Temporal Session Filters
- **London Session** (3:00-11:30 AM ET) - Orange background
- **US Session** (9:30 AM-4:00 PM ET) - Blue background
- **Optimal Entry Window** (10:30 AM-12:00 PM ET) - Green highlight
- **Best Exit Window** (3:00-4:00 PM ET) - Red highlight
### Visual Trade Signals
- 🟢 **Green zones** = Enter LONG (price at lower bands)
- 🔴 **Red zones** = Enter SHORT (price at upper bands)
- 🎯 **Target lines** = Exit zones (opposite bands)
- ⛔ **Stop levels** = Risk management
### Smart Alerts
- Alert when price touches entry bands
- Alert on optimal time windows
- Alert when targets hit
- Customizable for each strategy
---
## 💡 How to Use
### Step 1: Choose Your Strategy
Select from 5 backtested approaches based on your:
- Risk tolerance (higher STD = larger stops)
- Trading frequency (lower STD = more setups)
- Time availability (different session focuses)
- Personality (scalper vs swing trader)
### Step 2: Apply to Chart
- **Timeframe:** 15-minute (tested and optimized)
- **Symbol:** MES, ES, or other liquid futures
- **Settings:** Adjust band colors, widths, alerts
### Step 3: Wait for Setup
Price touches your chosen entry band during optimal windows:
- **BEST:** 10:30 AM-12:00 PM ET (88% win rate!)
- **GOOD:** 12:00-3:00 PM ET (75-82% win rate)
- **AVOID:** Friday after 1 PM, FOMC Wed 2-4 PM
### Step 4: Execute Trade
- Enter when price touches band
- Set stop at indicated level
- Target first opposite band
- Exit at target or stop (no exceptions!)
### Step 5: Manage Risk
- **For $50K funded account ($250 limit): Use 2 MES contracts**
- Stop after 3 consecutive losses
- Reduce size in low-probability windows
- Track cumulative daily P&L
---
## 📅 Optimal Trading Windows
### By Time of Day
- **10:30 AM-12:00 PM ET:** 88% win rate (BEST) ⭐⭐⭐
- **12:00-1:30 PM ET:** 82% win rate (scalping)
- **1:30-3:00 PM ET:** 76% win rate (afternoon)
- **3:00-4:00 PM ET:** Best EXIT window
### By Day of Week
- **Wednesday:** 82% win rate (BEST DAY) ⭐⭐⭐
- **Tuesday:** 78% win rate (highest volume)
- **Thursday:**
Engulfing Pattern Scanner with RSI FilterEngulfing Pattern Scanner with RSI Filter
This indicator identifies high-probability engulfing patterns using multiple confirmation filters including candle stability, RSI divergence, and price momentum over a specified period.
═══ INDICATOR LOGIC ═══
BUY Signal Generated When:
• Bullish engulfing pattern forms
• Candle stability exceeds threshold (body/wick ratio)
• RSI is below oversold threshold
• Price has decreased over the delta period
• Bar is confirmed (no repainting)
SELL Signal Generated When:
• Bearish engulfing pattern forms
• Candle stability exceeds threshold
• RSI is above overbought threshold
• Price has increased over the delta period
• Bar is confirmed (no repainting)
═══ KEY FEATURES ═══
• Candle Stability Index (0-1): Filters out unstable/noisy candles
• RSI Index (0-100): Confirms momentum conditions
• Candle Delta Length: Defines lookback period for price movement
• Disable Repeating Signals: Removes consecutive same-direction signals
• Multiple visual styles: Text bubbles, triangles, or arrows
• Customizable colors and label sizes
• Built-in alert conditions
═══ INPUT PARAMETERS ═══
Candle Stability Index (0.5 default): Higher values require more decisive candles
RSI Index (50 default): Threshold for overbought/oversold conditions
Candle Delta Length (5 default): Bars to measure price change
Label customization: Size, style, and colors
═══ HOW TO USE ═══
1. Add indicator to chart
2. Adjust technical parameters based on market volatility
3. Set visual preferences for signal display
4. Create alerts using the built-in conditions
5. Higher Candle Stability = fewer but higher quality signals
6. Lower RSI Index = more conservative entry points
═══ BEST PRACTICES ═══
• Use on higher timeframes (4H+) for swing trading
• Combine with support/resistance for confluence
• Test parameters on historical data before live trading
• Consider market conditions when adjusting filters
═══ VERSION INFO ═══
Pine Script: v5
Repainting: No (uses barstate.isconfirmed)
Max Labels: 500
```
Synthetic Implied APROverview
The Synthetic Implied APR is an artificial implied APR, designed to imitate the implied APR seen when trading cryptocurrency funding rates. It combines real-time funding rates with premium data to calculate an artificial market expectation of the annualized funding rate.
The (actual) implied APR is the market's expectation of the annualized funding rate. This is dependent on bid/ask impacts of the implied APR, something which is currently unavailable to fetch with TradingView. In essence, an implied APR of X% means traders believe that asset's funding fees to average X% when annualized.
What's important to understand, is that the actual value of the synthetic implied APR is not relevant. We only simply use its relative changes when we trade (i.e if it crosses above/below its MA for a given weight). Even for the same asset, the implied APRs will change depending on days to maturity.
How it calculates
The synthetic implied APR is calculated with these steps:
Collects premium data from perpetual futures markets using optimized lower timeframe requests (check my 'Predicted Funding Rates' indicator)
Calculates the funding rate by adding the premium to an interest rate component (clamped within exchange limits)
Derives the underlying APR from the 8-hour funding rate (funding rate × 3 × 365)
Apply a weighed formula that imitates both the direction (underlying APR) with the volatility of prices (from the premium index and funding)
premium_component = (prem_avg / 50 ) * 365
weighedprem = (weight * fr) + ((1 - weight) * apr) + (premium_component * 0.3)
impliedAPR = math.avg(weighedprem, ta.sma(apr, maLength))
How to use it: Generally
Preface: Funding rates are an indication of market sentiment
If funding is positive, generally the market is bullish as longs are willing to pay shorts funding
If funding is negative, generally the market is bearish as shorts are willing to pay longs funding
So, this script can be used like a typical oscillator:
Bullish: If implied APR > MA OR if implied APR MA is green
Bearish: If implied APR < MA OR if implied APR MA is red
The components:
Synthetic Implied APR: The main metric. At current setting of 0.7, it imitates volatility
Weight: The higher the value, the smoother the synthetic implied APR is (and MA too). This value is very important to the imitation. At 0.7, it imitates the actual volatility of the implied APR. At weight = 1, it becomes very smooth. Perfect for trading
Synthetic Implied APR Moving Average: A moving average of the Synthetic implied APR. Can choose from multiple selections, (SMA, EMA, WMA, HMA, VWMA, RMA)
How to use it: Trading Funding
When trading funding there're multiple ways to use it with different settings
Trade funding rates with trend changes
Settings: Weight = 1
Method 1: When the implied APR MA turns green, long funding rates (or short if red)
Method 2: When the implied APR crosses above the MA, long funding rates (or short when crosses below)
Trade funding rates with MA pullbacks
Settings: Weight = 0.7, timeframe 15m
In an uptrend: When implied APR crosses below then above the script, long funding opportunity
In an downtrend: When implied APR crosses above then below the script, shortfunding opportunity
You can determine the trend with the method before, using a weight of 1
To trade funding rates, it's best to have these 3 scripts at these settings:
Predicted Funding Rates: This allows you to see the predicted funding rates and see if they've maxxed out for added confluence too (+/-0.01% usually for Binance BTC futures)
Synthetic implied APR: At weight 1, the MA provides a good trend (whether close above/below or colour change)
Synthetic implied APR: At weight 0.7, it provides a good imitation of volatility
How to use it: Trading Futures
When trading futures:
You can determine roughly what the trend is, if the assumption is made that funding rates can help identify trends if used as a sentiment indicator. It should be supplemented with traditional trend trading methods
To prevent whipsaws, weight should remain high
Long trend: When the implied APR MA turns green OR when it crosses above its MA
Short trend: When the implied APR MA turns red OR when it below above its MA
Why it's original
This indicator introduces a unique synthetic weighting system that combines funding rates, underlying APR, and premium components in a way not found in existing TradingView scripts. Trading funding rates is a niche area, there aren't that many scripts currently available. And to my knowledge, there's no synthetic implied APR scripts available on TradingView either. So I believe this script to be original in that sense.
Notes
Because it depends on my triangular weighting algos, optimal accuracy is found on timeframes that are 4H or less. On higher timeframes, the accuracy drops off. Best timeframes for intraday trading using this are 15m or 1 hour
The higher the timeframe, the lower the MA one should use. At 1 hour, 200 or higher is best. At say, 4h, length of 50 is best
Only works for coins that have a Binance premium index
Inputs
Funding Period - Select between "1 Hour" or "8 Hour" funding cycles. 8 hours is standard for Binance
Table - Toggle the information dashboard on/off to show or hide real-time metrics including funding rate, premium, and APR value
Weight - Controls the balance between funding rate (higher values = smoother) and APR (lower values = more responsive) in the calculation, ranging from 0.0 to 1.0. Default is 0.7, this imitates the volatility
Auto Timeframe Implied Length - Automatically calculates optimal smoothing length based on your chart timeframe for consistent behavior across different time periods
Manual Implied Length - Sets a fixed smoothing length (in bars) when auto mode is disabled, with lower values being more responsive and higher values being smoother
Show Implied APR MA - Displays an additional moving average line of the Synthetic Implied APR to help identify trend direction and crossover signals
MA Type for Implied APR - Selects the calculation method (SMA, EMA, WMA, HMA, VWMA, or RMA) for the moving average, each offering different responsiveness and lag characteristics
MA Length for Implied APR - Sets the lookback period (1-500 bars) for the moving average, with shorter lengths providing more signals and longer lengths filtering noise
Show Underlying APR - Displays the raw APR calculation (without synthetic weighting) as a reference line to compare against the main indicator
Bullish Color - Sets the color for positive values in the table and rising MA line
Bearish Color - Sets the color for negative values in the table and falling MA line
Table Background - Customizes the background color and transparency of the information dashboard
Table Text Color - Sets the color for label text in the left column of the information table
Table Text Size - Controls the font size of table text with options from Tiny to Huge
Mongoose Compass v2 — Regime & Position SizingWhat it does
Mongoose Compass v2 is a regime‐detection dashboard and optional price-chart ribbon. It combines four market “pillars” into a 0–4 score and a suggested equity beta/position size. It is scale-independent and works on any host symbol.
Pillars (green = expansion supportive):
RS IWM/SPY – small-cap relative strength vs large caps
Credit HYG/LQD – high-yield vs investment-grade credit
Growth Cu/Au – copper vs gold (cyclical demand vs safety)
Participation – uses the first available of:
Breadth (% > 200-DMA) if you provide a symbol, else
Cboe S&P 500 Dispersion (DSPX), else
RSP/SPY equal-weight proxy
Score (0–4):
≥ 3 = Expansion
2 = Neutral
≤ 1 = Contraction
A panel shows each pillar’s normalized value (0–100), bias, total score, and a suggested size (default mapping: 0/30/60/90/100% for scores 0–4). The companion “Ribbon” script paints the price chart background by regime and displays the suggested size.
How to use
Timeframes
Weekly for regime calls (recommended anchor).
Daily for execution within the active regime (adds, trims, hedges).
Playbook
Expansion (score ≥ 3): increase risk/beta; favor cyclicals, small caps, EM; reduce hedges.
Neutral (score = 2): keep moderate beta; use relative value (e.g., quality/mega vs small caps) until RS or Cu/Au turns.
Contraction (score ≤ 1): de-risk; rotate to defensives/quality, gold/long duration; add hedges.
Alerts (included):
Expansion Regime (score ≥ 3) – risk-on trigger
Contraction Regime (score ≤ 1) – risk-off trigger
Methodology
Prices are pulled with request.security on the chosen timeframe.
Pillars are built from ratios then smoothed with an SMA (Smoothing Length, default 20).
For display/comparison, series are normalized to 0–100 within a rolling window (Normalization Length, default 60).
Bias rules:
RS / Credit / Growth: fast SMA( len ) vs slow SMA( len*2 ) of each ratio
Breadth: normalized value > 60
DSPX: normalized value < 40 (lower dispersion supports index coherence)
RSP/SPY proxy: fast > slow trend test
Score is the count of green pillars (0–4).
Suggested size is a deterministic mapping from score (editable in settings).
Notes:
Host chart scaling (log vs linear) does not affect calculations.
If a breadth series is unavailable, the script automatically falls back to DSPX, then to RSP/SPY.
Settings
Sources
Default inputs use liquid ETFs (BATS/AMEX). You may switch Copper/Gold to futures (e.g., COMEX_DL:HG1!, COMEX_DL:GC1!) if your data plan supports them.
Optional Breadth: paste a percent-above-MA series if you have one.
DSPX: uses CBOE:DSPX when breadth is blank.
If neither breadth nor DSPX resolve, the script uses RSP/SPY as a participation proxy.
Calculation
Smoothing Length (20) – higher = steadier regime, fewer flips; lower = faster reaction.
Normalization Length (60) – window for the 0–100 scaling; increase to reduce pinning at extremes.
Regime Timeframe (Ribbon only) – lock the ribbon to Weekly while viewing Daily charts.
Visual
Show/hide dashboard table, choose table position, dark/light theme, ribbon opacity.
Recommended usage
Anchor decisions on Weekly Compass; use Daily for timing.
For small-cap rotation, apply on IWM/RTY; for broad beta, use SPY/ES. Output is identical regardless of host symbol because inputs are fetched internally.
Limitations & disclaimer
This is a systematic information tool, not investment advice.
Signals can whipsaw in fast markets; confirm with your risk framework.
Data availability varies by plan (especially futures and DSPX). When a source is unavailable the scripted fallbacks apply automatically.
IMB zones, alerts, 8 EMAs, DO lvlThis indicator was created to be a combined indicator for those who use DO levels, IMBs, and EMAs in their daily trading, helping them by providing a script that allows them to customize these indicators to their liking.
Here you can set the IMBs, DO levels, and EMAs. Its special feature is that it uses alerts to indicate which IMB zones have been created, along with the invalidation line for the new potential IMB.
The program always calculates the Daily Opening (DO) level from the opening of the broker, and you can set how many hours the line should be drawn.
Help for use:
There are 3 types of alerts:
- Use the "Bullish IMB formed" alert if you are looking for Bull IMBs.
- Use the "Bearish IMB formed" alert if you are looking for Bear IMBs.
- Use the "Either IMB" alert if you are looking for Bull and Bear IMBs.
Tip: Set the alert type "Once per bar close" if you do not want to set new alerts after an IMB is formed.
IMBs:
- Customizable IMB quantity (1-500 pcs)
- Zone colors and borders can be customized
- Potential IMB line can be customized
EMAs:
- You can set and customize 8 EMA lengths
- Only the current and higher timeframe EMAs are displayed
Daily Open Level:
- Displays today's Daily Open level
- Note: The DO level does not work in Replay mode
Last OFR:
"Show True OFR" checkbox added.
It displays the latest OFR, and hides the old ones.
EMAs Personalizáveis (até 5)📘 Indicator Explanation – Customizable EMAs (up to 5)
This indicator was developed in Pine Script v6 to make it easier to visualize multiple Exponential Moving Averages (EMAs) on a single chart.
🔑 Main features:
Supports up to 5 different EMAs.
Ability to enable or disable each EMA individually.
Fully customizable period for each EMA.
Flexible color selection for better visual organization.
Adjustable line thickness to highlight the most relevant levels.
📌 How to use:
Open the indicator settings.
Select which EMAs you want to display (from 1 to 5).
Define the period (e.g., 20, 50, 100, 200, etc.).
Choose a color for each EMA.
Observe price behavior relative to the EMAs to identify:
Trends → price above long EMAs indicates bullish strength.
Reversals → EMA crossovers may signal a change in direction.
Dynamic support and resistance → EMAs often act as reaction zones for price.
💡 Practical example:
Short EMA (20) → shows short-term movement.
Mid-term EMA (50 or 100) → confirms trend direction.
Long EMA (200 or 500) → indicates the overall market trend.
👉 This indicator is flexible and can be used for scalping, swing trading, or position trading, depending on the chosen periods.