양적 돌파구 상승 추세 참조 전략

저자:차오장, 날짜: 2024-02-21 10:58:01
태그:

img

전반적인 설명

이 전략은 단순한 이동 평균선으로 트렌드 방향을 결정하고 저항선과 지지선과 함께 돌파 신호를 형성하는 것을 기반으로 한 장기 보유 전략이다. 가격 피보트 하이 및 피보트 로프 포인트를 계산하여 저항선과 지지선을 그래프화하여 가격이 저항선을 넘어서면 긴 거리로 이동하고 가격이 지지선을 넘어서면 포지션을 닫는다. 이 전략은 명백한 트렌드를 가진 주식에게 적합하며 좋은 리스크-어워드 비율을 얻을 수 있다.

전략 원칙

  1. 트렌드를 결정하기 위한 기본선으로 20일 간 간편 이동평균을 계산합니다.
  2. 사용자 입력 매개 변수에 기초하여 피보트 높은 점과 피보트 낮은 점을 계산
  3. 피보트 높은 점과 피보트 낮은 점에 기초하여 저항 및 지원 라인을 그래프
  4. 닫기 가격이 저항 라인보다 높을 때 길게 이동
  5. 지지선이 저항선을 넘을 때 포지션을 닫습니다.

이 전략은 전체 트렌드 방향을 결정하기 위해 간단한 이동 평균을 사용하고, 주요 포인트의 돌파구를 사용하여 거래 신호를 생성합니다. 이는 전형적인 브레이크아웃 전략입니다. 주요 포인트와 트렌드를 판단함으로써 잘못된 브레이크아웃을 효과적으로 필터링 할 수 있습니다.

이점 분석

  1. 이 전략은 충분한 기회를 가지고 있으며 높은 변동성 주식에 적합하며 추세를 쉽게 파악합니다.
  2. 긴 포지션에 대한 좋은 위험 통제, 높은 위험/이익 비율
  3. 허위 유출의 위험을 피하기 위해 돌파 신호를 사용
  4. 커스터마이징 가능한 매개 변수, 높은 적응력

위험 분석

  1. 매개 변수 최적화에 의존, 잘못된 매개 변수는 거짓 파업의 가능성을 증가시킬 것입니다
  2. 신호가 늦어지면 기회를 놓칠 수도 있습니다.
  3. 변동적 인 시장에서 쉽게 멈출 수 있습니다
  4. 지원 라인을 적시에 조정하지 않으면 손실이 발생할 수 있습니다.

리스크는 라이브 트레이딩을 통해 매개 변수를 최적화하고 스톱 로스/프로피트 전략을 적용함으로써 줄일 수 있습니다.

최적화 방향

  1. 이동 평균 기간 매개 변수를 최적화
  2. 저항 및 지원 라인 매개 변수를 최적화
  3. 스톱 로스/프로프트 취득 전략을 추가합니다.
  4. 돌파구 확인 메커니즘을 강화
  5. 거래량 및 다른 지표와 함께 신호를 필터

요약

전체적으로, 이 전략은 트렌드 트레이더에 적합한 매개 변수 최적화와 유동성에 의존하는 전형적인 브레이크아웃 전략이다. 참조 프레임워크로서, 스톱 로스/프로프트 취득, 신호 필터링과 같은 메커니즘을 추가하여 위험을 줄이고 안정성을 향상시키는 실제 필요에 따라 확장될 수 있다.


/*backtest
start: 2023-02-14 00:00:00
end: 2024-02-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/
// © CheatCode1

//@version=5
strategy("Quantitative Trend Strategy- Uptrend long", 'Steady Uptrend Strategy', overlay=true, initial_capital = 1500, default_qty_value = 100, commission_type = strategy.commission.percent, commission_value = 0.01, default_qty_type = strategy.percent_of_equity)


length = input.int(20, minval=1)
src = input(close, title="Source")
basis = ta.sma(src, length)
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(basis, "Basis", color=#FF6D00, offset = offset)

inp1 = input.int(46, 'LookbackLeft')
inp2 = input.int(32, 'LookbackRight')

l1 = ta.pivothigh(close, inp1, inp2)
S1 = ta.pivotlow(close, inp1, inp2)

// plot(l1, 'Pivothigh', color.red, 1)
// // plot(S1, 'Pivot Low', color.red)

l1V = ta.valuewhen(l1, close, 0)
S1V = ta.valuewhen(S1, close, 0)

Plotl1 = not na(l1) ? l1V : na
PlotS1 = not na(S1) ? S1V : na

plot(Plotl1, 'Resistance', color.green, 1, plot.style_stepline, true)
plot(PlotS1, 'Support', color.red, 1, plot.style_stepline, true)

Priceforlong = close > l1V ? true : na
Priceforshort = close < S1V ? true : na

plotshape(Priceforlong ? high : na, 'p', shape.arrowup, location.abovebar, color.green, size = size.small)
plotshape(Priceforshort ? low : na, 's', shape.arrowdown, location.belowbar, color.red, size = size.small)

vol = volume
volma = ta.sma(vol, 20)

Plotl1C = ta.valuewhen(na(Plotl1), l1V, 0)
PlotS1C = ta.valuewhen(na(PlotS1), S1V, 0)
//Strategy Execution
volc = volume > volma 

Lc1 = Priceforlong 

Sc1 = Priceforshort

sL = Plotl1 < PlotS1 ? close : na
sS = PlotS1 > Plotl1 ? close : na


if Lc1 
    strategy.entry('Long', strategy.long)
// if Sc1 and C2
//     strategy.entry('Short', strategy.short)

if Priceforshort
    strategy.cancel('Long')
if Priceforlong   
    strategy.cancel('Short')


// Stp1 = ta.crossover(k, d)
// Ltp1 = ta.crossunder(k, d)
// Ltp = d > 70  ? Ltp1 : na
// Stp = d < 30  ? Stp1 : na


if strategy.openprofit >= 0 and sL
    strategy.close('Long')
if strategy.openprofit >= 0 and sS
    strategy.close('Short')
takeP = input.float(2, title='Take Profit') / 100
stopL = input.float(1.75, title='Stop Loss') / 100


// // Pre Directionality

Stop_L = strategy.position_avg_price * (1 - stopL)

Stop_S = strategy.position_avg_price * (1 + stopL)

Take_S= strategy.position_avg_price * (1 - takeP)

Take_L = strategy.position_avg_price * (1 + takeP)
     
// sL = Plotl1 < PlotS1 ? close : na
// sS = PlotS1 < Plotl1 ? close : na
     
// //Post Excecution
if strategy.position_size > 0 and not (Lc1)
    strategy.exit("Close Long", stop = Stop_L, limit = Take_L)

if strategy.position_size < 0 and not (Sc1)
    strategy.exit("Close Short", stop = Stop_S, limit = Take_S)

더 많은