该策略是基于有限交易量(FVE)指标的改进。FVE是一个纯交易量指标,不考虑价格变化,只关注资金流入和流出。该策略在FVE的基础上,根据波动率对交易量进行分色,从而判断市场情绪和资金流向。
该策略通过计算日内波动率Intra
和日间波动率Inter
,结合对应的标准差Vintra
和Vinter
,得到波动率阈值CutOff
。然后计算价格中值、前一中值和交易量的差额MF
,判断资金流入(正值)或流出(负值)。如果MF
超过CutOff
则表示交易量和波动率同向,市场存在明显热情,颜色设为绿色;如果MF
低于负的CutOff
则表示交易量和波动率同向,市场存在明显悲观,颜色设为红色;否则颜色为蓝色。最后判断颜色设置多空方向。
该策略结合了交易量和波动率两个指标,可以更准确判断市场情绪。相比单一指标,具有判断的稳定性和可靠性优势。另外,该策略判断标准专门针对波动率设计,能很好适应不同行情的变化。
该策略依赖交易量和波动率指标,当两者出现分歧时会影响判断。此外,参数设定对结果影响较大,不同品种和参数组合效果差异大,需要针对性优化。
可以考虑结合其他指标辅助判断,例如MACD、 OBV等,避免交易量和波动率带来的噪点。此外,可以设计自适应参数机制,根据不同行情动态调整参数,提高稳定性。或者可以针对具体品种进行回测优化,找到最佳参数组合。
该策略整合交易量和波动率指标的优势,判断市场热情高低。相比单一指标,具有更高的判断准确性和稳定性。但参数设定和品种差异对结果影响显著,仍需进一步优化调整,才能适应多种交易环境。总体来说,该策略理论基础合理,具有很大的改进潜力。
/*backtest
start: 2022-12-12 00:00:00
end: 2023-12-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 22/08/2017
// The FVE is a pure volume indicator. Unlike most of the other indicators
// (except OBV), price change doesn?t come into the equation for the FVE
// (price is not multiplied by volume), but is only used to determine whether
// money is flowing in or out of the stock. This is contrary to the current trend
// in the design of modern money flow indicators. The author decided against a
// price-volume indicator for the following reasons:
// - A pure volume indicator has more power to contradict.
// - The number of buyers or sellers (which is assessed by volume) will be the same,
// regardless of the price fluctuation.
// - Price-volume indicators tend to spike excessively at breakouts or breakdowns.
// This study is an addition to FVE indicator. Indicator plots different-coloured volume
// bars depending on volatility.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Volatility Finite Volume Elements Strategy", shorttitle="FVI")
Samples = input(22, minval=1)
AvgLength = input(50, minval=1)
AlertPct = input(70, minval=1)
Cintra = input(0.1, step = 0.1)
Cinter = input(0.1, step = 0.1)
reverse = input(false, title="Trade reverse")
xVolume = volume
xClose = close
xhl2 = hl2
xhlc3 = hlc3
xMA = sma(xVolume, AvgLength)
xIntra = log(high) - log(low)
xInter = log(xhlc3) - log(xhlc3[1])
xStDevIntra = stdev(xIntra, Samples)
xStDevInter = stdev(xInter, Samples)
TP = xhlc3
TP1 = xhlc3[1]
Intra = xIntra
Vintra = xStDevIntra
Inter = xInter
Vinter = xStDevInter
CutOff = Cintra * Vintra + Cinter * Vinter
MF = xClose - xhl2 + TP - TP1
clr = iff(MF > CutOff * xClose, green,
iff(MF < -1 * CutOff * xClose, red, blue))
pos = iff(MF > CutOff * xClose, 1,
iff(MF < -1 * CutOff * xClose, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(xVolume, color=clr, title="VBF")
plot(xMA, color=blue, title="VBF EMA")