CyberTrading-Inside Hunt RobotThis Pine Script strategy, titled "Cyber-Inside", is a fully automated entry and risk management system built around inside bar pierce patterns and ATR-based dynamic stops/targets. It identifies specific candle formations, calculates position sizing based on risk percentage, and visually displays risk/reward zones and trade labels on the chart.
Detailed Explanation
1. Core Logic
The script searches for inside bars — candles whose high and low are contained within the previous bar — that appear after a valid “normal” or “long” range candle.
Then it waits for a wick pierce (a candle that breaks the previous inside bar's range slightly but closes inside).
That wick pierce acts as a potential reversal or continuation signal:
wickDown → possible long entry
wickUp → possible short entry
2. ATR-based Classification
Each candle is compared to the ATR(24):
Spinning (small) → below 0.8 × ATR
Standard → between 0.8× and 1.2× ATR
Long → between 1.2× and 2.5× ATR
Huge → above 2.5× ATR
Only certain candle types (standard or long) in the previous bars qualify for pattern validation.
3. Entry Conditions
A trade signal occurs when:
The current bar forms a wick pierce of a prior inside bar pattern.
No active position exists (strategy.position_size == 0).
Then:
For longs, entry at close, stop at previous low minus ATR buffer.
For shorts, entry at close, stop at previous high plus ATR buffer.
4. Risk Management
The stop distance defines the risk per trade, and the position size is adjusted dynamically so that only the chosen riskPercent (e.g., 1%) of equity is at risk.
If useRR is enabled, a take-profit target is placed using the defined risk/reward multiple (rr, e.g. 1:3).
If disabled, the target defaults to the previous candle’s high or low.
5. Visualization
The strategy visually marks:
Entry points (triangles)
Red box = risk zone (entry → stop)
Green box = reward zone (entry → target)
Optional diagonal and horizontal lines for clarity
Labels updated after trade closes with PnL values (profit or loss)
6. Application
This system helps traders:
Automate inside-bar breakout or reversal entries
Maintain strict risk-based position sizing
Visually assess trade zones and risk/reward areas
Backtest and evaluate performance consistency on various timeframes and assets
Pine實用程式
Support & Resistance Zones + FVG**Overview:**
This tool automatically identifies **key support and resistance levels** and highlights **Fair Value Gaps (FVGs)** on the chart. It helps traders of all levels **visualize important price areas**, spot potential market reactions, and make better-informed trading decisions.
Support and resistance zones are areas where price tends to **reverse, stall, or accelerate**, making them essential for entries, exits, and stop-loss placement. Fair Value Gaps represent rapid price movements that leave temporary imbalances, which often act as **future targets or reversal points**. Together, these features provide a **comprehensive view of market structure**.
---
## Features:
1. **Automatic Support & Resistance Detection:**
* Detects zones based on recent price action patterns:
* **Bull-to-Bear transitions** → resistance zones
* **Bear-to-Bull transitions** → support zones
* Dynamically calculates **zone heights** based on recent candle ranges, adapting to market volatility.
2. **Broken Zones & Proximity Alerts:**
* Highlights zones that have been broken, helping traders **focus on relevant levels**.
* Optional proximity alerts indicate broken zones that are **near the current price**, showing potential retests.
3. **Fair Value Gaps (FVGs):**
* Detects bullish and bearish gaps automatically.
* Options to **ignore narrow gaps** and **remove fully crossed FVGs**.
* Acts as a guide for potential **price targets or reversal areas**.
4. **Clean Chart & Customization:**
* Hides overlapping or invalid zones to reduce clutter.
* Fully adjustable inputs, including:
* Zone length
* Lookback range
* Zone height multiplier
* FVG extension
* Display and opacity settings
5. **Timeframe-Independent:**
* Works on **any chart interval**, from scalping to long-term swing charts.
---
## How It Helps Traders:
* **Identify Key Levels Automatically:**
Visualizes areas where the price has historically reacted. These zones act as **natural barriers** guiding entries and exits.
* **Spot Broken Zones:**
Broken zones may lose significance but could act as **future retest points**, helping assess trend continuation or reversal.
* **Visualize Price Gaps (FVGs):**
Gaps left by rapid price movement often act as **price magnets**, providing potential targets or reversal points.
* **Reduce Noise:**
Automatically hides overlapping or invalid zones for a **cleaner, easier-to-read chart**, highlighting only the most significant levels.
* **Adaptable to Any Trading Style:**
Useful for **swing trading, intraday trading, or scalping**, showing where buyers and sellers are most active.
---
## Practical Usage Guide:
1. **Enable Support & Resistance Zones:**
* Visualize critical price levels.
* Adjust **zone length, lookback range, and height multiplier** to fit your trading style and volatility.
2. **Enable FVGs:**
* Highlights gaps created by rapid price movements.
* Customize **minimum gap size, extension, and filtering options** to reduce chart noise.
3. **Observe Price Reactions:**
* **Bounce at support:** Potential buy opportunity.
* **Reversal at resistance:** Potential sell/short opportunity.
* **Breakout:** Watch for price breaking a zone for trend continuation trades.
4. **Risk Management:**
* Place stop-loss orders just outside zones to protect trades.
* Use broken zones as **profit targets** or areas to tighten stops.
5. **Trend Analysis:**
* Understand where buyers and sellers are concentrated.
* Identify strong trends by observing multiple zones being respected or broken.
6. **Multi-Timeframe Application:**
* Apply on different timeframes to **align short-term entries with longer-term structure**, improving trade probability.
---
## Key Inputs & Customizations:
* **Support & Resistance Zones:**
* Show/Hide Zones
* Zone Length Extend (bars)
* Loopback Range (bars)
* Zone Height Multiplier
* Hide Overlapped Zones
* Hide Broken Zones
* Ignore Last N Candles for Break Check
* Show Proximity Broken Zones
* Proximity Range for Broken Zones
* **Fair Value Gaps (FVGs):**
* Show/Hide FVGs
* Extend FVGs (bars)
* Minimum FVG Size
* Ignore Narrow FVGs
* Ignore Fully Crossed FVGs
* Up and Down Colors with Opacity
---
**Summary:**
This indicator saves **time, improves chart clarity, and highlights key market levels**. It is suitable for beginners who want to **understand market structure visually**, as well as experienced traders seeking **precise entry, exit, and target zones**. By combining support/resistance detection with Fair Value Gaps, it provides a **complete visual guide to price behavior**, helping traders make **more confident and informed decisions**.
POSITION SIZER📊 POSITION SIZER - DUAL RISK MANAGEMENT (Long/Short) v5.1
🎯 WHAT IS THIS?
Professional risk management tool that automatically calculates the optimal position size for LONG and SHORT trades. Supports Forex, Stocks, Futures, Index CFDs, and Cryptocurrencies.
✨ KEY FEATURES
✅ Dual Risk Management - Independent calculations for Long and Short positions
✅ Auto/Manual Margin - Leverage control from 1x to 20x
✅ 5 Instruments - Forex, Stocks, Futures, CFDs, Crypto
✅ 2 SL Methods - Dynamic ATR or Structural (Highs/Lows)
✅ Complete Panel - 35+ real-time metrics
✅ Cost Calculation - Commission and Spread included
✅ Partial TP - Close profits at multiple points
✅ SL/TP Lines - Visual levels on chart
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ QUICK START
Open Pine Script Editor in TradingView
Create new indicator (+ → Scripts → Indicator)
Delete default code
Paste indicator code
Press Alt+Enter or Add to Chart
Panel appears automatically
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 MAIN INPUTS
1️⃣ CONFIGURATION
├─ 💰 Capital Total: Your trading capital
├─ ⚠️ Risk %: Risk per trade (recommended 0.5%-1%)
├─ 📊 Direction: Long/Short/Both
├─ 🧮 Auto Margin: Enable automatic leverage
└─ ⚡ Leverage Factor: 1x-20x multiplier
2️⃣ SL/TP STRATEGY
├─ 🛑 SL/TP Method: ATR or Structural
├─ 🎯 Risk:Reward Ratio: Example 2.0 = 1:2
├─ ATR Multiplier: If method = ATR
├─ Lookback Candles: If method = Structural
└─ SL Buffer: Extra safety distance in pips
3️⃣ COSTS (OPTIONAL)
├─ 💸 Include Commission: Add trading costs
└─ 📊 Include Spread: Add spread costs
4️⃣ INSTRUMENTS
├─ Asset Type: Forex/Stocks/Futures/CFDs/Crypto
└─ Lot Display: Micro/Mini/Standard/All (Forex only)
5️⃣ DISPLAY
├─ Show Panel: On/Off
├─ Show SL/TP Lines: On/Off
└─ Panel Position: Top/Bottom × Left/Right
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 PANEL EXPLANATION
HEADER:
🎯 Calculator - Calculation method used
- Auto/Manual/Out of Range
CONFIGURATION:
💰 Capital: Your total capital
⚠️ Risk: Money at risk per trade
📊 R:R: Risk/Reward ratio
🎲 Min. WR: Minimum win rate to break even
🏦 Max Margin: Maximum investment allowed
LONG SECTION:
🛑 SL | Price | Pips | % | Risk USD
🎯 TP | Price | Pips | % | Profit USD
💰 Nominal Value: Total investment USD
📊 Capital Used: Percentage of capital used
⚡ Leverage: Position multiplier
📦 Size: Lots/Shares/Contracts/Units
SHORT SECTION:
(Identical to LONG but inverted)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 PRACTICAL EXAMPLES
EXAMPLE 1: Forex Day Trader
─────────────────────────────
Capital: $2,000
Risk: 1% = $20 per trade
Method: ATR (2.0x, Period 14)
R:R: 2.0 (1:2)
Result:
├─ SL: 50 pips
├─ TP: 100 pips
├─ Size: 1 Micro lot
└─ Max Profit: $40 (Risk $20)
EXAMPLE 2: Stock Swing Trader
────────────────────────────
Capital: $25,000
Risk: 0.5% = $125 per trade
R:R: 3.0 (1:3)
Auto Margin: 1.5x
Result:
├─ SL: $190 (5 pips distance)
├─ TP: $210 (15 pips - 3x risk)
├─ Shares: 25 units
└─ Max Profit: $375 (Risk $125)
EXAMPLE 3: Crypto Scalper
────────────────────────
Capital: $1,000
Risk: 2% = $20 per trade
Auto Margin: 5x
Result:
├─ SL: $150 distance
├─ TP: $225 distance
├─ Units: 0.0001 BTC
└─ Max Profit: $30 (Risk $20)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
❓ FREQUENTLY ASKED QUESTIONS
Q: What does "1% Risk" mean?
A: You lose maximum 1% of capital per trade.
Capital $10,000 → Max loss $100
Q: ATR vs Structural - Which is better?
A: ATR = Based on volatility (dynamic)
Structural = Based on price levels (static)
Use ATR for volatile, Structural for ranging markets
Q: How do I enable auto leverage?
A: 1. Enable "Auto Margin Calculation"
2. Set "Leverage Factor" (1x-20x)
3. Margin calculates automatically
Q: Do costs affect SL/TP?
A: NO. Costs are informational only.
They reduce profits, not risk.
Q: Why is my position size so small?
A: Low risk %, wide SL, or small capital.
Solution: Increase risk % (carefully) or tighten SL
Q: Does it work on all timeframes?
A: YES. Better on D1, H4, H1.
Avoid very low timeframes (<5 min) due to spread
Q: What is "Min. WR"?
A: Minimum win rate to break even.
R:R 1:2 requires 33% win rate
R:R 1:3 requires 25% win rate
Q: Can I use for backtesting?
A: YES. Manually validate your strategy historically.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ TIPS & TRICKS
COMPARE SCENARIOS
├─ Try different R:R ratios
├─ Adjust leverage factors
└─ Watch how position size changes
VALIDATE YOUR STRATEGY
├─ Enter real price levels
├─ Compare theoretical vs actual
└─ Adjust based on market conditions
OPTIMIZE FOR YOUR STYLE
├─ Scalpers: Risk 2%, R:R 1:1
├─ Day Traders: Risk 1%, R:R 1:2
└─ Swing: Risk 0.5%, R:R 1:3
MONITOR COSTS
├─ Enable commission and spread
├─ See impact on profits
└─ Compare different brokers
USE AUTO MARGIN WISELY
├─ Keep safe capital aside
├─ Use 1.5x-2x only if needed
└─ Never use maximum (20x too risky)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔧 TROUBLESHOOTING
❌ Panel doesn't appear
✅ Solution: Ensure "Show Panel" = On
❌ Text too small
✅ Solution: Increase "Panel Font Size"
❌ Lines not visible
✅ Solution: Enable "Show SL/TP Lines"
❌ Position size is 0
✅ Solution: Increase capital or reduce SL distance
❌ Forex not calculating correctly
✅ Solution: Select Asset Type = "Forex"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 RECOMMENDED LEARNING
Study Position Sizing
└─ Search: "Position Sizing" on YouTube
Understand Risk:Reward
└─ Search: "Risk Reward Ratio" on Google
Practice on Demo
└─ Always demo before real account
Do Manual Backtesting
└─ Validate strategy historically
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📝 CHANGELOG
V5.1 (CURRENT)
✅ Auto Margin Calculation fix
✅ 5 instrument support
✅ Improved Cost Calculation
✅ Optimized Panel (35+ metrics)
V5.0
✅ Advanced Modularity
✅ Manual/Auto Margin Support
✅ Configurable Leverage
V4.0
✅ Complete Panel
✅ Two SL/TP Methods
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ DISCLAIMER
📌 IMPORTANT:
├─ NOT financial advice
├─ NO profit guarantee
├─ Use at your own risk
├─ ALWAYS use stop losses
├─ Practice on DEMO first
└─ Trading has risk of total loss
Author is NOT responsible for losses or gains.
Each trader is responsible for their decisions.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎉 READY TO TRADE!
With this tool you have a professional position
sizing system. Remember the basics:
DISCIPLINE - Follow your plan
RISK - Never risk more than 1% per trade
PATIENCE - Don't go all-in every trade
ANALYSIS - Validate before entering
Good luck with your trading! 📈
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📞 SUPPORT
For issues or suggestions:
Ensure you're using Pine Script v6
Check that code compiles without errors
Provide detailed problem description
Happy Trading! 🚀
MEGA_Long/Short📊 MTF Entry Signal (with L/S Labels)
A clean and compact multi-timeframe entry point indicator for TradingView. Shows clear entry signals for LONG and SHORT trades directly on the chart, with markers and letters for quick decision-making.
🎯 Key Features:
Dual timeframe analysis: Choose main and fast timeframes (default: 30m and 4h).
Entry signals:
🟢 Green triangle + "L" — LONG entry (Buy signal)
🔴 Red triangle + "S" — SHORT entry (Sell signal)
Signal only at true trend reversals – No excessive markers or noise.
Markers move dynamically with price – Always match the candlestick and chart movement.
⚙️ Signal Criteria:
LONG: EMA9 > EMA21 and MACD > 0, confirmed on both selected timeframes.
SHORT: EMA9 < EMA21 and MACD < 0, confirmed on both selected timeframes.
Entry marker appears only when signal direction changes.
🔧 Settings:
Manually select fast/main timeframes in the indicator menu (recommended: 30m + 4h).
Marker size set to minimal (size=tiny) for maximum clarity.
📈 Usage:
Designed for clean, non-overloaded charts.
Works perfectly for trend trading, reversals, and entry confirmation.
Suitable for scalping, swing trading, and crypto/futures analysis.
Kelly Wave Position Matrix 20251024 V1 ZENYOUNGA simple table is designed for use when opening a position. It applies the Kelly formula to calculate a more scientific position size based on win rate and risk–reward ratio. At the same time, it displays 1.65× ATR stop-loss levels for both long and short positions to serve as a reference for comparing with existing stop-loss placements.
Additionally, the table back-calculates the corresponding position size based on a 2% total capital loss limit, using the actual loss ratio. It also shows the current wave trend status as a pre-filtering condition.
Overall, this table integrates the core elements of trading — trend (wave confirmation), win rate, risk–reward ratio, and position sizing — making it an effective checklist before entering a trade. Its purpose is to help achieve a probabilistic edge and ensure positive expected value in trading decisions.
Wall Street Bell 🔔This will ring a bell at market open (9:30 AM EST) and close (4:00 PM EST), automatically adjusted to the user's local time zone, only on valid trading days.
✅ Automatic timezone conversion - Works in any timezone
✅ Weekdays only - No alerts on weekends
✅ Visual markers - Shows 🔔 labels on chart when bells ring
✅ Status dashboard - Shows which bells are enabled (top-right corner)
✅ Customizable - Toggle bells on/off in settings
Note: This excludes weekends automatically, but TradingView doesn't have a built-in holiday calendar for NYSE. On market holidays, you may need to manually disable the alerts for that day,
You'll need to create two separate alerts - one for the opening bell and one for the closing bell.
EURUSD vs GBPUSD — Alexio Script que muestra que par es más fuerte entre GBP y EUR vs USD en un rango determinado.
Non Repaint SystemNON REPAINT SYSTEM UNLIMITED
The ultimate non-repainting Smart Money strategy for TradingView.
Built on Liquidity Grabs + MSS (Market Structure Shift) logic to catch high-probability reversals with precision — no repainting, ever.
✅ True Non-Repaint Signals
✅ Dynamic TP/SL + Trailing Stop
✅ Liquidity Zone Visualization
✅ Multi-Timeframe Structure Filter
✅ Fully Customizable Risk Modes
✅ Built-In Backtest Dashboard
✅ Instant Alerts (Buy, Sell, TP, SL)
Perfect for Forex, Indices, Gold, and Crypto on any timeframe (5M–4H).
Includes complete visual dashboard and performance analytics.
⚠️ For educational use only. Past results do not guarantee future performance.
Name of tickerDescription:
This indicator displays the instrument’s ticker symbol and the current chart timeframe at the top center of the chart.
Features:
• Shows the ticker (e.g., BTCUSDT, AAPL, etc.).
• Displays the current timeframe (1m, 5m, 1H, 1D, etc.).
• Positioned at the top center of the chart for easy reference.
• Transparent background for minimal interference with price action.
• Lightweight and simple, no extra settings required.
Usage:
• Works with any instrument: stocks, crypto, futures.
• Useful for traders who want to always see the ticker and timeframe while analyzing the chart.
Settings:
• Text size can be adjusted in the script (text_size).
• Text and background colors can be customized (text_color, bgcolor).
Forex Dominator Pro 2.0Forex Dominator Pro 2.0 is a fully-featured, professional-grade trading indicator/script built for the forex markets (but adaptable to other asset classes). It combines advanced trend-detection algorithms, multi-timeframe analysis, and precision entry/exit signals to help traders identify high-probability trade setups, reduce noise, and streamline decision-making.
Key Features
Multi-Timeframe Trend Filter: The engine evaluates trend direction across multiple timeframes (for example 1 h, 4 h, daily) to ensure you trade with the dominant market bias rather than against it.
Momentum & Volatility Trigger System: Incorporates momentum oscillators and volatility breakout detection to generate entry signals only when strength and movement align, thereby avoiding trades during low-interest market conditions.
Automatic Entry & Exit Arrows: Visually marks potential entry points with arrows on the chart, and delineates suggested exit zones or stop-loss/take-profit levels (configurable).
Customizable Alerts: Built-in alert conditions so you can be notified (pop-up, email, webhook) when the script identifies a valid setup — enabling you to act swiftly even when not watching the chart.
Risk-Management Parameters: Allows you to define your stop-loss distance, risk per trade (e.g., 1 % of account), preferred take-profit multiples (e.g., 2× risk), and dynamically adjusts signals accordingly.
Filter by Session/Pair Type: You can restrict operation to specific trading sessions (e.g., London, New York) or exclude pairs with low liquidity/spread — minimizing false signals in sub-optimal conditions.
Built for Alerts-Driven Traders & EAs: With webhook capability, signals from Forex Dominator Pro can be fed directly into your Expert Advisor (EA) or automated system, making it ideal for EA developers (like yourself) and semi-automated systems.
Visual Dashboard & Metric Display: On-chart display of key metrics: current trend strength, volatility reading, number of valid signals in the current trend, and setup quality score — offering quick at-a-glance context.
Multi-Entry Position SizerMulti-Entry Position Sizer (with Risk, Margin & Tables)
This tool is designed for traders who manage multiple staggered entries (scaling in) with fixed risk allocation. It calculates position sizes, margin requirements, and liquidation levels for up to 5 custom entry points, based on a defined stop loss and wallet risk.
🔧 Features
Entry Management
Supports up to 5 entries.
Use 0 to ignore an entry, -1 to auto-use current price.
Valid entries are drawn as colored dashed lines.
Invalid entries (e.g., entry on wrong side of stop loss) are flagged with red dotted lines and labels.
Risk Control
Risk defined in Direct USDT or % of wallet size.
Risk automatically split across all valid entries.
Per-entry quantity and margin calculated dynamically.
Visualization
Stop loss line in red.
Liquidation levels drawn as faded dotted lines.
Entry labels show price and required margin in USDT.
Summary table (top-right) with symbol, side, risk, SL, leverage.
Entries table (bottom-right) listing each valid entry with:
Price
Quantity
Margin in USDT
Risk/entry in USDT
Liquidation level
Alerts
Alerts trigger when price touches a valid entry.
Separate alert for stop loss hit.
📊 How to Use
Select Side (Long or Short).
Enter your Wallet Size, Risk Parameters, and Leverage.
Define your Stop Loss Price.
Configure up to 5 Entry Points.
0 = disabled
-1 = current market price
Any positive value = custom entry price
Watch tables and chart update automatically:
Invalid entries turn red (ignored in sizing).
Valid entries show correct margin and liquidation prices.
✅ Who Is It For?
Traders who scale in with multiple orders.
Traders who want precise risk per trade.
Anyone who needs to see margin requirements and liquidation prices before placing orders.
⚠️ Disclaimer:
This script is for educational purposes. It does not place orders automatically and should not be considered financial advice. Always double-check calculations with your exchange before trading.
Major Trading Sessions IndicatorsThis indicator displays vertical lines on your chart to mark the opening times of the major global trading sessions (Tokyo, Shanghai/HK, London, and New York). As a crypto trader I want to find price action patterns after sessions open.
It's fully customizable and extendable (you could add closing time for sessions as well)
Works best on short timeframes.
Features:
6 configurable vertical lines (4 preset for major sessions + 2 custom)
Each line shows a customizable label (e.g., "Tokyo", "London")
Individual time and color settings for each line
UTC offset for each line to handle Daylight Saving Time
Option to fix all labels at a specific price level for cleaner appearance (need to set and save it for each chart, it becomes a mess if you don't). Default behavior and limit of Pine Script is that it will be attached to the price wick.
Default Sessions:
Tokyo: 00:00 UTC (midnight)
Shanghai/HK: 01:30 UTC
London: 08:00 UTC (winter) - adjust offset to +1 for summer
New York: 13:00 UTC (winter) - adjust offset to -4 for summer
DST Adjustments:
Simply change the UTC offset when daylight saving time begins/ends:
London: 0 (winter) or +1 (summer)
New York: -5 (winter) or -4 (summer)
Lines extend from top to bottom of the chart and appear precisely when each session opens.
My preferred configuration: shorten names and reduce opacity of colors to 20-30%.
Realtime RenkoI've been working on real-time renko for a while as a coding challenge. The interesting problem here is building renko bricks that form based on incoming tick data rather than waiting for bar closes. Every tick that comes through gets processed immediately, and when price moves enough to complete a brick, that brick closes and a new one opens right then. It's just neat because you can run it and it updates as you'd expect with renko, forming bricks based purely on price movement happening in real time rather than waiting for arbitrary time intervals to pass.
The three brick sizing methods give you flexibility in how you define "enough movement" to form a new brick. Traditional renko uses a fixed price range, so if you set it to 10 ticks, every brick represents exactly 10 ticks of movement. This works well for instruments with stable tick sizes and predictable volatility. ATR-based sizing calculates the average true range once at startup using a weighted average across all historical bars, then divides that by your brick value input. If you want bricks that are one full ATR in size, you'd use a brick value of 1. If you want half-ATR bricks, use 2. This inverted relationship exists because the calculation is ATR divided by your input, which lets you work with multiples and fractions intuitively. Percentage-based sizing makes each brick a fixed percentage move from the previous brick's close, which automatically scales with price level and works well for instruments that move proportionally rather than in absolute tick increments.
The best part about this implementation is how it uses varip for state management. When you first load the indicator, there's no history at all. Everything starts fresh from the moment you add it to your chart because varip variables only exist in real-time. This means you're watching actual renko bricks form from real tick data as it arrives. The indicator builds its own internal history as it runs, storing up to 250 completed bricks in memory, but that history only exists for the current session. Refresh the page or reload the indicator and it starts over from scratch.
The visual implementation uses boxes for brick bodies and lines for wicks, drawn at offset bar indices to create the appearance of a continuous renko chart in the indicator pane. Each brick occupies two bar index positions horizontally, which spaces them out and makes the chart readable. The current brick updates in real time as new ticks arrive, with its high, low, and close values adjusting continuously until it reaches the threshold to close and become finalized. Once a brick closes, it gets pushed into the history array and a new brick opens at the closing level of the previous one.
What makes this especially useful for debugging and analysis are the hover tooltips on each brick. Clicking on any brick brings up information showing when it opened with millisecond precision, how long it took to form from open to close, its internal bar index within the renko sequence, and the brick size being used. That time delta measurement is particularly valuable because it reveals the pace of price movement. A brick that forms in five seconds indicates very different market conditions than one that takes three minutes, even though both bricks represent the same amount of price movement. You can spot acceleration and deceleration in trend development by watching how quickly consecutive bricks form.
The pine logs that generate when bricks close serve as breadcrumbs back to the main chart. Every time a brick finalizes, the indicator writes a log entry with the same information shown in the tooltip. You can click that log entry and TradingView jumps your main chart to the exact timestamp when that brick closed. This lets you correlate renko brick formation with what was happening on the time-based chart, which is critical for understanding context. A brick that closed during a major news announcement or at a key support level tells a different story than one that closed during quiet drift, and the logs make it trivial to investigate those situations.
The internal bar indexing system maintains a separate count from the chart's bar_index, giving each renko brick its own sequential number starting from when the indicator begins running. This makes it easy to reference specific bricks in your analysis or when discussing patterns with others. The internal index increments only when a brick closes, so it's a pure measure of how many bricks have formed regardless of how much chart time has passed. You can match these indices between the visual bricks and the log entries, which helps when you're trying to track down the details of a specific brick that caught your attention.
Brick overshoot handling ensures that when price blows through the threshold level instead of just barely touching it, the brick closes at the threshold and the excess movement carries over to the next brick. This prevents gaps in the renko sequence and maintains the integrity of the brick sizing. If price shoots up through your bullish threshold and keeps going, the current brick closes at exactly the threshold level and the new brick opens there with the overshoot already baked into its initial high. Without this logic, you'd get renko bricks with irregular sizes whenever price moved aggressively, which would undermine the whole point of using fixed-range bricks.
The timezone setting lets you adjust timestamps to your local time or whatever reference you prefer, which matters when you're analyzing logs or comparing brick formation times across different sessions. The time delta formatter converts raw milliseconds into human-readable strings showing days, hours, minutes, and seconds with fractional precision. This makes it immediately clear whether a brick took 12.3 seconds or 2 minutes and 15 seconds to form, without having to parse millisecond values mentally.
This is the script version that will eventually be integrated into my real-time candles library. The library version had an issue with tooltips not displaying correctly, which this implementation fixes by using a different approach to label creation and positioning. Running it as a standalone indicator also gives you more control over the visual settings and makes it easier to experiment with different brick sizing methods without affecting other tools that might be using the library version.
What this really demonstrates is that real-time indicators in Pine Script require thinking about state management and tick processing differently than historical indicators. Most indicator code assumes bars are immutable once closed, so you can reference `close ` and know that value will never change. Real-time renko throws that assumption out because the current brick is constantly mutating with every tick until it closes. Using varip for state variables and carefully tracking what belongs to finalized bricks versus the developing brick makes it possible to maintain consistency while still updating smoothly in real-time. The fact that there's no historical reconstruction and everything starts fresh when you load it is actually a feature, not a limitation, because you're seeing genuine real-time brick formation rather than some approximation of what might have happened in the past.
[PDR] Daily Rebalance█ OVERVIEW
This indicator is a powerful portfolio backtesting tool designed to simulate the performance of a static-weight, daily rebalancing strategy. It allows you to define a portfolio of up to 10 assets, set their target weights, and track its cumulative return against a user-defined benchmark and a risk-free rate.
The core of the script is its daily rebalancing logic, which calculates and logs every trade needed to bring the portfolio back to its target allocations at the close of each day. This provides a transparent and detailed view of how a static portfolio would have performed historically, including the impact of trading costs.
█ KEY FEATURES
Daily Rebalancing: Simulates a portfolio that is rebalanced at the close of every day to maintain target asset allocations.
Customizable Portfolio: Configure up to 10 different assets with specific weights. If all weights are left at 0, the script automatically creates an equal-weight portfolio from the selected assets.
Performance Comparison: Plots the portfolio's equity curve against a user-defined benchmark (e.g., SET:SET50 ) and a risk-free return, allowing for easy relative performance analysis.
Realistic Simulation: Accounts for trading costs like broker commission and minimum lot sizes for more accurate and grounded backtesting results.
Detailed Performance Metrics: An on-chart table displays real-time statistics, including Current Drawdown, Max Drawdown, and Total Return for both your portfolio and the benchmark.
Trade-by-Trade Logs: For full transparency, every rebalancing trade (BUY/SELL), including shares, price, notional value, and fees, is logged in the Pine Logs panel.
█ HOW TO USE
**Apply to a Daily Chart:** This script is designed to work exclusively on the daily ( 1D ) timeframe. Applying it to any other timeframe will result in a runtime error.
**Configure Settings:** Open the indicator's settings. Set your `Initial Capital`, `Start Time`, and the `Benchmark` symbol you wish to compare against.
**Define Your Assets:** In the 'Assets' group, check the box to enable each asset you want to include, select the symbol, and define its target `Weight (%)`.
**Set Trading Costs:** Adjust the `Broker Commission (%)` and `Minimal Buyable Lot` to match your expected trading conditions.
**Analyze the Results:** The performance curves are plotted in the indicator pane below your main chart. The key metrics table is displayed on the bottom-right of your chart.
**View Rebalancing Trades:** This is a crucial step for understanding the simulation. To see the detailed daily trades, you **must** open the **Pine Logs**. You can find this panel at the bottom of your TradingView window, next to the "Pine Editor" and "Strategy Tester" tabs. The logs provide a complete breakdown of every rebalancing action.
█ DISCLAIMER
This is a backtesting and simulation tool, not a trading signal generator. Its purpose is for research and performance analysis. Past performance is not indicative of future results. Always conduct your own research before making any investment decisions.
Material Color Palette Library█ OVERVIEW
Unlock a world of color in your Pine Script® projects with the Material Color Palette Library . This library provides a comprehensive and structured color system based on Google's Material Design palette, making it incredibly easy to create visually appealing and professional-looking indicators and strategies.
Forget about guessing hex codes. With this library, you have access to 19 distinct color families, each offering a wide range of shades. Every color can be fine-tuned with saturation, darkness, and opacity levels, giving you precise control over your script's appearance.
To make development even easier, the library includes a visual cheatsheet. Simply add the script to your chart to display a full table of all available colors and their corresponding parameters.
█ KEY FEATURES
Vast Spectrum: 19 distinct color families, from vibrant reds and blues to subtle greys and browns.
Fine-Tuned Control: Each color function accepts parameters for `saturationLevel` (1-13 or 1-9) and `darkLevel` (1-3) to select the perfect shade.
Opacity Parameter: Easily add transparency to any color for fills, backgrounds, or lines.
Quick Access Tones: A simple `tone()` function to grab base colors by name.
Visual Cheatsheet: An on-chart table displays the entire color palette, serving as a handy reference guide during development.
█ HOW TO USE
As a library, this script is meant to be imported into your own indicators or strategies.
1. Import the Library
Add the following line to the top of your script. Remember to replace `YourUsername` with your TradingView username.
import mastertop/ColorPalette/1 as colors
2. Call a Color Function
You can now use any of the exported functions to set colors for your plots, backgrounds, tables, and more.
The primary functions take three arguments: `functionName(saturationLevel, darkLevel, opacity)`
`saturationLevel`: An integer that controls the intensity of the color. Ranges from 1 (lightest) to 13 (most vibrant) for most colors, and 1-9 for `brown`, `grey`, and `blueGrey`.
`darkLevel`: An integer from 1 to 3 (1: light, 2: medium, 3: dark).
`opacity`: An integer from 0 (opaque) to 100 (invisible).
Example Usage:
Let's plot a moving average with a specific shade of teal.
// Import the library
import mastertop/ColorPalette/1 as colors
indicator("My Script with Custom Colors", overlay = true)
// Calculate a moving average
ma = ta.sma(close, 20)
// Plot the MA using a color from the library
// We'll use teal with saturation level 7, dark level 2, and 0% opacity
plot(ma, "MA", color = colors.teal(7, 2, 0), linewidth = 2)
3. Using the `tone()` Function
For quick access to a base color, you can use the `tone()` function.
// Set a red background with 85% transparency
bgcolor(colors.tone('red', 85))
█ VISUAL REFERENCE
To see all available colors at a glance, you can add this library script directly to your chart. It will display a comprehensive table showing every color variant. This makes it easy to pick the exact shade you need without guesswork.
This library is designed for fellow Pine Script® developers to streamline their workflow and enhance the visual quality of their scripts. Enjoy!
Blick Trades Position Size CalculatorThe Blick Trades Position Size indicator is a comprehensive Position Size Calculator designed for futures traders on TradingView. It automatically detects the asset type (Gold, Nasdaq, or ES futures - both regular and micro contracts) and calculates the optimal number of contracts to trade based on your risk amount and stop loss price.
The indicator features a "Maximize Risk" option that intelligently switches between regular and micro contracts to get as close as possible to your target risk amount, plus support for limit orders with custom entry prices. It displays visual elements on the chart including entry and stop loss lines with live risk calculations, and uses an asset-specific display system so you can control which charts show the indicator (preventing parameter confusion when switching between different futures contracts).
The calculator handles all the complex math automatically - just input your risk amount and stop loss, and it tells you exactly how many contracts to trade while showing your precise dollar risk in real-time.
N Order EMAThe exponential moving average is one of the most fundamental tools in technical analysis, but its implementation is almost always locked to a single mathematical approach. I've always wanted to extend the EMA into an n-order filter, and after some time working through the digital signal processing mathematics, I finally managed to do it. This indicator takes the familiar EMA concept and opens it up to four different discretization methods, each representing a valid way to transform a continuous-time exponential smoother into a discrete-time recursive filter. On top of that, it includes adjustable filter order, which fundamentally changes the frequency response characteristics in ways that simply changing the period length cannot achieve.
The four discretization styles are impulse-matched, all-pole, matched z-transform, and bilinear (Tustin). The all-pole version is exactly like stacking multiple EMAs together but implemented in a single function with proper coefficient calculation. It uses a canonical form where you get one gain coefficient and the rest are zeros, with the feedback coefficients derived from the binomial expansion of the pole polynomial. The other three methods are attempts at making generalizations of the EMA in different ways. Impulse-matched creates the filter by matching the discrete-time impulse response to what the continuous EMA would produce. Matched z-transform directly maps the continuous poles to the z-domain using the exponential relationship. Bilinear uses the Tustin transformation with frequency prewarping to ensure the cutoff frequency is preserved despite the inherent warping of the mapping.
Honestly, they're all mostly the same in practice, which is exactly what you'd expect since they're all valid discretizations of the same underlying filter. The differences show up in subtle ways during volatile market conditions or in the exact phase characteristics, but for most trading applications the outputs will track each other closely. That said, the bilinear version works particularly well at low periods like 2, where other methods can sometimes produce numerical artifacts. I personally like the z-match for its clean frequency-domain properties, but the real point here is demonstrating that you can tackle the same problem from multiple mathematical angles and end up with slightly different but equally valid implementations.
The order parameter is where things get interesting. A first-order EMA is the standard single-pole recursive filter everyone knows. When you move to second-order, you're essentially cascading two filter sections, which steepens the roll-off in the frequency domain and changes how the filter responds to sudden price movements. Higher orders continue this progression. The all-pole style makes this particularly clear since it's literally stacking EMA operations, but all four discretization methods support arbitrary order. This gives you control over the aggressiveness of the smoothing that goes beyond just adjusting the period length.
On top of the core EMA calculation, I've included all the standard variants that people use for reducing lag. DEMA applies the EMA twice and combines the results to get faster response. TEMA takes it further with three applications. HEMA uses a Hull-style calculation with fractional periods, applying the EMA to the difference between a half-period EMA and a full-period EMA, then smoothing that result with the square root of the period. These are all implemented using whichever discretization method you select, so you're not mixing different mathematical approaches. Everything stays consistent within the chosen framework.
The practical upside of this indicator is flexibility for people building trading systems. If you need a moving average with specific frequency response characteristics, you can tune the order parameter instead of hunting for the right period length. If you want to test whether different discretization methods affect your strategy's performance, you can swap between them without changing any other code. For most users, the impulse-matched style at order 1 will behave almost identically to a standard EMA, which gives you a familiar baseline to work from. From there you can experiment with higher orders or different styles to see if they provide any edge in your particular market or timeframe.
What this really highlights is that even something as seemingly simple as an exponential moving average involves mathematical choices that usually stay hidden. The standard EMA formula you see in textbooks is already a discretized version of a continuous exponential decay, and there are multiple valid ways to perform that discretization. By exposing these options, this indicator lets you explore a parameter space that most traders never even know exists. Whether that exploration leads to better trading results is an empirical question that depends on your strategy and market, but at minimum it's a useful reminder that the tools we take for granted are built on arbitrary but reasonable mathematical decisions.
NY Session Range Box with Labeled Time MarkersShows opening time ny session by timing with lines to inform traders to avoid 11:30am to 1:30pm for choppy sessions and mark early and power hour .
Moving Average Trend Strategy V4.1 — Revised Version (Selectable✅ **Version Notes (V4.0)**
| Feature | Description |
| --------------------------------------- | -------------------------------------------------------- |
| 🧠 **Moving Average Type Options** | Choose from EMA / SMA / HMA / WMA |
| 🧱 **Take-Profit / Stop-Loss Switches** | Can be enabled or disabled independently |
| ⚙️ **Add Position Function** | Can be enabled or disabled independently |
| 🔁 **Add Position Signal Source** | Selectable between MA Crossover / MACD / RCI / RSI |
| 💹 **Adjustable Parameters** | All periods and percentages are customizable in settings |
---
✅ **Update Summary:**
| Function | Description |
| -------------------------------------- | --------------------------------------------------------------------- |
| **MA Type Selection** | Choose EMA / SMA / HMA / WMA in chart settings |
| **Take-Profit / Stop-Loss Percentage** | Configurable in the “Take-Profit & Stop-Loss” group |
| **Add / Reduce Position Percentage** | Adjustable separately in the “Add/Reduce Position” group |
| **MA Periods** | Customizable in the “Moving Average Parameters” section |
| **Code Structure** | Logic unchanged — only parameterization and selection functions added |
---
### **Strategy Recommendations:**
* **Trending Market:** Prefer EMA trend tracking or SAR indicators
* **Range-Bound Market:** Use ATR-based volatility stop-loss
* **Before Major Events:** Consider option hedging
* **Algorithmic Trading:** Recommend ATR + partial take-profit combination strategy
---
### **Key Parameter Optimization Logic:**
* Backtest different **ATR multipliers** (2–3× ATR)
* Test **EMA periods** (10–50 periods)
* Optimize **partial take-profit ratios**
* Adjust **maximum drawdown tolerance** (typically 30–50% of profit)
---
### **Risk Control Tips:**
* Avoid overly tight stop-losses that trigger too frequently
* During strong trends, consider widening take-profit targets
* Confirm trend continuation with **volume analysis**
* Adjust parameters based on **timeframe** (e.g., Daily vs Hourly)
---
### **Practical Example (Forex: EUR/USD):**
* **Entry:** Go long on breakout above 1.1200
* **Initial Stop-Loss:** 1.1150 (50 pips)
* **When profit reaches 1.1300:**
* Close 50% of position
* Move stop-loss to 1.1250 (lock in 50 pips profit)
* **When price rises to 1.1350:**
* Move stop-loss to 1.1300 (lock in 100 pips profit)
* **Final Outcome:**
* Price retraces to 1.1300, triggering take-profit
This method secured over **80% of trend profits** during the 2023 EUR rebound, capturing **23% more profit** compared to fixed take-profit strategies (based on backtest results).
USDJPY MA Zone Entry Strategy USD/JPY tested only.A consistent strategy that gives me alerts each time my conditions are met. I am a funded prop firm trader. this strategy gives 45-70% annual returns. the sequence for this strategy is: After 4 stop loss hits, place a trade on the NEXT ENTRY ALERT ONCE: (-.188) pips draw back towards the stop loss. (this turns the Strat from 1-3 RISK/REWARD to 1-7+ RISK/REWARD). keep the Stop Loss the same (-.300) away from your entry. Take Profit placed at (+1.488) from entry. if 3 losses in a row happens AFTER you've followed these instructions, don't trade again UNTIL the strategy has a TAKE PROFIT gain, then the sequence starts over again. that is this strategies losing streak. after that streak is over. the strategy will be back to give you profits.
Colocar Ordens Fácil!This eases the process of creating limit orders on Trading View, when using the smarphone.
For that, the user inputs the given price range, the desired fibonacci entry level, and trade direction. The tools gives visual snap-to objects that can be used to lock long/short position tools, from which the option "create limit order" can be used to directly create the orders.






















