Strategy vault / Trend following
WaveTrend Trend Following Trading Strategy
This strategy uses the WaveTrend indicator to determine trend direction and generate trading signals at turning points. It belongs to trend following strategies.
Overview
This strategy uses the WaveTrend indicator to determine trend direction and generate trading signals at turning points. It belongs to trend following strategies.
Strategy Logic
Calculate WaveTrend oscillator, positive value indicates uptrend and negative value downtrend.
WaveTrend direction change produces buy and sell signals.
Option to only trade long side.
Enable arrows to mark WaveTrend turning points.
Background color for intuitive trend visualization.
Simple and clear strategy rules easy to implement.
Advantages
WaveTrend sensitive in catching trend turns early.
Visualized arrows and background color make intuitive signals.
Simple and practical default parameters.
Concise code easy to understand and modify.
Flexibility to only trade long or short.
Risks
WaveTrend may generate false signals causing unnecessary losses.
Unable to determine trend strength, risks of chasing.
Prone to whipsaws in ranging markets.
Improper parameters negatively affect performance.
No stop loss may lead to large losses.
Enhancement
Test parameter combinations to find optimum.
Add filters with other indicators to avoid false signals.
Incorporate stop loss strategy for risk control.
Evaluate necessity of only long or short.
Toggle arrows based on market conditions.
Optimize money management for more stable returns.
Conclusion
This strategy trades WaveTrend direction changes simply and viably, but has some risks. Improvements like parameter optimization, stops, filters can make it a stable and efficient trend following system.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | Only Long? |
| v_input_2 | true | Need new-trend-arrows? |
Source Pine Script
/*backtest
start: 2023-09-12 00:00:00
end: 2023-09-19 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// (c) Noro
//2017
//@version=2
strategy(title="Noro's WaveTrend Strategy v1.0", shorttitle = "WaveTrend str 1.0", overlay = true)
//settings
onlylong = input(true, title = "Only Long?")
usearr = input(true, title = "Need new-trend-arrows?")
//WTO ("WaveTrend Oscilator") method by LazyBear
//Start of LazyBear's code
esa = ema(hlc3, 10)
d = ema(abs(hlc3 - esa), 10)
ci = (hlc3 - esa) / (0.015 * d)
tci = ema(ci, 21)
//End of LazyBear's code
WTOtrend = tci > 0 ? 1 : tci < 0 ? -1 : 0
//background
col = WTOtrend == 1 ? 1 : WTOtrend == -1 ? -1 : col[1]
bgcolor = col == 1 ? lime : col == -1 ? red : na
bgcolor(bgcolor, transp=70)
//arrows
posi = WTOtrend == 1 ? 1 : WTOtrend == -1 ? -1 : posi[1]
arr = usearr == true ? posi == 1 and posi[1] < 1 ? 1 : posi == -1 and posi[1] > -1 ? -1 : na : na
plotarrow(arr == 1 ? 1 : na, title = "UpArrow", colorup = blue, colordown = blue, maxheight = 60, minheight = 50, transp = 0)
plotarrow(arr == -1 ? -1 : na, title = "DnArrow", colorup = blue, colordown = blue, maxheight = 60, minheight = 50, transp = 0)
//trading
longCondition = posi == 1 and posi[1] < 1
if (longCondition)
strategy.entry("Long", strategy.long)
shortCondition = posi == -1 and posi[1] > -1
if (shortCondition)
strategy.entry("Short", strategy.short, onlylong == true ? 0 : na)Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-20. 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/WaveTrend-Trend-Following-Trading-Strategy.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
- 200 EMA VWAP MFI Trend Following StrategyPine Script · Trend following · 1d
- 4 EMA Trend StrategyPine Script · Trend following · 1d
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR Dynamic Trend Following and EMA Crossover Trading StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h
- ATR and T3 Moving Average StrategyPine Script · Trend following · 5m