ATR 스톱 로스 이치모쿠 키준 브레이크업 전략

저자:차오장, 날짜: 2023-09-14 20:06:11
태그:

이 문서에서는 정지 손실을 위해 ATR와 진입을 위해 Kijun-Sen 브레이크오웃을 사용하는 양적 거래 전략을 상세히 설명하고, 거래 위험을 제어하기 위해 윌리엄스 %R 지표를 사용하여 추가 신호 검증을 제공합니다.

I. 전략 논리

이 전략의 핵심 지표는 다음과 같습니다.

  1. ATR는 시장 변동성을 역동적으로 반영하는 스톱 로스 지표입니다.

  2. 이치모쿠 키준-센 라인에서 트렌드 방향을 결정하고 진입 신호를 제공합니다.

  3. 잘못된 입력 피하기 위해 추가 신호 검증을 위해 윌리엄 %R.

구체적인 무역 논리는 다음과 같습니다.

가격이 Kijun-Sen 라인의 아래로 넘어지고 다시 회복될 때 긴 포지션을 취합니다. 가격이 라인의 위로 넘어지고 다시 아래로 떨어질 때 짧은 포지션을 취합니다. 이것은 트렌드를 따르도록합니다.

동시에, Williams %R가 방향에 동의하는지 확인합니다. 그렇지 않으면 입력을 건너뛰십시오. 이것은 잘못된 신호를 필터링합니다.

각 항목에 대한 ATR 계산 수준에 Stop Loss를 설정하십시오. ATR은 시장 변동성을 동적으로 반영하여 합리적인 Stop Loss 크기를 가능하게합니다.

스톱 로스 또는 영업 영업이 시작되면 수익을 위해 포지션을 닫습니다.

II. 전략의 장점

이 전략의 주요 장점은 다음과 같습니다.

첫째, ATR 스톱 로스는 시장의 변동성에 따라 위험 통제를 설정하여 큰 손실을 효과적으로 피합니다.

둘째, 윌리엄스 %R 검증과 함께 Kijun-Sen 항목은 신호 품질을 향상시킵니다.

마지막으로, 스톱 로스 및 수익 설정은 또한 각 거래에 대한 리스크 보상도 정의합니다.

III. 잠재적인 약점

그러나 다음과 같은 위험도 고려해야합니다.

첫째, 키-센 신호는 트렌드 전환 중에 지연할 수 있으며, 시간에 반응하지 않을 수 있습니다.

두 번째로, 너무 공격적으로 스톱 로스를 설정하면 조기 중단될 위험이 있습니다.

마지막으로, 부적절한 매개 변수 최적화 또한 과장 문제로 이어질 수 있습니다.

IV. 요약

요약하자면, 이 기사는 스톱 로스 (Stop Loss) 를 위해 ATR과 엔트리 신호를 위해 Kijun-Sen을 사용하는 양적 거래 전략을 설명했습니다. 그것은 동적 스톱과 신호 필터링을 통해 효과적인 위험 통제를 달성 할 수 있습니다. 그러나 트렌드 전환 및 스톱 로스 무효화와 같은 위험은 예방해야합니다. 전반적으로, 그것은 간단한 효과적 인 트렌드 다음 방법론을 제공합니다.


/*backtest
start: 2023-09-06 00:00:00
end: 2023-09-13 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
// strategy("NNFX ft. ATR, Kijun-Sen, %R","NNFX-2",true,pyramiding=1,calc_on_order_fills=true,calc_on_every_tick=true,initial_capital = 1000, currency="USD",slippage=5,commission_type=strategy.commission.cash_per_contract,commission_value=0.000035)
strategy.initial_capital = 50000    
//INDICATOR---------------------------------------------------------------------    
    //Average True Range (1. RISK)
atr_period = input(14, "Average True Range Period")
atr = atr(atr_period)

    //Ichimoku Cloud - Kijun Sen (2. BASELINE)
ks_period = input(20, "Kijun Sen Period")
kijun_sen = (highest(high,ks_period) + lowest(low,ks_period))/2
base_long = open < kijun_sen and close > kijun_sen
base_short = open > kijun_sen and close < kijun_sen

    //Williams Percent Range (3. Confirmation#1)
use_wpr = input(true,"Use W%R?")
wpr_len = input(1, "Williams % Range Period")
wpr = -100*(highest(high,wpr_len) - close)/(highest(high,wpr_len) - lowest(low,wpr_len))
wpr_up = input(-25, "%R Upper Level")
wpr_low = input(-75, "%R Lower Level")
conf1_long = wpr >= wpr_up
conf1_short = wpr <= wpr_low
if(use_wpr == false)
    conf1_long := true
    conf1_short := true
//TRADE LOGIC-------------------------------------------------------------------
    //Long Entry
    //if -> WPR crosses below -39 AND MACD line is less than signal line
l_en = base_long and conf1_long
    //Long Exit
    //if -> WPR crosses above -14
l_ex = close < kijun_sen
    //Short Entry
    //if -> WPR crosses above -39 AND MACD line is greater than signal line
s_en = base_short and conf1_short
    //Short Exit
    //if -> WPR crosses under -14
s_ex = close > kijun_sen
    
//MONEY MANAGEMENT--------------------------------------------------------------
balance = strategy.netprofit + strategy.initial_capital //current balance
floating = strategy.openprofit          //floating profit/loss
isTwoDigit = input(false,"Is this a 2 digit pair? (JPY, XAU, XPD...")
risk = input(5,"Risk %")/100           //risk % per trade
equity_protector = input(30,"Equity Protection %")/100  //equity protection %
stop = atr*100000*input(1.5,"Average True Range multiplier")    //Stop level
if(isTwoDigit)
    stop := stop/100
target = input(150, "Target TP in Points")  //TP level
    //Calculate current DD and determine if stopout is necessary
equity_stopout = false
if(floating<0 and abs(floating/balance)>equity_protector)
    equity_stopout := true
    
    //Calculate the size of the next trade
temp01 = balance * risk     //Risk in USD
temp02 = temp01/stop        //Risk in lots
temp03 = temp02*100000      //Convert to contracts
size = temp03 - temp03%1000 //Normalize to 1000s (Trade size)
if(size < 1000)
    size := 1000            //Set min. lot size

//TRADE EXECUTION---------------------------------------------------------------
strategy.close_all(equity_stopout)      //Close all trades w/equity protector
is_open = strategy.opentrades > 0

if(true)
    strategy.entry("l_en",true,oca_name="a",when=l_en and not is_open)  //Long entry
    strategy.entry("s_en",false,oca_name="a",when=s_en and not is_open) //Short entry
    
    strategy.exit("S/L","l_en",loss=stop, profit=target)      //Long exit (stop loss)
    strategy.close("l_en",when=l_ex)            //Long exit (exit condition)
    strategy.exit("S/L","s_en",loss=stop, profit=target)      //Short exit (stop loss)
    strategy.close("s_en",when=s_ex)            //Short exit (exit condition)
    
//PLOTTING----------------------------------------------------------------------
plot(kijun_sen,"Kijun-Sen",color.blue,2)

더 많은