동력 돌파구 은선 전략

저자:차오장, 날짜: 2024-02-01 15:01:55
태그:

img

전반적인 설명

이 전략은 가격 동력 지표 MACD 및 이동 평균을 기반으로 한 브레이크 아웃 전략으로 은 (XAG/USD, XAG/EUR) 의 1 시간 프레임에 적합합니다. 핵심은 트렌드 반전 시기를 결정하기 위해 가격 트렌드와 동력 지표를 결합하는 것입니다.

전략 논리

MACD 히스토그램이 음에서 양으로 변경되어 신호선을 지속적으로 깨면 단기 상승 추세가 더 강하다는 것을 나타냅니다. 동시에 종료 가격이 이동 평균의 상승 추세를 깨면 긴 신호를 생성합니다. 마찬가지로 MACD 히스토그램이 긍정적에서 부정으로 변경되어 신호선을 넘어지고 종료 가격이 이동 평균의 하향 추세를 넘어지면 짧은 신호를 생성합니다.

특히 이 전략의 긴 입시 신호를 결정하는 조건은 다음과 같습니다.

  1. MACD 히스토그램은 양수입니다.
  2. 현재 히스토그램 바는 이전 바보다 높습니다.
  3. 종료 가격은 이동 평균보다 높습니다.
  4. 폐업 가격은 최근 3K 라인의 최고 가격보다 높습니다.

단기 입력 신호를 결정하는 조건은 정반대의 것입니다.

일단 포지션이 열리면 다음 K 라인이 닫히면 무조건적으로 닫습니다. 이 전략은 트렌드 폭발의 시작점을 포착하는 것을 목표로 수익을 취하거나 손실을 멈추는 지점을 설정하지 않습니다.

이점 분석

이 전략은 가격 및 동력 지표를 결합하여 트렌드 반전의 시기를 더 정확하게 결정하고 높은 승률을 나타냅니다. 다음 K 라인에서의 무조건적인 폐쇄 방법은 반전이 실패한 후 다시 손실을 효과적으로 피할 수 있습니다.

수익을 취하고 손해를 멈추는 것은 높은 수익을 추구하는 투자자의 요구를 충족시키지 못합니다.

위험 분석

스톱 로스의 부재는 손해 고정 및 손실의 위험이 높아질 수 있습니다. 반전 신호가 실패하면 시간 내에 손실을 멈추지 못하기 때문에 손실이 증가 할 수 있습니다.

다음 K 라인에서의 무조건적인 폐쇄 방식은 트렌드 이윤을 지속적으로 포착하는 것을 어렵게 만듭니다.

최적화 제안

손실 위험을 줄이기 위해 높은 이윤의 돌파구 구매를 기반으로 적절한 스톱 로스 전략을 추가하는 것을 고려할 수 있습니다.

또한, 트렌드 이윤을 지속적으로 포착하기 위해 폐쇄 후 포지션을 다시 입력하기 위해 고급 기술을 결합하는 것이 가능합니다.

요약

일반적으로 이 전략은 공격적인 고위험 전략에 속한다. 스톱 로스 설정이 없기 때문에 투자자는 손실의 더 큰 위험을 감수해야 한다. 그러나 반전이 성공하면, 처음부터 전체 롯으로 포지션을 개설하는 기회도 높은 수익을 가져올 수 있다. 상대적으로 강한 심리적 내구성을 가진 공격적인 투자자에게 적합하다.


/*backtest
start: 2023-01-31 00:00:00
end: 2024-01-13 05:20: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/
// © SoftKill21

//@version=4
strategy("XAG strategy 1h",overlay=true)
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
var gica = 0
var marcel = gica+2
 //monday and session 
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2020, title = "To Year", minval = 1970)

startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
len = input(10, minval=1, title="Length")
src = input(close, title="Source")
out = sma(src, len)

//distanta = input(1.004)

fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false)
sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false)
// Plot colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00
// Calculating
fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)
slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)
hist = macd - signal

option1=input(true)
option2=input(true)

long2 =  close > open  and time_cond and close > out and hist > 0 and hist > hist[1] 
short2 =  close < open  and time_cond and close < out and hist < 0 and hist < hist[1] 

long1 = (close > open ) and time_cond and close > out and hist > 0 and  hist > hist[1] and high > high[1] and high[1] > high[2] and close > high[1] and close > high[2] and close > high[3] 
short1 = (close < open)  and time_cond and close < out and hist < 0 and  hist < hist[1] and low < low[1] and low[1] < low[2]  and close < low[1] and close < low[2] and close < low[3] 

if(option1)
    strategy.entry("long",1,when= short1)
    strategy.entry("short",0,when=long1)
    strategy.close_all()

if(option2)

    strategy.entry("long",1,when= short2)
    strategy.entry("short",0,when=long2)
    strategy.close_all()

// if(strategy.openprofit < 0)
//     strategy.close_all()
// if(strategy.openprofit>0)
//     strategy.close("long",when = close < open )
//     strategy.close("short",when = close > open)
//     strategy.close("long",when= close < open)
//     strategy.close("short",when= close> open)


// tp = input(0.0003)
// sl = input(0.005)
// strategy.exit("closelong", "long" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closelong")
// strategy.exit("closeshort", "short" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closeshort")


더 많은