Type/to search

ZVWAP Strategy Based on Z-Distance from VWAP

Cryptocurrency
Created: 2023-11-10 12:02:19
Last modified: 3 years ago
1
Follow
1778
Followers

img

Overview

This strategy is based on the Z-distance from VWAP indicator by LazyBear. It uses the Z-distance between price and VWAP to determine overbought and oversold conditions, as well as entries and exits. The strategy incorporates EMA lines and Z-distance crossing 0 level to filter out some noise.

Strategy Logic

  1. Calculate VWAP value
  2. Calculate Z-distance between price and VWAP
  3. Set overbought line (2.5) and oversold line (-0.5)
  4. Go long when fast EMA > slow EMA, Z-distance < oversold line and Z-distance crosses above 0
  5. Close position when Z-distance > overbought line
  6. Incorporate stop loss logic

Key Functions:

  • calc_zvwap: Calculate Z-distance between price and VWAP
  • VWAP value: vwap(hlc3)
  • Fast EMA: ema(close,fastEma)
  • Slow EMA: ema(close,slowEma)

Advantage Analysis

  1. Z-distance intuitively shows overbought/oversold levels
  2. EMA filters out false breakouts
  3. Allows pyramiding to capitalize on trends
  4. Has stop loss logic to control risk

Risk Analysis

  1. Need to ensure parameters like lines, EMA periods are set properly
  2. Z-distance indicator lags, may miss key turning points
  3. Pyramiding can increase loss if trend reverses
  4. Stop loss needs to be set reasonably

Solutions:

  1. Optimize parameters via backtesting
  2. Add other indicators to filter signals
  3. Set proper conditions for pyramiding
  4. Use dynamic stop loss

Optimization Directions

  1. Optimize EMA periods
  2. Test different overbought/oversold criteria
  3. Add other indicators to filter noise
  4. Test different stop loss techniques
  5. Optimize entry, pyramiding and stop loss logic

Summary

The strategy uses Z-distance to determine price-VWAP relationship and adds EMA to filter signals, aiming to capture trend opportunities. It allows pyramiding to follow trends and has a stop loss to control risk. Optimization and adding other indicators can improve robustness. However, lagging issue of Z-distance should be considered during optimization. Overall, this is a trend-following strategy with simple, clear logic. When fully optimized, it can be an efficient tool to trade trends.

Source
Pine
/*backtest
start: 2022-11-03 00:00:00
end: 2023-11-09 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/
// © mohanee

//@version=4
Strategy parameters
Strategy parameters
length
OverSold Line
OverBought Line
Fast EMA
Slow EMA
Stop Loss
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)