
이 전략은 거래량 이동 평균과 표준 차이를 사용하여 거래량 모델을 구축하고, 가격의 이동 평균과 결합하여 트렌드 방향을 판단하고, 거래량이 정상인 경우 거래 신호를 발송한다. 전략은 또한 거래량이 높고 낮은 한계를 설정하여 거래량이 비정상적인 경우 잘못된 신호를 발송하는 것을 피할 수 있다.
핵심 논리는 거래량 모델과 가격 추세를 판단하는 것입니다.
이 전략은 거래량 모델과 가격 트렌드를 결합하여 거래량이 비정상적인 경우 가격 트렌드를 추적하는 것을 피하고 일부 가짜 신호를 필터링 할 수 있습니다.
위험 해결 방법:
이 전략은 전체적인 아이디어는 명확하며 거래량을 사용하여 가짜 트렌드를 추적하는 것을 피하고 입시 신호는 신뢰할 수 있습니다. 그러나 전략 자체는 간단하며 확장 가능한 공간이 넓으며, 더 많은 지표, 기계 학습, 스톱 손실과 같은 모듈을 추가하여 최적화하면 안정성과 트렌드를 포착하는 능력을 더욱 향상시킬 수 있습니다. 이 전략은 전형적인 트렌드 추적 전략으로, 최적화되면 매우 실용적인 계량화 전략이 될 수 있습니다.
/*backtest
start: 2022-11-14 00:00:00
end: 2023-11-20 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/
// © dongyun
//@version=4
strategy("交易量底部标准差系统", overlay=true)
options = input(1,'')
length = input(40,'')
nlow = input(5,'')
factor = input(1.0,'')
vavg = 0.0
vavgn = 0.0
vsd = 0.0
lowlimit = 0.0
uplimit = 0.0
mavg = 0.0
aror = 0.0
adjvol = 0.0
savevol = 0.0
//Find average volume, replacing bad values
adjvol := volume
if (volume != 0)
savevol := volume
else
savevol := savevol[1]
adjvol := savevol
// Replace high volume days because they distort standard deviation
if (adjvol > 2 * factor * nz(vsd[1]))
adjvol := savevol
else
adjvol := adjvol[1]
vavg := sma(adjvol,length)
vsd := stdev(adjvol,length)
vavgn := sma(adjvol,nlow)
// Extreme volume limits
lowlimit := vavg - factor * vsd
uplimit := vavg + 2 * factor * vsd
// System rules based on moving average trend
mavg := sma(close,length/2)
// Only enter on new trend signals
if (options == 2)
if (mavg > mavg[1] and mavg[1] <= mavg[2])
strategy.entry("Long", strategy.long)
if (mavg<mavg[1] and mavg[1]>=mavg[2])
strategy.entry("Short", strategy.short)
else
if (mavg > mavg[1] and vavgn > lowlimit)
strategy.entry("Long", strategy.long)
if (mavg < mavg[1] and vavgn > lowlimit)
strategy.entry("Short", strategy.short)
// Exit on low volume
if (options != 1)
if (mavg<mavg[1] or (strategy.position_size > 0 and vavgn<= lowlimit))
strategy.close("Long")
if (mavg>mavg[1] or (strategy.position_size > 0 and vavgn<= lowlimit))
strategy.close("Short")
else
if (mavg < mavg[1])
strategy.close("Long")
if (mavg > mavg[1])
strategy.close("Short")