User-Defined Volume Average ComparisonThe User-Defined Volume Average Comparison indicator empowers traders to analyze volume trends by comparing short-term and long-term volume moving averages. With customizable periods, visual cues, and built-in alerts, it’s a versatile tool for identifying volume-driven market shifts across any timeframe, ideal for stocks, forex, crypto, and more.Key Features: Customizable Periods: Set short and long periods (in bars) to match your trading strategy.
Conditional Highlighting:
Green Background: Short-period volume average ≥ long-period volume average, signaling strong short-term volume.
Red Background: Short-period volume average < long-period volume average / 2, indicating low short-term volume.
Optional Labels: Toggle labels to display conditions on the chart (default: off).
Alerts: Receive notifications for key conditions: “Short ≥ Long Alert” for high volume periods.
“Short < Long/2 Alert” for low volume periods.
Visualized Averages: Plots short-period (blue) and long-period (red) volume moving averages for easy analysis.
How It Works:
The indicator calculates the simple moving average (SMA) of volume over user-defined short and long periods, then compares them: A green background and alert trigger when the short-period average meets or exceeds the long-period average, suggesting increased volume activity.
A red background and alert trigger when the short-period average falls below half of the long-period average, indicating reduced volume.
Labels (if enabled) display “Short ≥ Long” or “Short < Long/2” for clarity.
Settings: Short Period (Bars): Number of bars for the short-term volume average (default: 3).
Long Period (Bars): Number of bars for the long-term volume average (default: 50).
Show Labels: Enable or disable condition labels (default: off).
Use Cases: Trend Confirmation: Use green alerts to confirm high volume during breakouts or trend continuations.
Divergence Detection: Identify low volume periods with red alerts to spot potential reversals or weak trends.
Multi-Timeframe Analysis: Apply on any timeframe (e.g., 4H, 1D), with periods based on bars (e.g., 3 bars on 4H = 12 hours).
Notes: Periods are based on the chart’s timeframe (bars). For shorter timeframes, consider increasing period values for more significant results.
Set alerts to “Once Per Bar Close” for reliable notifications.
Combine with price-based indicators to enhance trading decisions.
Why Use This Indicator?
This indicator offers a flexible, alert-driven approach to volume analysis, helping traders of all levels make informed decisions. Its intuitive design and customizable settings make it a valuable addition to any trading setup.
Göstergeler ve stratejiler
CCI Trading SystemCCI Trading System with Signal Bar Coloring
Overview
This indicator combines the classic Commodity Channel Index (CCI) oscillator with visual signal detection and bar coloring to help traders identify potential momentum shifts and trading opportunities.
Features
CCI Oscillator Display: Shows CCI values in a separate pane with customizable period length
Adjustable Thresholds: User-defined buy and sell levels (default: -100 buy, +100 sell)
Visual Signal Detection: Triangle markers indicate crossover points
Bar Coloring: Highlights only the bars where actual buy/sell signals occur
Zone Highlighting: Background colors show overbought/oversold conditions
Real-time Information Table: Displays current CCI value, thresholds, and signal status
Built-in Alerts: Notification system for signal generation
How It Works
The indicator generates signals based on CCI threshold crossovers:
Buy Signal: Triggered when CCI crosses above the buy threshold (lime bar coloring)
Sell Signal: Triggered when CCI crosses below the sell threshold (red bar coloring)
Input Parameters
CCI Length: Period for CCI calculation (default: 20)
Buy Threshold: Level for buy signal generation (default: -100)
Sell Threshold: Level for sell signal generation (default: +100)
Enable Bar Coloring: Toggle for chart bar coloring
Show Signals: Toggle for signal markers
Usage Guidelines
Adjust thresholds based on your trading timeframe and volatility preferences
Use in conjunction with other technical analysis tools for confirmation
Consider market context and trend direction when interpreting signals
The -200/+200 levels serve as additional reference points for extreme conditions
Educational Purpose
This indicator is designed for educational and analysis purposes. It demonstrates how CCI can be used to identify potential momentum shifts in price action. The visual elements help traders understand the relationship between CCI values and price movements.
Risk Disclaimer
This indicator is a technical analysis tool and does not guarantee profitable trades. Past performance does not indicate future results. Always conduct your own analysis and consider risk management principles. Trading involves substantial risk of loss and is not suitable for all investors.
Technical Notes
Uses Pine Script v5
Plots CCI with standard deviation-based calculation
Includes crossover/crossunder functions for signal generation
Features conditional bar coloring for signal visualization
Incorporates alert conditions for automated notifications
This script is open source and available for modification and educational use.
3Commas DCA Long Short3Commas DCA Long/Short Manager – SuperTrend-Powered
This script turns TradingView SuperTrend signals into fully-automated 3Commas actions. On each confirmed bar-close trend flip it:
• Starts the chosen Long or Short DCA bot
• Closes & stops the opposite bot to keep only one side running
Key features
• SuperTrend core – ATR Length & Factor are user-tunable
• Dual-bot control – independent IDs for Long and Short bots, each can be toggled on/off
• Safety first – ignores the very first bar to avoid repaint artefacts
• Email/webhook ready – alerts output compact JSON compatible with 3Commas; optional delay seconds parameter included
• One-click deployment – drop on any chart, set an “Any alert() function call” alert, paste your 3Commas email address / webhook, and trade hands-free.
Back-test thoroughly and use paper trading before going live. Happy automating!
YTPBTC1HATRSSADXTitle:
High-Precision Breakout ATR Trailing Strategy with ADX Filtering for BTC 1H
Description:
YTPBTC1HATRSSADX is a precision-engineered 1-hour BTC breakout strategy utilizing adaptive ATR-based stop systems and optional ADX filtering to enhance trade quality and dynamic risk management. The system enters positions upon confirmed breakouts above/below N-period highs/lows, while aligning with trend conditions determined by a long-term RMA filter.
Key features:
✅ Adaptive ATR stop management with dual-phase logic: initial stop placement followed by dynamic trailing after reaching profit thresholds.
✅ Optional ADX filtering to confirm directional strength before entry, reducing false signals during choppy markets.
✅ Dynamic pullback-based take-profit system, locking in profits during high volatility conditions without sacrificing upside potential.
✅ Clear on-chart visualization of entry levels, ATR stops, breakout levels, and trend background color for intuitive monitoring.
✅ Fully parameterized for ATR period, multiplier, breakout period, RMA trend period, ADX threshold, and pullback settings to adjust according to market conditions.
This strategy is designed for traders seeking robust trend-following breakout entries while systematically managing risk with ATR and maximizing profit potential through trailing and pullback exit logic. Ideal for BTC perpetual futures and margin trading environments requiring disciplined execution.
Test on BTCUSDTPERP 1H to explore its consistency across different volatility regimes, and adjust parameters to align with your risk appetite and capital allocation strategies.
CipherMatrix Dashboard (MarketCipher B)Pre-compute MarketCipher-B values for each fixed timeframe (5 m, 15 m, 30 m, 60 m, 4 H, Daily).
Pass those values into plotRow() instead of calling request.security() inside the helper—removes the style warning.
Added explicit range parameters to table.clear(dash, 0, 0, 2, 6) to satisfy v6’s argument requirement.
This version should compile without the previous warnings/errors. Swap in your real MarketCipher-B histogram when you’re ready, and the dashboard is good to go!
CipherMatrix Dashboard (MarketCipher B)does it work. A lightweight, multi-time-frame overlay that turns MarketCipher B data into an at-a-glance dashboard:
Time-frames shown: current chart TF first, then 5 m, 15 m, 30 m, 1 H, 4 H, Daily.
Bias icons:
🌙 = bullish (MCB > 0)
🩸 = bearish (MCB < 0)
Signal icons:
⬆️ = histogram crosses above 0 (potential long)
⬇️ = histogram crosses below 0 (potential short)
Table location: bottom-right of chart; updates on every confirmed bar.
EVaR Indicator and Position SizingThe Problem:
Financial markets consistently show "fat-tailed" distributions where extreme events occur with higher frequency than predicted by normal distributions (Gaussian or even log-normal). These fat tails manifest in sudden price crashes, volatility spikes, and black swan events that traditional risk measures like volatility can underestimate. Standard deviation and conventional VaR calculations assume normally distributed returns, leaving traders vulnerable to severe drawdowns during market stress.
Cryptocurrencies and volatile instruments display particularly pronounced fat-tailed behavior, with extreme moves occurring 5-10 times more frequently than normal distribution models would predict. This reality demands a more sophisticated approach to risk measurement and position sizing.
The Solution: Entropic Value at Risk (EVAR)
EVaR addresses these limitations by incorporating principles from statistical mechanics and information theory through Tsallis entropy. This advanced approach captures the non-linear dependencies and power-law distributions characteristic of real financial markets.
Entropy is more adaptive than standard deviations and volatility measures.
I was inspired to create this indicator after reading the paper " The End of Mean-Variance? Tsallis Entropy Revolutionises Portfolio Optimisation in Cryptocurrencies " by by Sana Gaied Chortane and Kamel Naoui.
Key advantages of EVAR over traditional risk measures:
Superior tail risk capture: More accurately quantifies the probability of extreme market moves
Adaptability to market regimes: Self-calibrates to changing volatility environments
Non-parametric flexibility: Makes less assumptions about the underlying return distribution
Forward-looking risk assessment: Better anticipates potential market changes (just look at the charts :)
Mathematically, EVAR is defined as:
EVAR_α(X) = inf_{z>0} {z * log(1/α * M_X(1/z))}
Where the moment-generating function is calculated using q-exponentials rather than conventional exponentials, allowing precise modeling of fat-tailed behavior.
Technical Implementation
This indicator implements EVAR through a q-exponential approach from Tsallis statistics:
Returns Calculation: Price returns are calculated over the lookback period
Moment Generating Function: Approximated using q-exponentials to account for fat tails
EVAR Computation: Derived from the MGF and confidence parameter
Normalization: Scaled to for intuitive visualization
Position Sizing: Inversely modulated based on normalized EVAR
The q-parameter controls tail sensitivity—higher values (1.5-2.0) increase the weighting of extreme events in the calculation, making the model more conservative during potentially turbulent conditions.
Indicator Components
1. EVAR Risk Visualization
Dynamic EVAR Plot: Color-coded from red to green normalized risk measurement (0-1)
Risk Thresholds: Reference lines at 0.3, 0.5, and 0.7 delineating risk zones
2. Position Sizing Matrix
Risk Assessment: Current risk level and raw EVAR value
Position Recommendations: Percentage allocation, dollar value, and quantity
Stop Parameters: Mathematically derived stop price with percentage distance
Drawdown Projection: Maximum theoretical loss if stop is triggered
Interpretation and Application
The normalized EVAR reading provides a probabilistic risk assessment:
< 0.3: Low risk environment with minimal tail concerns
0.3-0.5: Moderate risk with standard tail behavior
0.5-0.7: Elevated risk with increased probability of significant moves
> 0.7: High risk environment with substantial tail risk present
Position sizing is automatically calculated using an inverse relationship to EVAR, contracting during high-risk periods and expanding during low-risk conditions. This is a counter-cyclical approach that ensures consistent risk exposure across varying market regimes, especially when the market is hyped or overheated.
Parameter Optimization
For optimal risk assessment across market conditions:
Lookback Period: Determines the historical window for risk calculation
Q Parameter: Controls tail sensitivity (higher values increase conservatism)
Confidence Level: Sets the statistical threshold for risk assessment
For cryptocurrencies and highly volatile instruments, a q-parameter between 1.5-2.0 typically provides the most accurate risk assessment because it helps capturing the fat-tailed behavior characteristic of these markets. You can also increase the q-parameter for more conservative approaches.
Practical Applications
Adaptive Risk Management: Quantify and respond to changing tail risk conditions
Volatility-Normalized Positioning: Maintain consistent exposure across market regimes
Black Swan Detection: Early identification of potential extreme market conditions
Portfolio Construction: Apply consistent risk-based sizing across diverse instruments
This indicator is my own approach to entropy-based risk measures as an alterative to volatility and standard deviations and it helps with fat-tailed markets.
Enjoy!
AV BTC Investor ToolThe Investor Tool
Created by Philip Swift . Intended to be used by long term investors . The tool uses two simple moving averages of price as the basis for under/overvalued conditions: the 2-year MA (green) and a 5x multiple of the 2-year MA (red).
Price below the 2-year average: often means good profits and a bear market bottom .
Price above the 5x average: usually shows a bull market top , so investors may want to be cautious.
Custom MTF DBoardSimple MTF Dboard to use with other indicators as a confluence.
Uses LuxAlgo's SMC concepts to show PA's trend direction- the idea is , if the trends dont align fully, dont take the trade. Or if one of the timeframes are different, maybe its time to get out of a trade cus its gonna reverse into your face?
Try it Lemme know lol
FULLY FUNCTIONAL INDICATOR TESTER🎯 Purpose:
A comprehensive strategy testing framework designed to evaluate custom indicators and trading signals with professional-grade risk management and signal detection capabilities.
✨ Key Features:
Multiple Signal Detection Methods - Value changes, crossovers, threshold-based triggers
Advanced Confluence Filtering - Multi-source confirmation system with lookback periods
Professional Risk Management - Static TP/SL, break-even functionality, position sizing
Custom Exit Signals - Independent exit logic for refined strategy testing
Visual Feedback System - Clear signal plots and real-time status monitoring
Flexible Input Sources - Connect any custom indicator or built-in study
🔧 How to Use:
Connect your indicator outputs to the Entry/Exit source inputs
Select appropriate signal detection method for your indicator type
Configure risk parameters (TP/SL/Break-even)
Enable confluence filters if needed for additional confirmation
Backtest and analyze results with built-in performance metrics
📈 Signal Detection Options:
Value Change: Detects when indicator values change
Crossover Above/Below: Traditional crossover signals
Threshold Triggers: Value-based entry/exit levels
⚙️ Technical Specifications:
Compatible with Pine Script v6
Overlay strategy with position tracking
Real-time performance monitoring table
Configurable margin requirements
Full backtesting compatibility
⚠️ Important Notes:
This is a testing framework - not financial advice
Always validate signals in demo environment first
Past performance does not guarantee future results
Use proper risk management in live trading
🔄 Updates:
Enhanced signal detection algorithms
Improved confluence logic
Added break-even functionality
Visual debugging tools
Perfect for traders and developers looking to systematically tes
ArraysAssorted🟩 OVERVIEW
This library provides utility methods for working with arrays in Pine Script. The first method finds extreme values (highest/lowest) within a rolling lookback window and returns both the value and its position. I might extend the library for other ad-hoc methods I use to work with arrays.
🟩 HOW TO USE
Pine Script libraries contain reusable code for importing into indicators. You do not need to copy any code out of here. Just import the library and call the method you want.
For example, for version 1 of this library, import it like this:
import SimpleCryptoLife/ArraysAssorted/1
See the EXAMPLE USAGE sections within the library for examples of calling the methods.
You do not need permission to use Pine libraries in your open-source scripts.
However, you do need explicit permission to reuse code from a Pine Script library’s functions in a public protected or invite-only publication .
In any case, credit the author in your description. It is also good form to credit in open-source comments.
For more information on libraries and incorporating them into your scripts, see the Libraries section of the Pine Script User Manual.
🟩 METHOD 1: m_getHighestLowestFloat()
Finds the highest or lowest float value from an array. Simple enough. It also returns the index of the value as an offset from the end of the array.
• It works with rolling lookback windows, so you can find extremes within the last N elements
• It includes an offset parameter to skip recent elements if needed
• It handles edge cases like empty arrays and invalid ranges gracefully
• It can find either the first or last occurrence of the extreme value
We also export two enums whose sole purpose is to look pretty as method arguments.
method m_getHighestLowestFloat(_self, _highestLowest, _lookbackBars, _offset, _firstLastType)
Namespace types: array
This method finds the highest or lowest value in a float array within a rolling lookback window, and returns the value along with the offset (number of elements back from the end of the array) of its first or last occurrence.
Parameters:
_self (array) : The array of float values to search for extremes.
_highestLowest (HighestLowest) : Whether to search for the highest or lowest value. Use the enum value HighestLowest.highest or HighestLowest.lowest.
_lookbackBars (int) : The number of array elements to include in the rolling lookback window. Must be positive. Note: Array elements only correspond to bars if the consuming script always adds exactly one element on consecutive bars.
_offset (int) : The number of array elements back from the end of the array to start the lookback window. A value of zero means no offset. The _offset parameter offsets both the beginning and end of the range.
_firstLastType (FirstLast) : Whether to return the offset of the first (lowest index) or last (highest index) occurrence of the extreme value. Use FirstLast.first or FirstLast.last.
Returns: (tuple) A tuple containing the highest or lowest value and its offset -- the number of elements back from the end of the array. If not found, returns . NOTE: The _offsetFromEndOfArray value is not affected by the _offset parameter. In other words, it is not the offset from the end of the range but from the end of the array. This number may or may not have any relation to the number of *bars* back, depending on how the array is populated. The calling code needs to figure that out.
EXPORTED ENUMS
HighestLowest
Whether to return the highest value or lowest value in the range.
• highest : Find the highest value in the specified range
• lowest : Find the lowest value in the specified range
FirstLast
Whether to return the first (lowest index) or last (highest index) occurrence of the extreme value.
• first : Return the offset of the first occurrence of the extreme value
• last : Return the offset of the last occurrence of the extreme value
Spot Overlapping FVG - [Fandesoft Trading Academy]🧠 Overview
This script plots Higher Timeframe Fair Value Gaps (FVGs) with full visibility and precise placement on lower timeframe charts. Each timeframe (1D–12M) has its own independent toggle, custom label, and box styling, allowing traders to analyze broader market structures across swing and long-term horizons.
🎯 Features
✅ Identifies Fair Value Gaps using a 3-candle logic (candle 1 high vs candle 3 low, and vice versa).
✅ Plots HTF FVG boxes aligned to lower timeframes for comprehensive multi-timeframe analysis.
✅ Supports custom timeframes: 1D to 12M, with individual toggles.
✅ Full visual customization: border color, bullish/bearish box opacity, label font size and color.
✅ Modular inputs to enable or disable specific timeframes for performance.
✅ Uses barstate.isconfirmed logic for stable, non-repainting plots.
⚙️ How It Works
The script requests higher timeframe data via request.security. For each confirmed bar, it checks for FVGs based on:
Bullish FVG: low >= high
Bearish FVG: low >= high
If a gap is detected, a box is plotted between candle 1 and candle 3 using box.new().
Timeframe toggles ensure calculations remain within the limit of 40 request.security calls.
📈 Use Cases
Swing traders analyzing daily to monthly imbalances for medium-term strategies.
Position traders seeking to identify long-term imbalance zones for entries or exits.
ICT methodology practitioners visualizing higher timeframe displacement and inefficiencies.
Traders layering multiple HTF FVGs to build confluence-based trading decisions.
Supports & Resistances with MomentumSupports & Resistances with Momentum is an advanced indicator for scalping and intraday trading It shows dynamic support and resistance levels, clear BUY/SELL signals with TP targets and stop-loss lines, plus optional RSI and volume plots Fully customizable and designed for quick, precise trade decisions.
Crypto Risk-Weighted Allocation SuiteCrypto Risk-Weighted Allocation Suite
This indicator is designed to help users explore dynamic portfolio allocation frameworks for the crypto market. It calculates risk-adjusted allocation weights across major crypto sectors and cash based on multi-factor momentum and volatility signals. Best viewed on INDEX:BTCUSD 1D chart. Other charts and timeframes may give mixed signals and incoherent allocations.
🎯 How It Works
This model systematically evaluates the relative strength of:
BTC Dominance (CRYPTOCAP:BTC.D)
Represents Bitcoin’s share of the total crypto market. Rising dominance typically indicates defensive market phases or BTC-led trends.
ETH/BTC Ratio (BINANCE:ETHBTC)
Gauges Ethereum’s relative performance versus Bitcoin. This provides insight into whether ETH is leading risk appetite.
SOL/BTC Ratio (BINANCE:SOLBTC)
Measures Solana’s performance relative to Bitcoin, capturing mid-cap layer-1 strength.
Total Market Cap excluding BTC and ETH (CRYPTOCAP:TOTAL3ES)
Represents Altcoins as a broad category, reflecting appetite for higher-risk assets.
Each of these series is:
✅ Converted to a momentum slope over a configurable lookback period.
✅ Standardized into Z-scores to normalize changes relative to recent behavior.
✅ Smoothed optionally using a Hull Moving Average for cleaner signals.
✅ Divided by ATR-based volatility to create a risk-weighted score.
✅ Scaled to proportionally allocate exposure, applying user-configured minimum and maximum constraints.
🪙 Dynamic Allocation Logic
All signals are normalized to sum to 100% if fully confident.
An overall confidence factor (based on total signal strength) scales the allocation up or down.
Any residual is allocated to cash (unallocated capital) for conservative exposure.
The script automatically avoids “all-in” bias and prevents negative allocations.
📊 Outputs
The indicator displays:
Market Phase Detection (which asset class is currently leading)
Risk Mode (Risk On, Neutral, Risk Off)
Dynamic Allocations for BTC, ETH, SOL, Alts, and Cash
Optional momentum plots for transparency
🧠 Why This Is Unique
Unlike simple dominance indicators or crossovers, this model:
Integrates multiple cross-asset signals (BTC, ETH, SOL, Alts)
Adjusts exposure proportionally to signal strength
Normalizes by volatility, dynamically scaling risk
Includes configurable constraints to reflect your own risk tolerance
Provides a cash fallback allocation when conviction is low
Is entirely non-repainting and based on daily closing data
⚠️ Disclaimer
This script is provided for educational and informational purposes only.
It is not financial advice and should not be relied upon to make investment decisions.
Past performance does not guarantee future results.
Always consult a qualified financial advisor before acting on any information derived from this tool.
🛠 Recommended Use
As a framework to visualize relative momentum and risk-adjusted allocations
For research and backtesting ideas on portfolio allocation across crypto sectors
To help build your own risk management process
This script is not a turnkey strategy and should be customized to fit your goals.
✅ Enjoy exploring dynamic crypto allocations responsibly!
MACD HTF Crossover SignalsHigher time frame MACD, I like it
/
/
/
/
Trading view wants me to elaborate so in my opinion indicators on higher time frames work better on smaller time frames. Good
Multi-Indicator PanelMulti-indicator panel that combines the following into one panel:
RSI2
RSI14
%K (for stochastics)
%D (for stochastics)
ADX
DI+
DI-
MACD
MACD signal
MACD histogram
All can be toggled on/off and parameters can be adjusted in settings.
Random Coin Toss Strategy📌 Overview
This strategy is a probability-based trading simulation that randomly decides trade direction using a coin-toss mechanism and executes trades with a customizable risk-reward ratio. It's designed primarily for testing entry frequency and risk dynamics, not predictive accuracy.
🎯 Core Concept
Every N bars (configurable), the strategy performs a pseudo-random coin toss.
Based on the result:
If heads → Buy
If tails → Sell
Once a position is opened, it sets a Stop-Loss (SL) and Take-Profit (TP) based on a multiple of the current ATR (Average True Range) value.
⚙️ Configurable Inputs
ATR Length Period for ATR calculation, determines volatility basis.
SL Multiplier SL distance = ATR × multiplier (e.g., 1.0 means 1x ATR) .
TP Multiplier TP distance = ATR × multiplier (e.g., 2.0 = 2x ATR) .
Entry Frequency Bars to wait between each new coin toss decision.
Show TP/SL Zones Toggle on/off for drawing visual TP and SL zones.
Box Size Number of bars used to define the width of the TP/SL boxes.
🔁 Entry & Exit Logic
Entry:
Happens only when no current position exists and it's the correct bar interval.
Entry direction is randomly decided.
Exit:
Positions exit at either:
Take-Profit (TP) level
Stop-Loss (SL) level
Both are calculated using the configured ATR-based distances.
🖼️ Visual Features
TP and SL zones:
Rendered as shaded rectangles (boxes) only once per trade.
Green box for TP zone, red box for SL zone.
Automatically deleted and redrawn for each new trade to avoid chart clutter.
ATR Display Table:
A minimal info table at the top-right shows the current ATR value.
Updates every few bars for performance.
🧪 Use Cases
Ideal for risk-reward modeling, strategy prototyping, and understanding how volatility-based SL/TP behavior affects results.
Great for backtesting frequency, RR tweaks (e.g., 2:5 or 3:1), and execution structure in random conditions.
⚠️ Disclaimer
Since the trade direction is random, this script is not meant for predictive trading but serves as a powerful experiment framework for studying how SL, TP, and volatility interact with random chance in a controlled, repeatable system.
Samil Dogru SmartTrailing v1.1📘 Samil Dogru SmartTrailing v1.1 – BTCUSDT Optimized Strategy (15-Minute)
Samil Dogru SmartTrailing v1.1 is an advanced trend-tracking and profit-locking strategy, specifically optimized for BTCUSDT on the 15-minute timeframe.
It integrates dynamic price following, intelligent trailing exit after trigger activation, and protective hard-stop loss logic to maximize profit while limiting downside risk.
⚙️ Core Strategy Logic:
Entry Signal: Based on a crossover of HMA100 and HMA200, filtered by the trend direction of HMA500 and HMA1000 (cloud logic).
Trigger Mechanism: When price moves a user-defined percentage (e.g., +1.2%) from the entry, the trailing logic is activated.
Smart Trailing Exit: Once triggered, the strategy tracks new highs (for long) or new lows (for short). A trailing stop is dynamically updated. If price pulls back by the defined margin (e.g., 0.8%), the position exits.
Hard Stop (Pre-Trigger): If price moves adversely by a defined percentage (e.g., 2.5%) before the trigger is hit, the position is forcefully exited to protect capital.
📊 Performance Note:
On BTCUSDT with 15-minute candles, historical testing has shown:
High directional accuracy
Optimized entry and exit timing
Improved profit retention with minimal user intervention
This setup is ideal for semi-automated swing scalping within structured trend conditions.
📎 User Controls:
All percentages are user-defined:
Trigger Threshold (%)
Trailing Margin (%)
Maximum Loss (%) before trigger
Trailing logic is active only after the trigger level is reached. One position at a time (pyramiding=0).
⚠️ Disclaimer:
This strategy is not financial advice. While historical performance is promising, future results are not guaranteed.
Always test in a simulated environment before deploying real capital. Use proper position sizing and risk management.
Kelly Optimal Leverage IndicatorThe Kelly Optimal Leverage Indicator mathematically applies Kelly Criterion to determine optimal position sizing based on market conditions.
This indicator helps traders answer the critical question: "How much capital should I allocate to this trade?"
Note that "optimal position sizing" does not equal the position sizing that you should have. The Optima position sizing given by the indicator is based on historical data and cannot predict a crash, in which case, high leverage could be devastating.
Originally developed for gambling scenarios with known probabilities, the Kelly formula has been adapted here for financial markets to dynamically calculate the optimal leverage ratio that maximizes long-term capital growth while managing risk.
Key Features
Kelly Position Sizing: Uses historical returns and volatility to calculate mathematically optimal position sizes
Multiple Risk Profiles: Displays Full Kelly (aggressive), 3/4 Kelly (moderate), 1/2 Kelly (conservative), and 1/4 Kelly (very conservative) leverage levels
Volatility Adjustment: Automatically recommends appropriate Kelly fraction based on current market volatility
Return Smoothing: Option to use log returns and smoothed calculations for more stable signals
Comprehensive Table: Displays key metrics including annualized return, volatility, and recommended exposure levels
How to Use
Interpret the Lines: Each colored line represents a different Kelly fraction (risk tolerance level). When above zero, positive exposure is suggested; when below zero, reduce exposure. Note that this is based on historical returns. I personally like to increase my exposure during market downturns, but this is hard to illustrate in the indicator.
Monitor the Table: The information panel provides precise leverage recommendations and exposure guidance based on current market conditions.
Follow Recommended Position: Use the "Recommended Position" guidance in the table to determine appropriate exposure level.
Select Your Risk Profile: Conservative traders should follow the Half Kelly or Quarter Kelly lines, while more aggressive traders might consider the Three-Quarter or Full Kelly lines.
Adjust with Volatility: During high volatility periods, consider using more conservative Kelly fractions as recommended by the indicator.
Mathematical Foundation
The indicator calculates the optimal leverage (f*) using the formula:
f* = μ/σ²
Where:
μ is the annualized expected return
σ² is the annualized variance of returns
This approach balances potential gains against risk of ruin, offering a scientific framework for position sizing that maximizes long-term growth rate.
Notes
The Full Kelly is theoretically optimal for maximizing long-term growth but can experience significant drawdowns. You should almost never use full kelly.
Most practitioners use fractional Kelly strategies (1/2 or 1/4 Kelly) to reduce volatility while capturing most of the growth benefits
This indicator works best on daily timeframes but can be applied to any timeframe
Negative Kelly values suggest reducing or eliminating market exposure
The indicator should be used as part of a complete trading system, not in isolation
Enjoy the indicator! :)
P.S. If you are really geeky about the Kelly Criterion, I recommend the book The Kelly Capital Growth Investment Criterion by Edward O. Thorp and others.
Breakout LabelsThis script labels the highest price of the lowest candle over a period of time. It then labels any bullish breakouts where the close price is higher than the high of the lowest candle.
Heiken Ashi CVD v6.8🔷 Heiken Ashi CVD v6.8 — Predictive Gann HiLo + Momentum-Scored Trend System
Overview:
This premium-grade indicator blends the power of Heiken Ashi smoothing, real CVD (Cumulative Volume Delta), and a predictive Gann Hi-Lo trend engine — engineered for precision, clarity, and long-term stability.
💡 What it Does:
✅ Plots Smart Candles using your choice of:
Real CVD-based candles
Heiken Ashi CVD (for smoother order-flow clarity)
Or Heiken Ashi Price (as a fallback or volatility filter)
🔁 Switches Between 5 Trend Modes:
Gann HiLo – Traditional swing logic using high/low smoothing
HMA – Fast-reacting trend detection with Hull MA
GH-HMA (Average) – Balanced hybrid of HMA and SMA
GH-HMA (Confirm) – Requires both HMA and SMA to agree
GH-HMA (Score Weighted) – Uses intelligent scoring + momentum to confirm directional confidence
⚡ Optional Momentum Acceleration Filter:
Detects trend momentum surges using ROC (Rate of Change)
Filters weak signals in Score Weighted mode for higher confidence entries
User-toggleable: enable or disable as needed
📢 Alerts You ONLY When It Matters:
Buy/Sell signals fire only when both Price and your selected CVD/HA source close beyond the Gann HiLo trendline
Ensures the trend has flipped direction, not just flickered
🛡️ Failsafe Design:
Auto-fallback to HA Price if CVD data is unavailable
Candle logic and MA signals adapt seamlessly to selected source
Non-repainting, lightweight, multi-timeframe compatible
🎯 Ideal For:
Traders who want clean, high-probability trend signals
Volume delta analysts using Heiken Ashi-enhanced CVD
Professionals seeking a blend of visual clarity + confirmation logic
Anyone who wants predictive edge without repainting
🧠 Bonus:
Built with professional-grade logic, clean UI, and future-proof structure.
Fully customizable and user-friendly.
💎 Free to Use — Give Back, Not Guess
This tool was built to empower traders with transparent logic, predictive structure, and real insight — not just colors and noise.
Use it. Share it. Improve it.
Supertrend AT v1.0📌 Supertrend AT v1.0 — Strategy Overview
Overview
Supertrend AT v1.0 is a fully automated trading strategy based on the Supertrend indicator.
It identifies trend reversals and places long or short entries accordingly, with built-in position sizing, stop-loss/take-profit management, and commission-aware calculations.
🚀 Key Features
✅ Entry Signals Based on Trend Reversals
Long entry when Supertrend changes from downtrend to uptrend
Short entry when Supertrend changes from uptrend to downtrend
✅ Risk-Based Position Sizing
Calculates position size so that a stop-loss only risks a fixed percentage (RPT) of total capital
✅ Reward/Risk Ratio-Based Target Price Calculation
Take-profit price is computed not by price difference, but by actual loss and desired reward-to-risk (RR) ratio
✅ Fully Commission-Aware
Commission is factored into entry, stop-loss, and take-profit price calculations
Ensure commission settings match in both the input panel and the strategy properties tab
✅ Dual Language Support
Switch between English and Korean interface
✅ Visual Trade Levels & Info Display
Entry, stop, and target prices plotted on the chart
Real-time open PnL and equity shown in an on-screen table
⚙️ How to Use
Apply Strategy to Chart
Load the strategy and configure the following parameters in both the Input tab and the Properties tab:
Commission rate (e.g., 0.05%)
Market decimal precision (e.g., 4 for 0.0001)
Adjust Entry Parameters
RPT: Risk per trade as a percentage of your total equity (e.g., 2%)
RR: Reward-to-risk ratio (e.g., 3 = target profit is 3× the potential loss)
Choose whether to allow Long or Short trades
For Auto-Trading Integration
Make sure the minimum order size is valid for your exchange
If the calculated quantity is below the exchange's minimum unit, it may result in errors
⚠️ Important Notes
❗ Non-Repainting — Supertrend is based on confirmed candles and does not repaint
❗ Backtest-Only — The strategy is for signal generation only and does not execute real trades without external automation
❗ Margin-Based Calculations — Default settings assume margin trading; adjust accordingly
📄 License & Disclaimer
This strategy is licensed under the Mozilla Public License 2.0.
This script is not financial advice. Use at your own risk.
Always test thoroughly with backtesting and paper trading before using in live markets.