Strategy vault / Trend following
Trend Following Strategy Based on Price Volume Integration
This strategy is named "Trend Following Strategy Based on Price-Volume Integration". It considers both price and volume indicators to determine trend direction and generate signals aligned with price-volume forces…
This strategy is named "Trend Following Strategy Based on Price-Volume Integration". It considers both price and volume indicators to determine trend direction and generate signals aligned with price-volume forces.
The trading logic is as follows:
First calculate the 5-day moving average of price and 15-day moving average of volume.
When the 5-day price moving average goes up and the 15-day volume moving average also rises, it signals synchronized price-volume upthrust to generate buy signals.
When the 5-day price moving average declines, or the 15-day volume moving average declines, existing long positions will be closed.
The advantage of this strategy is jointly using price and volume changes to judge trend direction. Only when both point to bullishness will long entry be triggered, effectively filtering false signals.
But parameters of moving averages need optimization and tuning to match different products' characteristics. Stop loss is also crucial to reduce single trade loss risks.
In conclusion, properly integrating price and volume indicators can improve trend trading strategy performance. But traders still need to watch more market information, maintaining flexibility to adjust strategy parameters based on actual conditions.
Source Pine Script
/*backtest
start: 2023-01-01 00:00:00
end: 2023-09-12 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Celar
//@version=5
strategy("VOLLY PRICE CONVERGE", default_qty_type= strategy.percent_of_equity )
base_sma = ta.sma(close, 10)
vol_sma5 = ta.hma(volume, 15)
price_sma5 = ta.hma(close, 15)
ma50 = ta.sma(close, 50)
ma20 = ta.sma(close, 20)
int vol_indicator = na
int price_indicator = na
if vol_sma5 > vol_sma5[1]
vol_indicator := 1
else
vol_indicator := 0
if price_sma5 > price_sma5[1]
price_indicator := 1
else
price_indicator := 0
signal = vol_indicator + price_indicator
colour = signal == 2 ? #00802b : signal == 1 ? #cc2900 : color.white
bank_roll = strategy.equity
qty = bank_roll/close
strategy.entry("Long", strategy.long, qty, when = signal == 2 and close > base_sma)
// Generate a full exit bracket (profit 10 points, loss 5 points per contract) from the entry named "Long".
strategy.close("Long", when = signal == 1 or signal == 0 or close < base_sma )
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-13. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Trend-Following-Strategy-Based-on-Price-Volume-Integration.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h
- Adaptive FVG Detection and MA Trend Trading Strategy with Dynamic ResistancePine Script · Trend following · 1d
- Adaptive Risk Management Strategy Based on Dynamic ATR and Moving Average CrossoverPine Script · Trend following · 2h
- Adaptive Trading Strategy Based on Stochastic RSI Dual Line CrossoverPine Script · Trend following · 4h
- Adaptive Volatility Based Trend Following Short Strategy with Time Delay and Stop Loss ProtectionPine Script · Trend following · 2m