Strategy vault / Trend following
Vegas Trend Wave Strategy
This strategy calculates percentage price difference between multiple EMA pairs to determine trend direction, and trades based on the Vegas wave. Specifically, it computes percentage price differences between current…
This strategy calculates percentage price difference between multiple EMA pairs to determine trend direction, and trades based on the Vegas wave.
Specifically, it computes percentage price differences between current price, 144-period EMA, 169-period EMA and 233-period EMA. Long signals are generated when all three meet the preset positive difference threshold. Shorts are triggered when price falls below all three EMAs and 144-period EMA crosses below 233-period EMA.
The EMA combo filters more false breaks compared to single EMA. Also, the Vegas wave itself contains multiple EMAs for robust trend analysis.
However, EMAs have inherent lag and cannot identify optimal entries. And there is subjectivity in wave theory, with performance relying largely on parameter optimization. Prudent assessment of live results is required.
Overall, the Vegas trend wave strategy synergizes EMA analysis and wave theory for good results in trending markets. But risk management remains crucial for long-term application.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 0.1 | EMA144 percent difference from EMA233 |
| v_input_2 | 0.1 | EMA169 percent difference from EMA233 |
| v_input_3 | 0.1 | Current price percent difference from EMA233 |
Source Pine Script
/*backtest
start: 2023-09-03 00:00:00
end: 2023-09-10 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("Vegas Wave Strategy", overlay=true)
ema144 = ema(close, 144)
ema169 = ema(close, 169)
ema233 = ema(close, 233)
current = close
upd144 = input(title="EMA144 percent difference from EMA233", type=float, defval=0.1)
upd169 = input(title="EMA169 percent difference from EMA233", type=float, defval=0.1)
upd_current = input(title="Current price percent difference from EMA233", type=float, defval=0.1)
//pDiff - Percentage Difference
pDiff(x, y) =>
((x-y)/x)*100
gtDiff(x, y) =>
x > y
pd144 = pDiff(ema144, ema233)
pd169 = pDiff(ema169, ema233)
pd_current = pDiff(current,ema233)
plot(ema144,color=orange, linewidth=2, transp=0, title="144 EMA")
plot(ema169,color=blue,linewidth=2, transp=0, title="169 EMA")
plot(ema233,color=red,linewidth=2, transp=0, title="233 EMA")
//plot(current, color=white, title="Current Candle")
if (gtDiff(pd_current, upd_current) and gtDiff(pd144, upd144) and gtDiff(pd169, upd169))
strategy.entry("buy", strategy.long, when=strategy.position_size <=0)
// if (ema8 > ema55 and ema13 > ema55 and ema21 > ema55 and current > ema55 and pd_current > upd_current)
// strategy.entry("buy", strategy.long, 10000, when=strategy.position_size <=0)
if (current < ema144 and current < ema169 and current < ema233 and ema144 <= ema233)
strategy.entry("sell", strategy.short, when=strategy.position_size > 0)Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-11. 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/Vegas-Trend-Wave-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