여러 지표가 전략을 따르고

저자:차오장
태그:

img

전반적인 설명

전략 논리

이 전략은 두 부분으로 구성됩니다.

  1. 123 반전 지표

  1. Qstick 표시기

이 지표는 개시 가격과 폐쇄 가격의 차이점의 간단한 이동 평균을 계산하여 황소와 곰의 힘을 판단합니다. 이 지표는 제로선을 넘을 때 거래 신호를 생성합니다.

Qstick가 0선 이상으로 넘어가면 상승 동력을 증가시키고 구매 신호를 생성합니다. Qstick가 0선 아래로 넘어가면 하락 동력을 증가시키고 판매 신호를 생성합니다.

이점 분석

다중 지표 추적 전략은 두 가지 다른 유형의 지표의 신호를 결합하여 거래 신호의 정확성을 향상시킬 수 있습니다. 단일 지표와 비교하면 잘못된 신호를 효과적으로 줄이고 더 높은 승률을 달성 할 수 있습니다.

또한 이 전략은 두 지표의 신호가 일치할 때만 시장에 진출할 수 있으며 이는 위험을 효과적으로 제어하고 두 지표의 차이에서 이상 현상을 예방할 수 있습니다.

위험 과 해결책

  1. 표시기 사이의 신호 생성 시간 차이는 완벽하게 일치 할 수 없습니다

이것은 매개 변수 최적화, 두 지표의 매개 변수를 조정하여 신호 생성의 주파수와 리듬을 조정하여 해결할 수 있습니다.

최소 보유 기간을 설정할 수 있습니다. 자주 취소하고 주문을 만들지 않도록 말이죠.

최적화 방향

  1. 최적의 매개 변수 조합을 찾기 위해 두 지표의 길이 매개 변수를 최적화

  2. 스톱 로스 전략을 추가

결론


/*backtest
start: 2023-12-26 00:00:00
end: 2024-01-25 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 24/05/2021
// This is combo strategies for get a cumulative signal. 
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The 
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close 
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
// The strategy sells at market, if close price is lower than the previous close price 
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// A technical indicator developed by Tushar Chande to numerically identify 
// trends in candlestick charting. It is calculated by taking an 'n' period 
// moving average of the difference between the open and closing prices. A 
// Qstick value greater than zero means that the majority of the last 'n' days 
// have been up, indicating that buying pressure has been increasing. 
// Transaction signals come from when the Qstick indicator crosses through the 
// zero line. Crossing above zero is used as the entry signal because it is indicating 
// that buying pressure is increasing, while sell signals come from the indicator 
// crossing down through zero. In addition, an 'n' period moving average of the Qstick 
// values can be drawn to act as a signal line. Transaction signals are then generated 
// when the Qstick value crosses through the trigger line.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing) 
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
	         iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) 
	pos


Qstick(Length) =>
    pos = 0.0
    xR = close - open
    xQstick = sma(xR, Length)
    pos:= iff(xQstick > 0, 1,
           iff(xQstick < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Qstick Indicator", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Qstick Indicator ----")
LengthQ = input(14, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posQstick = Qstick(LengthQ)
pos = iff(posReversal123 == 1 and posQstick == 1 , 1,
	   iff(posReversal123 == -1 and posQstick == -1, -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)	 
if (possig == 0) 
    strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )

더 많은