Volume and Moving average,will this model working in real-trade?
Oct 7, 2021

The Volume and Moving average tool identifies trend momentum and high-volume breakouts by combining multi-period moving averages with Bollinger Band volatility envelopes and relative volume analysis.
Usage
The script is primarily used to identify trend entries when price action aligns with volume confirmation. Users can observe bullish entries when the price breaks above the upper Bollinger Band while buy volume significantly exceeds both the sell volume and the long-term daily average. Conversely, bearish conditions are identified when price falls below the lower bands alongside dominant sell volume.
The strategy employs a dynamic exit mechanism. Instead of a fixed take-profit, it tracks the highest price reached since the entry and closes the position if the price retraces by a specific percentage or hits a predefined profit target (e.g., 5% gain). It also includes a stop-loss condition to protect capital if the position value drops below a certain threshold of the average entry price.
Details
The script calculates specific "Buy Volume" and "Sell Volume" by analyzing the close's position relative to the bar's range:
- Buy Volume: Calculated as
volume * (close - low) / (high - low). - Sell Volume: Calculated as
volume * (high - close) / (high - low).
The implementation utilizes multiple Simple Moving Averages (SMAs) ranging from 1 to 120 periods to determine trend hierarchy. For a long entry, the script requires the 20-period MA to be above the 60-period MA, ensuring medium-term momentum is positive. The Bollinger Bands are configured with three distinct deviation levels to provide a granular view of price extensions.
The exit logic is unique in that it prioritizes trailing the highest price observed during the trade's duration. This "highest price after entry" logic allows the script to lock in gains during volatile moves while attempting to exit before a significant trend reversal occurs.
Settings
Moving Averages
- Length 1-120: Sets the lookback periods for the various SMA lines used to determine trend direction.
- Daily MA length: The lookback period for the daily average volume calculation.
- Weekly MA length: The lookback period for the weekly average volume used in exit and bear conditions.
Bollinger Bands
- BB Length: The period used to calculate the basis (SMA) of the Bollinger Bands.
- Source: The price data used for BB calculations (default is Close).
- StdDev (mult): The standard deviation multiplier for the outer bands.
- exp/exp1 (mult2/mult3): Secondary and tertiary multipliers used to create internal volatility zones.
- Offset: Shifts the Bollinger Band plots forward or backward in time.
FAQ
How does the strategy determine if volume is bullish? The script compares "Buy Volume" (calculated based on the close's proximity to the high) against "Sell Volume" and checks if the total buy volume is greater than the 50-period daily average volume.
Why does the strategy include multiple exit conditions? The script uses a hierarchical exit system that checks for fixed profit targets (5%), trailing stop-losses based on retracements from the highest price, and a hard stop-loss if the price drops more than 10% below the entry price.
How can I access this tool? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.