동력 이동 평균 지속 장기 거래 전략

저자:차오장, 날짜: 2023-09-12 16:15:44
태그:

이 전략은 지속적인 추진력 동안 지속적인 이동 평균 상승 추세를 관찰하여 계속적으로 황소 행진의 추진력을 타는 것을 목표로 장기 거래를합니다. 상승 동력을 포착하는 데 초점을 맞춘 트렌드 다음 전략입니다.

전략 논리:

  1. 가격 동력을 반영하기 위해 가중화 이동 평균을 계산합니다.

  2. 가중화 이동 평균이 5일 동안 지속적으로 상승할 때 긴 값을 입력합니다.

  3. 가중화 이동 평균이 4일 연속 하락할 때 긴 출구

  4. 지속적인 상승 추세는 단기적인 반전을 필터링합니다.

  5. 최대 주당 손실을 제한하기 위해 최대 스톱 손실을 설정합니다.

장점:

  1. 상승 동력을 추적하면 뜨거운 트렌드를 유지할 수 있습니다.

  2. 끈기 필터는 짧은 통합을 생략합니다.

  3. 최대 스톱 손실은 꼬리 위험을 방어합니다.

위험성:

  1. 지속적인 상승 추세로 인한 손실 제한이 없습니다.

  2. 깊은 교정으로 큰 손실이 발생할 수 있습니다.

  3. 너무 넓은 스톱은 큰 손실의 위험을 초래합니다.

요약하자면, 이 전략은 지속적인 상승 추세를 파악하고 뜨거운 추세로부터 이익을 얻는 후에도 추진력을 계속 거래합니다. 그러나 깊은 인하 위험이 남아있어 정형된 정지 및 신중한 위험 관리가 필요합니다.


/*backtest
start: 2023-01-01 00:00:00
end: 2023-09-11 00:00:00
period: 3d
basePeriod: 1d
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("My Script", initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent , commission_value=0.1 )


var candela = 0.0


candela := (high+low+open+close)/4

long = candela > candela[1] and candela[1] > candela[2] and candela[2] > candela[3] and candela[3] > candela[4] and candela[4] > candela[5]
short = candela< candela[1] and candela[1] < candela[2] and candela[2] < candela[3] and candela[3] < candela[4] //and candela[4] < candela[5] 

plot(candela, color=long? color.green : short? color.red : color.white ,linewidth=4)



strategy.entry("long",1,when=long)
//strategy.entry('short',0,when=short)
    
strategy.close("long", when = short)

risk= input(25)
// strategy.risk.max_intraday_loss(risk, strategy.percent_of_equity)
//strategy.close("short", when = not long or short)


더 많은