Risk sizing toolHelps you manage risk per trade accurately.
Automatically adjusts position size if the stop-loss or account constraints are exceeded.
Gives a clear visual summary directly on your stock chart.
Prevents taking trades that are too large relative to your account.
Indicadores e estratégias
Bollinger Band ToolkitBollinger Band Toolkit
An advanced, adaptive Bollinger Band system for traders who want more context, precision, and edge.
This indicator expands on the classic Bollinger Bands by combining statistical and volatility-based methods with modern divergence and squeeze detection tools. It helps identify volatility regimes, potential breakouts, and early momentum shifts — all within one clean overlay.
🔹 Core Features
1. Adaptive Bollinger Bands (σ + ATR)
Classic 20-period bands enhanced with an ATR-based volatility adjustment, making them more responsive to true market movement rather than just price variance.
Reduces “overreacting” during chop and avoids bands collapsing too tightly during trends.
2. %B & RSI Divergence Detection
🟢 Green dots: Positive %B divergence — price makes a lower low, but %B doesn’t confirm (bullish).
🔴 Red dots: Negative %B divergence — price makes a higher high, but %B doesn’t confirm (bearish).
✚ Red/green crosses: RSI divergence confirmation — momentum fails to confirm the price’s new extreme.
These signals highlight potential reversal or slowdown zones that are often invisible to the naked eye.
3. Bollinger Band Squeeze (with Volume Filter)
Yellow squares (■) show periods when Bollinger Bands are at their narrowest relative to recent history.
Volume confirmation ensures the squeeze only triggers when both volatility and participation contract.
Often marks the “calm before the storm” — breakout potential zones.
4. Multi-Timeframe Breakout Markers
Optionally displays breakouts from higher or lower timeframes using different colors/symbols.
Lets you see when a higher timeframe band break aligns with your current chart — a strong trend continuation signal.
5. Dual- and Triple-Band Visualization (±1σ, ±2σ, ±3σ)
Optional inner (±1σ) and outer (±3σ) bands provide a layered volatility map:
Price holding between ±1σ → stable range / mean-reverting behavior
Price riding near ±2σ → trending phase, sustained momentum
Price touching or exceeding ±3σ → volatility expansion or exhaustion zone
This triple-band layout visually distinguishes normal movement from statistical extremes, helping you read when the market is balanced, expanding, or approaching its limits.
⚙️ Inputs & Customization
Choose band type (SMA/EMA/SMMA/WMA/VWMA)
Adjust deviation multiplier (σ) and ATR multiplier
Toggle individual features (divergence dots, squeeze markers, inner bands, etc.)
Multi-timeframe and colour controls for advanced users
🧠 How to Use
Watch for squeeze markers followed by a breakout bar beyond ±2σ → volatility expansion signal.
Combine divergence dots with RSI or price structure to anticipate slowdowns or reversals.
Confirm direction using multi-timeframe breakouts and volume expansion.
💬 Why It Works
This toolkit transforms qualitative chart reading (tight bands, hidden divergence) into quantitative, testable conditions — giving you objective insights that can be backtested, coded, or simply trusted in live setups.
Volume Spike (Multi-Timeframe)Volume Spike (Multi-Timeframe)
Overview
Volume Spike (Multi-Timeframe) evaluates traded volume against its moving average on a selected timeframe so traders can identify when activity departs from recent norms.
What it does
Calculates volume on the chart timeframe or any alternate timeframe you select in the inputs.
Builds a configurable simple moving average to establish a rolling volume benchmark.
Applies distinct colors to spike and baseline volume columns to highlight deviations.
Plots the related moving-average line for reference.
Registers an alert condition when volume closes above its moving-average baseline.
How to use it
Choose the desired Volume Timeframe (leave blank to inherit the chart’s period).
Tune the Volume MA Length to balance responsiveness and noise.
Adjust the spike, base, and MA colors to align with existing chart styling.
Enable the alert condition when automated notification of spikes is needed.
Implementation notes
Timeframe selection is applied consistently to both the raw volume series and its moving average.
Color inputs allow visual adjustments without modifying code.
Alert messaging specifies that the event is a volume spike relative to the selected timeframe baseline.
Disclaimer
This indicator is designed as a technical analysis tool and should be used in conjunction with other forms of analysis and proper risk management.
Past performance does not guarantee future results, and traders should thoroughly test any strategy before implementing it with real capital.
Image Plotter [theUltimator5]Image Plotter is a visual alerting tool that drops fun, high-contrast ASCII (braille) art (e.g., Rocket, Cat “hang in there”, Babe Ruth, etc.) directly on your price chart when a technical trigger fires. It’s designed for quick, glanceable callouts without cluttering your chart with lines or sub-indicators.
If there are any specific images you would like to be able to add to your plot, please comment with the image you want to see and if it is reasonable, I will add it.
How it works
On each bar close, the script evaluates your selected Trigger Source. When the condition is true, it places a label that contains the selected ASCII art at a configurable offset above or below the candle.
You can choose to only keep the most recent art on the chart, or accumulate every trigger as a historical breadcrumb trail.
Positioning uses either the bar’s high (for above-candle placements) or low (for below-candle placements), then applies your vertical % offset and horizontal bar shift.
Inputs & Controls
Trigger Source
Select which condition will fire the ASCII placement:
RSI Oversold / Overbought — Triggers on cross through the threshold (under/over).
MACD Bullish Cross / Bearish Cross — MACD line crossing the Signal line.
BB Lower Touch / BB Upper Touch — Price crossing below the lower band / above the upper band.
Stochastic Oversold / Overbought — %K crossing through your thresholds.
Volume Spike — Current volume > (Volume MA × Spike Multiplier).
Price Cross MA — Close crossing above the chosen moving average (bullish only).
Custom Condition — Optional user condition (see “Custom Condition” below).
Plot Mode
Latest Only — The indicator deletes the previous label and keeps only the newest trigger on chart.
Every Trigger — Leaves all triggered labels on the chart (historical markers).
Note: TradingView caps the number of labels per script; this indicator sets max_labels_count=500. Heavy triggering can still hit limits.
Practical usage tips
Choose “Latest Only” for cleanliness if your trigger is frequent. Use “Every Trigger” when you want a visual audit trail.
Tune vertical offset by symbol — low-priced tickers may need a smaller %; volatile names may need more spacing.
Quick start
Add the indicator to any chart (any timeframe).
Pick a Trigger Source (e.g., RSI Oversold) and set thresholds/lengths.
Choose ASCII Image, Position Above/Below, Offsets, and Plot Mode.
(Optional) Enable Custom Condition and select your Custom Plot Source.
Create an Alert on “ASCII Trigger Alert” using Once Per Bar Close.
Have a variant you’d like (e.g., bearish MA cross, multi-alert pack by trigger, or time-window filters)? Tell me what workflow you want and I’ll tailor the script/description to match.
Mark the New York trading session hours(纽约交易时间段标注)Apply background shading for New York time.
(纽约时间背景着色)
04:00 ~ 09:00
09:00 ~ 09:30
09:30 ~ 12:00
No shading needed after 12 AM as I'll be asleep.
(12点我睡觉了就不着色了。)
ATR Anchored Range %b by TradeSeekersAll time highs got you spooked to enter with no levels in sight?
Stuck in a multi-week range and wondering where the heck the pivots are!?
Wondering if you're longing the top or shorting the potential bottom and about to get smoked, sending you back to burger flipping?!
Fret not trading friends!
I've been crafting the ultimate map for scalpers, slingers, swingers, swindlers, swashbucklers -and traders too.
Why should I care about this, what's an ATR!?
Nearly any trader that's entered the markets has heard of ATR, perhaps even taken a stab at trying to calculate the flux capacity of a weekly ATR on a lower timeframe. Continually calculating things manually sucks!
Ok, so you haven't heard of ATR? It's the average true range... what's the true range!? It's simply the low subtracted from the high (high - low) of any given candle.
How is ATR useful?
The theory is simple, if the ATRs on the daily timeframe for a stock are 5, then traders may have a reasonable expectation that any day in the near future the stock will mostly move +/- 5 pts. This +/- 5 can be used as a possible daily high and low for traders to use.
But ATR changes as time passes, with every billionaire X post, viral cat meme, fed announcement or government shutdown the market makes it's move. This means without this tool, traders need to run the standard lame (sorry) ATR indicator and then hand draw a bunch of important levels (barf).
I'm convinced and ready to join the ATR army, what do I do?
Glad to have you aboard sailor, slap this indicator on your layout - it'll initially display a bottom panel, say nice things to it.
Usage
The lower panel provides a %b plot representative of the current price relative to the timeframe and period ATR. (Defaults to 1D timeframe and 20 - 20 trading days in a month yo)
This %b plot is a map for price against the key ATR based levels and resets each time the timeframe change occurs.
Keep reading! (maybe grab a snack, you're doing great)
If you want to see what the indicator sees, how it maths the math, open the settings and check the "overlay" option... it's amazing, I know.
Main base of operations
This will be the gray area between first red and green lines, imagine this is a future candle for the timeframe anchored. The red would represent the candle high (red means stop/overbought), and the green would represent the candle low (green means go/oversold).
Regardless of the timeframe anchored, this area always represents the area the ATR indicates will be the building area of the current candle being formed. Traders should expect most of the trading to occur within this area.
The mid line
Don't diddle in the middle, this by default is the open price and it's the ultimate bias filter for bull or bear riders.
Extension areas
Beyond the gray area is the extension zone, this provides a whole ATR from the mid line to the extension.
Assembling a trade plan
There are just a couple of key concepts to master in order to become the ultimate ATR samurai warrior, capable of slicing through even the messiest liquidity.
Above the midline and holding, but still within the gray area? Could be a great long entry with targets to upper levels. The same holds true for below open and holding while still being within the lower gray area.
As price makes it's ascension or decline towards the ends of the initial gray ATR range, consider managing trades here. If it's suspected, due to a strong hold of the midline, that the range low or high is the midline, then continue to manage trades towards the extension zones.
Timeframes and periods oh my
The tooltips already provide some hints, but not everyone goes around clicking and hovering everything in sight (maybe I'm the only one that does that?).
There's a thoughtful approach to the default values, I like to consider the big market participants with my day trades, swings trades and beyond.
By default I've chosen the daily timeframe and a period of 20, one for each trading day of the calendar month.
It's no large leap to consider alternatives, what about 1W timeframe and a period of 4 (1 month) or 52 (1 year)?
The possibilities are nearly infinite, comment on any particular favorite combos.
An Italian Special Bonus!!!
...sorry, it's not pizza....
First, did you know the famous Italian Fibonacci's real name was actually Leonardo? I'm not sure how I feel about that. Fun fact, my ancestors are Italian.
Alright, you may have guessed that the special bonus is the mythical Fibonacci inspired "Golden Pocket", maybe it's a foreshadowing of your pockets - one can only hope.
Use this feature to show the commonly referenced Fibonacci levels within each major ATR range. I've seen some totally mathematical epic-ness with these hence the addition.
Once key ATR levels have been hit look for reversals back to golden pockets (you tricksy hobbits) for potential entry back towards the prior hit ATR level.
The %b turns gold if you have the feature enabled and of course the overlay displays them also, how fun!
Final thoughts
I hope you have as much fun using this indicator as I do, it has brought much joy to my trading experience. If you don't have fun with it, well I hope you had fun reading about it at least.
100% human crafted and darn proud of it
- SyntaxGeek
Trend Patterns_Trend Model此腳本根據《超級績效:金融怪傑交易之道》中的【趨勢樣板】進行撰寫
當時股價高於一百五十天(三十週)與兩百天(四十週)移動平均。
一百五十天移動平均高於兩百天移動平均。
兩百天移動平均至少有一個月期間處於上升狀態(多數情況最好有四、五個月以上)。
五十天移動平均同時高於一百五十天與兩百天移動平均。
當時股價高於五十天移動平均。
當時股價較五十二週低點至少高出30%(很多最佳候選股在突破橫向整理而展開大規模漲勢之前,股價已經較五十二週低點高出100%、300%或更多。)
目前股價距離五十二週高點不超過25%(愈接近愈好)。
相對強度評等(relative strength ranking,根據《投資人經濟日報》 的資料)不低於70,最好是80多或90多,而且較佳候選股總是如此。
This script is based on the 【Trend Patterns】 in 《Trade Like a Stock Market Wizard》.
The current stock price is above both the 150-day (30-week) and the 200-day (40-week) moving average price lines.
The 150-day moving average is above the 200-day moving average.
The 200-day moving average line is trending up for at least 1 month (preferably 4-5 months minimum in most cases).
The 50-day (10-week) moving average is above both the 150-day and 200-day moving averages.
The current stock price is trading above the 50-day moving average.
The current stock price is at least 30 percent above its 52-week low. (Many of the best selections will be 100 percent, 300 percent, or greater above their 52-week low before they emerge from a solid consolidation period and mount a large scale advance.)
The current stock price is within at least 25 percent of its 52-week high (the closer to a new high the better).
The relative strength ranking (as reported in Investor's Business Daily) is no less than 70, and preferably in the 80s or 90s, which will generally be the case with the better selections.
Sessions Candle Colors1. Candle Display Mode
Choose how your candles are rendered:
Normal – Standard bullish/bearish candles with theme-based colors.
Normal – Single – Candles displayed in a single neutral tone.
Session – Candles colored by active trading sessions.
Session – Single – Session-based candles in a single tone.
None – Disables custom candles (useful if you prefer chart elements only).
2. Theme: Normal Candles
Includes a curated set of themes for standard candles.
Default: Light – BW
Available Themes:
Dark – Prime
Dark – Violet
Dark – Ice
Dark – Bronze
Dark – BW
Light – BW
Light – ICT (Inner Circle Trader)
Light – S&F (Set and Forget)
3. Theme: Session Candles
Custom palettes for session-based modes:
Light – AnandaDivine
Light – WealthFRX
Note: “Light” and “Dark” indicate which chart background the theme is optimized for.
4. Hide Gaps
Enables a custom gapless mode by forcing each candle’s open to match the previous close.
This option helps maintain visual continuity on charts with irregular price feeds.
Tip: For best results, disable TradingView’s built-in candles under chart settings before enabling this indicator.
REMS Synergy OverlayThis 3rd generation REMS indicator builds upon the foundations assessing the relationships between RSI, EMAs, MACDs, and Stochastic RSI across multiple timeframes. Designed to help traders identify less frequent, but high probability entries across 2 time frames. Uses 3 levels of confluence indicators for both long and short moves.
Confluence Level 1 (Highest Conviction):
Evaluates selected criteria across both timeframes. All selected criteria must be in confluence to trigger signal.
Confluence Level 2 (Moderate Conviction):
Selected criteria can be selected by each timeframe individually. All selected criteria must be in confluence to trigger signal.
Confluence Level 3 (Lower/supportive confluence):
Of the selected criteria, this level can evaluate a set number of conditions that must be met. Number of conditions is user-defined.
Includes VWAP and 4 EMAs as optional visual representations.
Includes 'Enhanced Candles' than can colour code candlesticks for better visual identification. (off by default)
Originally designed with 5 minute and 2 minute timeframes in mind, and pairs well with REMS First Strike and/or REMS Snap Shot indicators.
Values coded below:
RSI
-Primary: Length = 14, Smoothing = 20 (via SMA)
-Secondary: Length = 7, Smoothing = 20 (via SMA)
Stochastic RSI
Primary:
-RSI Length = 14
-Stochastic Length = 8
-%K = 3, %D = 3
Secondary:
-RSI Length = 7
-Stochastic Length = 7
-%K = 3, %D = 2
MACD - applied to both timeframes
-Fast = 12, Slow = 26, Signal = 9
Cruce EMA 9 y EMA 55EMA 9 and EMA 55 Crossover is a simple and effective indicator based on the crossover of exponential moving averages.
When the EMA 9 crosses above the EMA 55, it generates a buy signal, indicating a possible start of a bullish trend.
When the EMA 9 crosses below the EMA 55, it generates a sell signal, suggesting a potential shift to a bearish trend.
Ideal for identifying trend changes in any market — Forex, indices, cryptocurrencies, or commodities.
Compatible with scalping, day trading, and swing trading strategies.
Yuki Leverage RR Calculator**YUKI LEVERAGE RR CALCULATOR**
A professional-grade risk/reward calculator for leveraged crypto or forex trades.
Instantly visualizes entry, stop loss, targets, leverage, and risk-to-reward ratios — helping you plan precise positions with confidence.
──────────────────────────────
**WHAT IT DOES**
Calculates position value, quantity, stop-loss price, liquidation estimate, and per-target profit.
Displays everything in an on-chart table with optional price tags and alerts.
──────────────────────────────
**KEY FEATURES**
• Long / Short toggle (only one active at a time)
• Leverage-aware position sizing based on Position Cost ($) and Leverage
• Dynamic Stop Loss: input % → auto price + $ risk
• Up to 3 Take-Profit Targets with scaling logic
• Instant R:R ratios per target
• Liquidation estimate (approximation only)
• ENTRY / SL / T1 / T2 / T3 / LIQ visual tags
• Dark/Light mode, adjustable table and tag size
• Built-in alerts for Targets and Stop Loss
──────────────────────────────
**INPUTS**
• Long or Short selection
• Entry Price, Stop Loss %
• Target 1 / Target 2 / Target 3 + Take Profit %
• Position Cost ($), Leverage
• Visual preferences: show/hide table, table corner, font size, tag offset, text size
──────────────────────────────
**TABLE OUTPUTS**
Position Info: Type, Entry, Position Cost, Leverage, Value
Risk Section: Stop Loss %, Stop Loss Price, Total Risk ($), Liquidation % & Price
Targets 1–3: Profit ($), R:R, Take Profit ($), Runner % or PnL
──────────────────────────────
**ALERTS**
• Target 1 Hit – when price crosses T1
• Target 2 Hit – when price crosses T2
• Target 3 Hit – when price crosses T3
• Stop Loss Hit – triggers based on direction
(Use TradingView Alerts → Condition → Indicator → select desired alert)
──────────────────────────────
**HOW TO USE**
1. Choose Long or Short
2. Enter Entry Price, Stop Loss %, Position Cost, and Leverage
3. Add Targets 1–3 with optional Take Profit %
4. Adjust visuals as desired
5. Monitor table + alerts for live trade planning
──────────────────────────────
**NOTES**
• Liquidation values are estimates only
• Fees, slippage, and funding not included
• Designed for educational and planning purposes
──────────────────────────────
⚠️ **DISCLAIMER**
For educational use only — not financial advice.
Trading leveraged products involves high risk of loss.
Always confirm calculations with your exchange and trade responsibly.
UVOL/DVOL RatioThe VOLD ratio, or Volume Difference Ratio, measures the relationship between the volume of shares traded in rising stocks versus those in falling stocks. It helps traders assess market breadth and sentiment, indicating whether the market is leaning towards buying or selling.
Chart Fusion Line SND Detection & Signals by TitikSona### Overview
Fusion Line Momentum Analyzer merges Double Stochastic and RSI into a single adaptive oscillator that visualizes momentum direction and strength.
It helps identify overbought and oversold conditions through a smooth blended curve that adapts across timeframes.
Designed for analytical purposes and to simplify momentum reading without complex triggers or repainting methods.
---
### Core Idea
The indicator fuses three classical momentum tools:
- Fast Stochastic (12,3,3) for short-term swings
- Slow Stochastic (100,8,8) for long-term momentum stability
- RSI (26) for measuring internal strength between buyers and sellers
These three are normalized and averaged into one unified line called the **Fusion Line**.
A secondary smoothing layer, the **Signal Line**, refines the direction and removes minor fluctuations.
---
### Features
- Unified momentum line combining Fast and Slow Stochastic with RSI
- Real-time momentum strength percentage (adaptive scale)
- Color-coded momentum bias for easy interpretation
- Optional info box showing component strength and overall state
- Background shading to visualize dominant momentum direction
- Optional alerts when Fusion Line crosses common momentum zones (20 and 80)
---
### Default Parameters
Fast Stochastic (12,3,3)
Slow Stochastic (100,8,8)
RSI Length (26)
Signal Line Smoothing (9)
All parameters can be modified to match volatility or personal style.
---
### How to Read
- A rising Fusion Line often reflects strengthening bullish momentum.
- A falling Fusion Line often reflects increasing bearish pressure.
- Strength percentage represents how dominant the current bias is.
- Extreme levels (near 20 or 80) indicate potential exhaustion or recovery areas.
Always interpret readings with market context such as trend direction, structure, and volume.
---
### Interpretation Guide
Low Fusion levels may indicate possible accumulation or recovery.
High Fusion levels may signal overextension or slowing momentum.
Neutral mid-levels represent balance between buying and selling pressure.
---
### Disclaimer
This script is an analytical visualization tool for studying market momentum.
It does not generate trading signals or predict market direction.
Always combine with structure, volume, and higher-timeframe context before making any trading decisions.
---
### Developer
Created by **TitikSona** — Research & Fusion Concept Designer
Built using **Pine Script v6**
Type: Open-source educational script
---
### Short Description
Adaptive momentum analyzer combining Double Stochastic and RSI into one Fusion Line with real-time strength visualization.
4StochsThis indicator shows when four Stochastics (9, 14, 30, and 60) are aligned—up, down, or flat.
A red down triangle appears when the Stochastics are in descending order (60, 30, 14, 9), indicating a potential bearish move.
A green up triangle appears when they are in ascending order (9, 14, 30, 60), indicating a potential bullish move.
A lime diamond appears when the four Stochastics are not aligned, signaling a sideways market.
Hello Pine//@version=6
indicator("Barcolor Test v6", overlay=true)
fastMA = ta.sma(close, 50)
slowMA = ta.sma(close, 200)
buySignal = ta.crossover(fastMA, slowMA)
sellSignal = ta.crossunder(fastMA, slowMA)
barcolor(buySignal ? color.new(color.green, 0) : sellSignal ? color.new(color.red, 0) : color.na)
True Single Line Fusion [by TitikSona]🧠 Full Description
True Single Line Fusion by TitikSona is an open-source oscillator that unifies Fast Stochastic, Slow Stochastic, and RSI into a single smooth momentum line.
It simplifies multi-oscillator analysis into one clear visual — helping traders recognize potential momentum shifts, exhaustion, and reversal zones.
⚙️ Core Logic
The indicator calculates:
Fast Stochastic (12,3,3) → short-term swing sensitivity
Slow Stochastic (100,8,8) → broad trend context
RSI (26) → overall strength and directional bias
All three are normalized (0–100) and averaged to form the Fusion Line, creating a single unified momentum curve.
A Signal Line (SMA-9) and Histogram are added to highlight short-term acceleration or deceleration.
Formula: Fusion = (FastK + SlowK + RSI) / 3
🔍 Interpretation
Fusion Line rising → momentum strengthening upward
Fusion Line falling → momentum weakening
Histogram color (green/red) shows the direction and intensity of the move
Background highlights identify potential extremes:
🟩 Green = potential oversold region
🟥 Red = potential overbought region
💡 How to Use
Works on any symbol and timeframe.
Use the Fusion Line’s direction and slope as momentum context, not as direct buy/sell signals.
Combine with price structure, support/resistance, or volume analysis to confirm potential reversals.
Example:
Fusion Line turning upward from green zone → possible bullish momentum shift
Fusion Line turning downward from red zone → possible bearish exhaustion
📘 Notes
Ideal for identifying turning points in ranging or consolidating markets.
Does not generate automated signals or predictions.
Open-source for learning, modification, and educational use.
Designed for clarity, low lag, and clean visualization.
🧩 Developed and shared by TitikSona — made to unify oscillators into one adaptive momentum tool.
Crypto Killer TFCrypto Killer - Dual trend confirmation strategy. Uses a fast trend line for signals and a slow trend line as a filter. Only enters long or short when both agree, which cuts out fake breakouts and keeps you in real moves.
Fast trend line catches momentum shifts and signals entries/exits
Slow trend line filters the bigger picture and confirms direction
Only trades when BOTH trends agree - no more getting chopped in sideways action
Works long and short on any timeframe
Built specifically for crypto volatility
Stop guessing. Let the trends guide you.
Color Test
You sent
//@version=5
indicator("EZ Buy/Sell with Auto SL & TP (final typed version)", overlay=true)
// --- Signals (50/200 MA) ---
fastMA = ta.sma(close, 50)
slowMA = ta.sma(close, 200)
buySignal = barstate.isconfirmed and ta.crossover(fastMA, slowMA)
sellSignal = barstate.isconfirmed and ta.crossunder(fastMA, slowMA)
// --- Risk settings ---
method = input.string("ATR", "Stop Method", options= )
atrLen = input.int(14, "ATR Length", minval=1)
atrMult = input.float(1.5, "Stop = ATR x", step=0.1, minval=0.1)
pctStop = input.float(2.0, "Stop = % (if Percent)", step=0.1, minval=0.1)
tpR1 = input.float(1.0, "TP1 (R multiples)", step=0.25, minval=0.25)
tpR2 = input.float(2.0, "TP2 (R multiples)", step=0.25, minval=0.25)
moveToBE = input.bool(true, "Move Stop to Breakeven after TP1?")
// --- Compute risk unit R ---
atr = ta.atr(atrLen)
riskR = method == "ATR" ? atr * atrMult : (close * (pctStop / 100.0))
// --- Candle color (typed to avoid NA assignment issue) ---
color candleColor = na
candleColor := buySignal ? color.new(color.green, 0) :
sellSignal ? color.new(color.red, 0) :
color.na
barcolor(candleColor)
// --- Labels ---
if buySignal
label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.new(color.green, 0), textcolor=color.white, size=size.large)
if sellSignal
label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.new(color.red, 0), textcolor=color.white, size=size.large)
// --- Bias background (last signal) ---
var int bias = 0 // 1=long, -1=short
if buySignal
bias := 1
else if sellSignal
bias := -1
bgcolor(bias == 1 ? color.new(color.green, 88) : bias == -1 ? color.new(color.red, 88) : na)
// --- State & levels (explicitly typed) ---
var bool inLong = false
var bool inShort = false
var float entryPrice = na
var float longSL = na, longTP1 = na, longTP2 = na
var float shortSL = na, shortTP1 = na, shortTP2 = na
var bool longTP1Hit = false, shortTP1Hit = false
newLong = buySignal
newShort = sellSignal
// --- Long entry ---
if newLong
inLong := true
inShort := false
entryPrice := close
longTP1Hit := false
float r = method == "ATR" ? atr * atrMult : (entryPrice * (pctStop / 100.0))
longSL := entryPrice - r
longTP1 := entryPrice + tpR1 * r
longTP2 := entryPrice + tpR2 * r
// clear short levels
shortSL := na
shortTP1 := na
shortTP2 := na
shortTP1Hit := false
// --- Short entry ---
if newShort
inShort := true
inLong := false
entryPrice := close
shortTP1Hit := false
float r2 = method == "ATR" ? atr * atrMult : (entryPrice * (pctStop / 100.0))
shortSL := entryPrice + r2
shortTP1 := entryPrice - tpR1 * r2
shortTP2 := entryPrice - tpR2 * r2
// clear longs
longSL := na
longTP1 := na
longTP2 := na
longTP1Hit := false
// --- Move stop to BE after TP1 ---
if inLong and not na(longSL)
if not longTP1Hit and ta.crossover(close, longTP1)
longTP1Hit := true
if moveToBE and longTP1Hit
longSL := math.max(longSL, entryPrice)
if inShort and not na(shortSL)
if not shortTP1Hit and ta.crossunder(close, shortTP1)
shortTP1Hit := true
if moveToBE and shortTP1Hit
shortSL := math.min(shortSL, entryPrice)
// --- Exit detections ---
bool longStopHit = inLong and not na(longSL) and ta.crossunder(close, longSL)
bool longTP1HitNow = inLong and not na(longTP1) and ta.crossover(close, longTP1)
bool longTP2Hit = inLong and not na(longTP2) and ta.crossover(close, longTP2)
bool shortStopHit = inShort and not na(shortSL) and ta.crossover(close, shortSL)
bool shortTP1HitNow = inShort and not na(shortTP1) and ta.crossunder(close, shortTP1)
bool shortTP2Hit = inShort and not na(shortTP2) and ta.crossunder(close, shortTP2)
// --- Auto-flat after SL or TP2 ---
if longStopHit or longTP2Hit
inLong := false
if shortStopHit or shortTP2Hit
inShort := false
// --- Draw levels ---
plot(inLong ? longSL : na, title="Long SL", color=color.new(color.red, 0), linewidth=2, style=plot.style_linebr)
plot(inLong ? longTP1 : na, title="Long TP1", color=color.new(color.green, 0), style=plot.style_linebr)
plot(inLong ? longTP2 : na, title="Long TP2", color=color.new(color.green, 0), style=plot.style_linebr)
plot(inShort ? shortSL : na, title="Short SL", color=color.new(color.red, 0), linewidth=2, style=plot.style_linebr)
plot(inShort ? shortTP1 : na, title="Short TP1", color=color.new(color.green, 0), style=plot.style_linebr)
plot(inShort ? shortTP2 : na, title="Short TP2", color=color.new(color.green, 0), style=plot.style_linebr)
// --- Alerts ---
alertcondition(buySignal, title="BUY Signal", message="BUY: Candle green. SL/TP drawn.")
alertcondition(sellSignal, title="SELL Signal", message="SELL: Candle red. SL/TP drawn.")
alertcondition(longStopHit, title="Long STOP Hit", message="Long STOP hit.")
alertcondition(longTP1HitNow, title="Long TP1 Hit", message="Long TP1 reached.")
alertcondition(longTP2Hit, title="Long TP2 Hit", message="Long TP2 reached.")
alertcondition(shortStopHit, title="Short STOP Hit", message="Short STOP hit.")
alertcondition(shortTP1HitNow, title="Short TP1 Hit", message="Short TP1 reached.")
alertcondition(shortTP2Hit, title="Short TP2 Hit", message="Short TP2 reached.")
// --- Optional MA context ---
plot(fastMA, color=color.new(color.green, 0), title="MA 50")
plot(slowMA, color=color.new(color.red, 0), title="MA 200")
VWAP + Multi-Condition RSI Signals + FibonacciPlatform / System
Platform: TradingView
Language: Pine Script® v6
Purpose: This script is an overlay indicator for technical analysis on charts. It combines multiple tools: VWAP, RSI signals, and Fibonacci levels.
1️⃣ VWAP (Volume Weighted Average Price)
What it does:
Plots the VWAP line on the chart, which is a weighted average price based on volume.
Can be anchored to different periods: Session, Week, Month, Quarter, Year, Decade, Century, or corporate events like Earnings, Dividends, Splits.
Optionally plots bands above and below VWAP based on standard deviation or a percentage.
Supports up to 3 bands with customizable multipliers.
Will not display if the timeframe is daily or higher and the hideonDWM option is enabled.
Visual on chart: A main VWAP line with optional shaded bands.
2️⃣ RSI (Relative Strength Index) Signals
What it does:
Calculates RSI with a configurable period.
Identifies overbought and oversold zones using user-defined levels.
Generates buy/sell signals based on:
RSI crossing above oversold → Buy
RSI crossing below overbought → Sell
Detects strong signals using divergences:
Bullish divergence: Price makes lower low, RSI makes higher low → Strong Buy
Bearish divergence: Price makes higher high, RSI makes lower high → Strong Sell
Optional momentum signals when RSI crosses 50 after recent overbought/oversold conditions.
Visual on chart:
Triangles for buy/sell
Different color triangles/circles for strong and momentum signals
Background shading in RSI overbought/oversold zones
Alerts: The script can trigger alerts when any of these signals occur.
3️⃣ Fibonacci Levels
What it does:
Calculates Fibonacci retracement and extension levels based on the highest high and lowest low over a configurable lookback period.
Plots standard Fibonacci levels: 0.146, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0
Plots extension levels: 1.272, 1.618, 2.0, 2.618
Helps identify potential support/resistance zones.
Visual on chart: Horizontal lines at each Fibonacci level, shaded with different transparencies.
Summary
This script is essentially a multi-tool trading indicator that combines:
VWAP with dynamic bands for trend analysis and price positioning
RSI signals with divergences for entry/exit points
Fibonacci retracement and extension levels for support/resistance
It is interactive and visual, providing both chart overlays and alert functionality for active trading strategies.
This code is provided for training and educational purposes only. It is not financial advice and should not be used for live trading without proper testing and professional guidance.
Session VWAP & ATR H/L ZonesThis script is a comprehensive tool for day traders, designed to visualize key price levels and zones based on volume and volatility within a specific trading session.
Traders would use your script to identify potential areas of support and resistance, gauge the session's trend, and spot opportunities for mean reversion or breakout trades.
Core Concepts Explained
Your script plots three main types of information on the chart, each serving a different purpose for a trader.
1. Session VWAP (Volume-Weighted Average Price) 📈
What it is: The yellow line is the VWAP, which is the average price of an asset for the current trading session, weighted by the volume traded at each price level. It essentially shows the "fair" price for the day according to the market's activity.
How it's used:
Trend Gauge: If the price is consistently trading above the VWAP, it's generally considered a bullish intraday trend. If it's below, the trend is bearish.
Dynamic Support/Resistance: During a trend, traders often look for the price to pull back to the VWAP to find an entry point (e.g., buying a dip to the VWAP in an uptrend).
VWAP Bands: The optional gray, red, and green bands are standard deviations from the VWAP. They measure how far the price has strayed from its "fair value."
2. ATR High/Low Zones (Support & Resistance) 🎯
What they are: These are the shaded green and red areas at the top and bottom of the session's price range.
The red zone (resistance) is calculated by taking the session's current high and subtracting a value based on the Average True Range (ATR), which is a measure of recent volatility.
The green zone (support) is calculated by taking the session's current low and adding the ATR-based value.
How they're used: These are not just lines; they are zones of interest.
Profit-Taking Areas: A trader who is long might consider taking profits when the price enters the red resistance zone.
Reversal Signals: When the price enters one of these zones and shows signs of stalling (e.g., with specific candlestick patterns), it could signal a potential reversal.
3. Previous Session High & Low 📊
What they are: The script plots the high and low from the previous trading session as straight horizontal lines (teal and fuchsia by default).
How they're used: These are extremely significant static levels that many traders watch.
Price Magnets: Price is often drawn to these levels.
Key Inflection Points: A decisive break above the previous day's high can signal strong bullish momentum. Conversely, a failure to break it can indicate weakness. These levels frequently act as strong support or resistance.