指標和策略
RSI OB/OS THEDU 999//@version=6
indicator("RSI OB/OS THEDU 999", overlay=false)
//#region Inputs Section
// ================================
// Inputs Section
// ================================
// Time Settings Inputs
startTime = input.time(timestamp("1 Jan 1900"), "Start Time", group="Time Settings")
endTime = input.time(timestamp("1 Jan 2099"), "End Time", group="Time Settings")
isTimeWindow = time >= startTime and time <= endTime
// Table Settings Inputs
showTable = input.bool(true, "Show Table", group="Table Settings")
fontSize = input.string("Auto", "Font Size", options= , group="Table Settings")
// Strategy Settings Inputs
tradeDirection = input.string("Long", "Trade Direction", options= , group="Strategy Settings")
entryStrategy = input.string("Revert Cross", "Entry Strategy", options= , group="Strategy Settings")
barLookback = input.int(10, "Bar Lookback", minval=1, maxval=20, group="Strategy Settings")
// RSI Settings Inputs
rsiPeriod = input.int(14, "RSI Period", minval=1, group="RSI Settings")
overboughtLevel = input.int(70, "Overbought Level", group="RSI Settings")
oversoldLevel = input.int(30, "Oversold Level", group="RSI Settings")
//#endregion
//#region Font Size Mapping
// ================================
// Font Size Mapping
// ================================
fontSizeMap = fontSize == "Auto" ? size.auto : fontSize == "Small" ? size.small : fontSize == "Normal" ? size.normal : fontSize == "Large" ? size.large : na
//#endregion
//#region RSI Calculation
// ================================
// RSI Calculation
// ================================
rsiValue = ta.rsi(close, rsiPeriod)
plot(rsiValue, "RSI", color=color.yellow)
hline(overboughtLevel, "OB Level", color=color.gray)
hline(oversoldLevel, "OS Level", color=color.gray)
//#endregion
//#region Entry Conditions
// ================================
// Entry Conditions
// ================================
buyCondition = entryStrategy == "Revert Cross" ? ta.crossover(rsiValue, oversoldLevel) : ta.crossunder(rsiValue, oversoldLevel)
sellCondition = entryStrategy == "Revert Cross" ? ta.crossunder(rsiValue, overboughtLevel) : ta.crossover(rsiValue, overboughtLevel)
// Plotting buy/sell signals
plotshape(buyCondition ? oversoldLevel : na, title="Buy", location=location.absolute, color=color.green, style=shape.labelup, text="BUY", textcolor=color.white, size=size.small)
plotshape(sellCondition ? overboughtLevel : na, title="Sell", location=location.absolute, color=color.red, style=shape.labeldown, text="SELL", textcolor=color.white, size=size.small)
// Plotting buy/sell signals on the chart
plotshape(buyCondition, title="Buy", location=location.belowbar, color=color.green, style=shape.triangleup, text="BUY", textcolor=color.white, size=size.small , force_overlay = true)
plotshape(sellCondition, title="Sell", location=location.abovebar, color=color.red, style=shape.triangledown, text="SELL", textcolor=color.white, size=size.small, force_overlay = true)
//#endregion
//#region Returns Matrix Calculation
// ================================
// Returns Matrix Calculation
// ================================
var returnsMatrix = matrix.new(0, barLookback, 0.0)
if (tradeDirection == "Long" ? buyCondition : sellCondition ) and isTimeWindow
newRow = array.new_float(barLookback)
for i = 0 to barLookback - 1
entryPrice = close
futurePrice = close
ret = (futurePrice - entryPrice) / entryPrice * 100
array.set(newRow, i, math.round(ret, 4))
matrix.add_row(returnsMatrix, matrix.rows(returnsMatrix), newRow)
//#endregion
//#region Display Table
// ================================
// Display Table
// ================================
var table statsTable = na
if barstate.islastconfirmedhistory and showTable
statsTable := table.new(position.top_right, barLookback + 1, 4, border_width=1, force_overlay=true)
// Table Headers
table.cell(statsTable, 0, 1, "Win Rate %", bgcolor=color.rgb(45, 45, 48), text_color=color.white, text_size=fontSizeMap)
table.cell(statsTable, 0, 2, "Mean Return %", bgcolor=color.rgb(45, 45, 48), text_color=color.white, text_size=fontSizeMap)
table.cell(statsTable, 0, 3, "Median Return %", bgcolor=color.rgb(45, 45, 48), text_color=color.white, text_size=fontSizeMap)
// Row Headers
for i = 1 to barLookback
table.cell(statsTable, i, 0, str.format("{0} Bar Return", i), bgcolor=color.rgb(45, 45, 48), text_color=color.white, text_size=fontSizeMap)
// Calculate Statistics
meanReturns = array.new_float()
medianReturns = array.new_float()
for col = 0 to matrix.columns(returnsMatrix) - 1
colData = matrix.col(returnsMatrix, col)
array.push(meanReturns, array.avg(colData))
array.push(medianReturns, array.median(colData))
// Populate Table
for col = 0 to matrix.columns(returnsMatrix) - 1
colData = matrix.col(returnsMatrix, col)
positiveCount = 0
for val in colData
if val > 0
positiveCount += 1
winRate = positiveCount / array.size(colData)
meanRet = array.avg(colData)
medianRet = array.median(colData)
// Color Logic
winRateColor = winRate == 0.5 ? color.rgb(58, 58, 60) : (winRate > 0.5 ? color.rgb(76, 175, 80) : color.rgb(244, 67, 54))
meanBullCol = color.from_gradient(meanRet, 0, array.max(meanReturns), color.rgb(76, 175, 80), color.rgb(0, 128, 0))
meanBearCol = color.from_gradient(meanRet, array.min(meanReturns), 0, color.rgb(255, 0, 0), color.rgb(255, 99, 71))
medianBullCol = color.from_gradient(medianRet, 0, array.max(medianReturns), color.rgb(76, 175, 80), color.rgb(0, 128, 0))
medianBearCol = color.from_gradient(medianRet, array.min(medianReturns), 0, color.rgb(255, 0, 0), color.rgb(255, 99, 71))
table.cell(statsTable, col + 1, 1, str.format("{0,number,#.##%}", winRate), text_color=color.white, bgcolor=winRateColor, text_size=fontSizeMap)
table.cell(statsTable, col + 1, 2, str.format("{0,number,#.###}%", meanRet), text_color=color.white, bgcolor=meanRet > 0 ? meanBullCol : meanBearCol, text_size=fontSizeMap)
table.cell(statsTable, col + 1, 3, str.format("{0,number,#.###}%", medianRet), text_color=color.white, bgcolor=medianRet > 0 ? medianBullCol : medianBearCol, text_size=fontSizeMap)
//#endregion
// Background color for OB/OS regions
bgcolor(rsiValue >= overboughtLevel ? color.new(color.red, 90) : rsiValue <= oversoldLevel ? color.new(color.green, 90) : na)
Volatility Zones (STDEV %)This indicator displays the relative volatility of an asset as a percentage, based on the standard deviation of price over a custom length.
🔍 Key features:
• Uses standard deviation (%) to reflect recent price volatility
• Classifies volatility into three zones:
Low volatility (≤2%) — highlighted in blue
Medium volatility (2–4%) — highlighted in orange
High volatility (>4%) — highlighted in red
• Supports visual background shading and colored line output
• Works on any timeframe and asset
📊 This tool is useful for identifying low-risk entry zones, periods of expansion or contraction in price behavior, and dynamic market regime changes.
You can adjust the STDEV length to suit your strategy or timeframe. Best used in combination with your entry logic or trend filters.
Multi-Timeframe Close Alert with Toggleyou can create alerts with this indicator for when a time frame closes
Multi-Timeframe Market Regime (Ehlers)This Pine Script indicator provides an Ehlers-inspired multi-timeframe market regime analysis directly on your TradingView chart. It aims to identify whether the market is currently "Trending Up" (green), "Trending Down" (red), or "Ranging" (yellow) across Weekly, Daily, 4-Hour, and 1-Hour timeframes.
It uses custom implementations of:
Ehlers' Fisher Transform to highlight market extremes and potential turning points.
An Adaptive Moving Average (inspired by MAMA/FAMA) that adjusts its speed based on volatility to reduce lag in trends and provide stability in ranges.
The indicator displays a dashboard as a label on your chart, showing the detected regime for each of these timeframes, and optionally colors the background of your current chart timeframe to reflect its dominant regime.
ZY Legend StrategyZY Legend Strategy indicator follows the trend, sets up transactions and clearly shows the transactions it opens on the chart. SL is not used in the strategy, instead, additions are made to positions.
EMA Cloud 200 High/Close (multi)EMA Cloud 200 High/Close (multi)
This indicator plots an EMA cloud between two 200-period Exponential Moving Averages—one based on High prices, the other on Close prices. Choose your preferred timeframe or use the current chart timeframe. The cloud’s color changes to green (bullish) or red (bearish) depending on trend direction, making it easy to spot support, resistance, and market trends at a glance.
EMA Cloud 200 High/Close с цветом трендаEMA Cloud 200 High/Close with Trend Color
Overview
This indicator creates a dynamic EMA cloud between two Exponential Moving Averages calculated from different price sources, providing clear visual trend identification and support/resistance zones.
Key Features
Dual EMA System: Upper EMA based on High prices, Lower EMA based on Close prices
Custom Timeframe: Analyze EMA on any timeframe regardless of chart timeframe
Dynamic Trend Coloring: Green for uptrend, Red for downtrend
Visual Cloud: Filled area between EMAs highlights price zones
Configurable Period: Default 200-period EMA (adjustable)
How It Works
The indicator calculates two separate 200-period EMAs:
Upper EMA: Based on High prices - shows resistance levels
Lower EMA: Based on Close prices - shows support levels
Trend Detection:
Current price above average EMA = Green (Bullish)
Current price below average EMA = Red (Bearish)
Trading Applications
Trend Identification: Color changes indicate trend shifts
Support/Resistance: Cloud boundaries act as dynamic S/R zones
Entry/Exit Points: Price interaction with cloud edges
Multi-timeframe Analysis: View higher timeframe EMAs on lower timeframe charts
Settings
EMA Period: Adjust calculation period (default: 200)
Top Source: Price source for upper EMA (default: High)
Bottom Source: Price source for lower EMA (default: Close)
Custom Timeframe: Choose analysis timeframe (default: 15min)
Best Practices
Use on trending markets for optimal results
Combine with other indicators for confirmation
Higher timeframes provide stronger signals
Cloud thickness indicates volatility levels
Perfect for swing traders and trend followers seeking clear visual trend analysis with dynamic support/resistance identification.
CLMM Vault策略回测 (专业版) v5Explanation of the CLMM (Concentrated Liquidity - Market Maker) Strategy Backtesting Model Developed for the Sui Chain Vaults Protocol
Why Are We Doing This?
Conducting strategy backtesting is a crucial step for us to make data-driven decisions, validate the feasibility of strategies, and manage potential risks before committing real funds and significant development resources. A strategy that appears to have a high APY may perform entirely differently once real-world frictional costs (such as rebalancing fees and slippage) are deducted. The goal of this backtesting model is to quickly and cost-effectively identify which strategy parameter combinations have the potential to be profitable and which ones pose risks before formal development, thereby avoiding significant losses and providing data support for the project's direction.
Core Features of the Backtesting Model
We have built a "pro version" (v5) strategy simulator using TradingView's Pine Script. It can quickly simulate the core performance of our auto-compounding and rebalancing Vaults on historical price data, with the following main features:
Auto-Compounding: Continuously adds the generated fee income to the principal based on the set profit range (e.g., 0.01%).
Auto-Rebalancing: Simulates automatic rebalancing actions when the price exceeds the preset profit range and deducts the corresponding costs.
Smart Filtering Mechanism: To make the simulation closer to our ideal "smart" decision-making, it integrates three freely combinable filtering mechanisms:
Buffer Zone: Tolerates minor and temporary breaches of the profit range to avoid unnecessary rebalancing.
Breakout Confirmation: Requires the price to be in the trigger zone for N consecutive candles to confirm a breakout, filtering out market noise from "false breakouts."
Time Cooldown: Enforces a minimum time interval between two rebalances to prevent value-destroying high-frequency trading in extreme market conditions.
Important: Simplifications and Assumptions of the Model
To quickly prototype and iterate on the TradingView platform, we have made some key simplifications to the model.
A fully accurate backtest would require a deep simulation of on-chain liquidity pools (Pool Pair), calculating the price impact (Slippage) and impermanent loss (IL) caused by each rebalance on the pool. Since TradingView cannot access real-time on-chain liquidity data, we have made the following simplifications:
Simplified Rebalancing Costs: Instead of simulating real transaction slippage, we use a unified input parameter of single rebalance cost (%) to "bundle" and approximate the total of Gas fees, slippage, and realized impermanent loss.
Simplified Fee Income: Instead of calculating fees based on real-time trading volume, we directly input an average fee annualized return (%) as the core income assumption for our strategy.
How to Use and Test
Team members can load this script and test different strategies by adjusting the input parameters on the panel. The most critical parameters include: position profit range, average fee annualized return, single rebalance cost, and the switches and corresponding values of the above three smart filters.
Red Report Filter x 'Bull_Trap_9'Hello Traders!
This one is my favorite.
This is indicator / filter: '2 of 2.'
'1 of 2' is the, 'Closed Market Filter,' I posted before this that you may like.
Again, I prefer 'Filter' over 'Indicator' because this Pine Script code does not interact with the actual price data.
It makes handling high impact reports effortless.
As you all know; if you're on a Prop and breach a 'Red,' you lose your account.
This will filter up to 5 reports. More than enough unless you're on EURUSD!
It offers both 'Red' and 'Orange' report control.
The default window times of 15 / 6 are programmed for red events. You can always alter the base code for your desired, 'Before / After.'
Click the tooltip for more info.
How to use:
You do need to update the inputs daily with the current report times before each open.
I trade YM / US markets. Those reports are very repetitive on their delivery times, so I usually leave a 10:00 setting in slot 1. I then toggle it 'On' or 'Off' per demand.
Just open the dialogue box and it is pretty self explanatory.
I used task scheduler for a lot of years, but that wasn't very reliable, modest work to set up daily and a lot of times I may not hear it or it malfunctions because of a Windows update.
TradingView has the little icon that floats from the bottom right, but who really looks for that.
Any audio alert is subject to fail for a number of reasons.
This filter REDS the screen in your face. Leaves no doubt about what's coming.
I know there may be other apps and options out there, but this filter is integral to the TradingView chart itself embedded through Pine Script. It is right there, a click away, easy to input data, and as long as your chart is active and working, the filter will fire.
I did not build an alert condition into this, but I'm sure that could be an option if you want to program in audio as well.
Please Note: Only when the price candles push into the filter zone, will the filter start to display. Run a test a minute from the current price candle and you can see how it functions.
I appreciate your interest.
EMA Crossover + RSI Confirmation (Buy/Sell)Updated version for EMA crossover stategy with RSI confirmation
EMA Crossover + RSI Confirmation (Buy/Sell)This indicator provides buy and sell signals based on EMA9 and EMA21 crossover with confirmation from RSI
Previous 2 Days High/LowCan you give me a summary of this indicator
The "Previous 2 Days High/Low" indicator, written in Pine Script v5 for TradingView, plots horizontal lines representing the combined high and low prices of the previous two trading days on a chart. Here's a summary of its functionality, purpose, and key features:
Purpose
The indicator helps traders identify significant price levels by displaying the highest high and lowest low from the previous two days, which can act as potential support or resistance levels. These levels are plotted as lines that extend across the current trading day, making it easier to visualize key price zones for trading decisions.
Key Features
Calculates Combined High and Low:
Retrieves the high and low prices of the previous day and the day before using request.security on the daily timeframe ("D").
Computes the combined high as the maximum of the two days' highs and the combined low as the minimum of the two days' lows.
Dynamic Line Plotting:
Draws two horizontal lines:
Red Line: Represents the combined high, plotted at the highest price of the previous two days.
Green Line: Represents the combined low, plotted at the lowest price of the previous two days.
Lines are created at the start of a new trading day and extended to the right edge of the chart using line.set_x2, ensuring they span the entire current day.
Labels for Clarity:
Adds labels to the right of the chart, displaying the exact price values of the combined high ("Combined High: ") and combined low ("Combined Low: ").
Labels are updated to move with the lines, maintaining alignment at the current bar.
Clutter Prevention:
Deletes old lines and labels at the start of each new trading day to avoid overlapping or excessive objects on the chart.
Dynamic Requests:
Uses dynamic_requests=true in the indicator() function to allow request.security calls within conditional blocks (if ta.change(time("D"))), enabling daily data retrieval within the script's logic.
Vertical Lines at 8AM, 9AM, 8PM & 9PMVertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT.
ORB Screener-Multiple Indicators [Marin adjusted]ORB screener for multiple instruments. it needs just the customization of time/ timezone.
Closed Market / Back-Test Filter x 'Bull_Trap_9'Hello TradingView Traders!
This is a very valuable tool that I believe all traders will find useful.
This indicator / filter is '1 of 2'. I prefer it as a filter because it is not meant for live trade analysis. It is designed to make a trader aware of their individual trade sessions and to help aid in static chart candlestick back-testing.
Also, look for my indicator / filter, '2 of 2': 'Red Report Filter'
There are two functions to this filter.
Primary use: It allows a trader to set a session window: Open / Close.
During a trade session, like YM, I only trade 9:30 - 15:00. Without the filter, many times I have traded past my cutoff because I was focused on the chart and not the time.
With this filter on as close nears with an open trade and the filter starts to apply, I know I am at session close with no more trades upon exit. Otherwise, I know the session is done with no further trades.
It is also nice to have the filter on during the session open as a demarcation boundary.
Secondary use: It is used as a chart back-test tool.
When applied to a traders back-test chart, the trader can control their trade session envelopes for easier and more precise evaluation. The filter will allow only the candles per session that the trader wants to focus on and will filter all other non-session candles.
I can easily compare a whole week of 30m session data, concentrating solely on the filtered trade windows.
Please Note: The filter will be active as far back as the historic data prints.
Thanks for viewing!
High Power CandlesThis indicator provides information about the strength of the candles in favor of the trend, following the logical meaning: green (rising force), yellow (little force), red (downward force)
Bollinger Bands Levels | VTS Pro📊 Bollinger Bands Levels | VTS Pro
by Alireza Mossaheb
This advanced Bollinger Bands indicator takes your technical analysis to the next level by providing dynamic price bands along with customizable horizontal levels and labels. Whether you're a trend trader or a mean reversion strategist, this tool adapts to your workflow.
🔧 Key Features:
Three Modes: Choose between Strong (20, 2), Weak (10, 1.5), or Custom settings for full control.
Multi-Timeframe Support: Plot Bollinger Bands from any higher or lower timeframe.
Multiple MA Types: Select from SMA, EMA, RMA (SMMA), WMA, and VWMA for the basis line.
Visual Enhancements:
Optional background fill between bands
Stylized horizontal lines with labels (Top/Mid/Low)
Customizable line style, width, and color
Smart Labeling: Automatically names levels based on timeframe and mode.
Improved Plot Logic: Line width bug fixed for smoother rendering across presets.
🧠 Ideal For:
Spotting volatility squeezes or expansions
Confirming support/resistance with upper/lower bands
Creating confluence zones using higher timeframe Bollinger levels
Previous Day O H L C Calculation By Md//@version=6
indicator("Previous Day O H L C Calculation By Md", overlay=true)
// Check if the previous daily candle is green (bullish) or red (bearish)
previousCandleBullish = close > open
previousCandleBearish = close < open
// Calculate the difference for bullish candles: previous day's high minus previous day's open
bullishCalculation = high - open
// Calculate the difference for bearish candles: previous day's low minus previous day's close
bearishCalculation = low - close
// Show the result at the top of the current daily candle if the previous candle was bullish
if previousCandleBullish
label.new(bar_index, high, "Bullish Calc: " + str.tostring(bullishCalculation), color=color.green, textcolor=color.white, style=label.style_label_left, size=size.small)
// Show the result at the bottom of the current daily candle if the previous candle was bearish
if previousCandleBearish
label.new(bar_index, low, "Bearish Calc: " + str.tostring(bearishCalculation), color=color.red, textcolor=color.white, style=label.style_label_left, size=size.small)
HTF Previous Candle Sweeps (1H–4D) - Safesa f as. as f. f sf s. sa fs. fsadsjaf dsadf jsdaf sdjf sajk fj sdfj saf d sj sadsd
HTF Previous Candle Sweeps (1H–4D)This is a TVS entry module, marking out the DOL and Previous candle sweeps.