
이 전략은 우선 2과 20기 지수 이동 평균을 이용하여 쌍평평선 지표를 구성하고, 가격이 평균선을 뚫었는지 판단하고, 진입장 내의 기본 판단을 한다. 동시에, 보조 판단 지표는 다공력 균형 지표는 다공력 및 공수 상대력을 추가로 식별하고, 필터 오작동을 한다. 두 지표의 통합 판단은 최종 거래 신호를 형성한다.
2⁄20 평균선 지표
다공력 균형 지표
두 지표의 합성 판단
이러한 조합 전략의 가장 큰 장점은 다양한 종류의 지표를 결합하여 더 신뢰할 수 있는 거래 판단을 달성하는 것입니다. 구체적으로 다음과 같은 몇 가지 장점이 있습니다:
이 전략에는 몇 가지 위험도 있습니다.
대책:
이 전략은 다음의 몇 가지 측면에서 최적화될 수 있습니다.
이 전략은 쌍평평선 지표를 통해 큰 흐름을 판단하고, 다공간 힘 균형 지표를 사용하여 진입 시점을 판단한다. 두 가지 지표는 상호 검증되어 오작동 가능성을 효과적으로 줄일 수 있다. 전략 매개 변수 선택은 유연하며, 다양한 품종에 대해 최적화 조정할 수 있다. 전체적으로 전략은 간단하고 실용적이며, 광범위한 투자자가 배우고 사용할 가치가 있다. 후속으로 추가 최적화를 통해 전략 효과를 더욱 향상시킬 수 있다.
/*backtest
start: 2023-01-01 00:00:00
end: 2024-01-07 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 23/05/2022
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This indicator plots 2/20 exponential moving average. For the Mov
// Avg X 2/20 Indicator, the EMA bar will be painted when the Alert criteria is met.
//
// Second strategy
// This new indicator analyzes the balance between bullish and
// bearish sentiment.
// One can cay that it is an improved analogue of Elder Ray indicator.
// To get more information please see "Bull And Bear Balance Indicator"
// by Vadim Gimelfarb.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
EMA20(Length) =>
pos = 0.0
xPrice = close
xXA = ta.ema(xPrice, Length)
nHH = math.max(high, high[1])
nLL = math.min(low, low[1])
nXS = nLL > xXA or nHH < xXA ? nLL : nHH
iff_1 = nXS < close[1] ? 1 : nz(pos[1], 0)
pos := nXS > close[1] ? -1 : iff_1
pos
BBB(SellLevel,BuyLevel) =>
pos = 0.0
value = close < open ?
close[1] > open ? math.max(close - open, high - low) : high - low :
close > open ?
close[1] > open ? math.max(close[1] - low, high - close) : math.max(open - low, high - close) :
high - close > close - low ?
close[1] > open ? math.max(close[1] - open, high - low) :high - low :
high - close < close - low ?
close > open ? math.max(close - low, high - close) : open - low :
close > open ? math.max(close[1] - open , high - close) :
close[1] < open ? math.max(open - low, high - close) : high - low
value2 =close < open ?
close[1] < open ? math.max(high - close[1], close - low) : math.max(high - open, close - low) :
close > open ?
close[1] > open ? high - low : math.max(open - close[1], high - low) :
high - close > close - low ?
close[1] < open ? math.max(high - close[1], close - low) : high - open :
high - close < close - low ?
close[1] > open ? high - low : math.max(open - close, high - low) :
close[1] > open ? math.max(high - open, close - low) :
close[1] < open? math.max(open - close, high - low): high - low
nBBB = value2 - value
pos := nBBB < SellLevel ? -1 :
nBBB >= BuyLevel ? 1 : nz(pos[1], 0)
pos
strategy(title='Combo 2/20 EMA & Bull And Bear Balance', shorttitle='Combo', overlay=true)
var I1 = '●═════ 2/20 EMA ═════●'
Length = input.int(14, minval=1, group=I1)
var I2 = '●═════ Bull And Bear Balance ═════●'
SellLevel = input.float(-15, step=0.01, group=I2)
BuyLevel = input.float(15, step=0.01, group=I2)
var misc = '●═════ MISC ═════●'
reverse = input.bool(false, title='Trade reverse', group=misc)
var timePeriodHeader = '●═════ Time Start ═════●'
d = input.int(1, title='From Day', minval=1, maxval=31, group=timePeriodHeader)
m = input.int(1, title='From Month', minval=1, maxval=12, group=timePeriodHeader)
y = input.int(2005, title='From Year', minval=0, group=timePeriodHeader)
StartTrade = time > timestamp(y, m, d, 00, 00) ? true : false
posEMA20 = EMA20(Length)
prePosBBB = BBB(SellLevel,BuyLevel)
iff_1 = posEMA20 == -1 and prePosBBB == -1 and StartTrade ? -1 : 0
pos = posEMA20 == 1 and prePosBBB == 1 and StartTrade ? 1 : iff_1
iff_2 = reverse and pos == -1 ? 1 : pos
possig = reverse and pos == 1 ? -1 : iff_2
if possig == 1
strategy.entry('Long', strategy.long)
if possig == -1
strategy.entry('Short', strategy.short)
if possig == 0
strategy.close_all()
barcolor(possig == -1 ? #b50404 : possig == 1 ? #079605 : #0536b3)