모닝스타 K라인 돌파전략


생성 날짜: 2023-09-14 16:36:32 마지막으로 수정됨: 2023-09-14 16:36:32
복사: 0 클릭수: 647
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

전략 원칙

이 전략은 새벽 K 선 형태를 이용하여 다방향으로 하는 트렌드 추적 거래를 한다. 주요 거래 신호는 새벽 K 선이 평균선을 뚫는 지점으로부터 온다.

거래 논리는 다음과 같습니다.

  1. 60일 지수 이동 평균 EMA60

  2. 새벽 K선 형태를 판단하기 위해, 첫 번째 음선, 두 번째 십자선 또는 봉쇄선, 세 번째 양선과 앞의 두 K선 최고점

  3. 다중자 신호는 새벽별 라인 형태로 EMA60 위쪽에 있을 때 돌파점 위치

  4. 목표 수익을 설정하거나 탈퇴 전략으로 스톱로스를 추적합니다.

  5. 스톱 손실은 지난 100 K 라인 최저점으로 설정

  6. 조정 가능한 새벽별선 용량 제한 등 파라미터

이 전략은 아침 별 선의 트렌드 회전 특성을 최대한 활용하여 트렌드 방향에 맞추어 추적한다. 높은 변동성 시장에서 더 좋은 효과를 얻을 수 있다.

전략적 이점

  • 오전자선은 단기 트렌드 반향을 판단하는데 효과적이다.

  • 브레이크 포인트 엔트리 및 트래킹 스톱로즈, 트렌드를 계속 추적

  • 회귀 창을 설정하여 과도한 상실을 방지합니다.

전략적 위험

  • 매개 변수 설정은 반복 테스트 최적화 필요

  • 너무 근접한 정전으로 인해 너무 자주 정전될 수 있다.

  • “이런 일이 벌어진다면, 우리는 더 나은 삶을 살 수 있을 것입니다”.

요약하다

이 전략은 새벽의 K선 특성을 인식하고, 동향 방향에 맞추어 추적한다. 파라미터를 조정하여 다른 시장 상황에 적응할 수 있다. 그러나 단지 더 많은 일을 하고, 손실을 멈추는 설정은 신중한 평가가 필요하다.

전략 소스 코드
/*backtest
start: 2023-01-01 00:00:00
end: 2023-03-23 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
// © TheSocialCryptoClub
// Author: @devil_machine

//@version=5
strategy("PURE MORNING 2.0", overlay=true, pyramiding=1,
         initial_capital=10000, 
         default_qty_type=strategy.percent_of_equity, default_qty_value=10,
         slippage=1,backtest_fill_limits_assumption=1,use_bar_magnifier= true,
         commission_type=strategy.commission.percent, commission_value=0.075
         )

//------------------------------
// Indicators
//------------------------------

rma=ta.rma(close, 60)
mfi=ta.mfi(close, 10)
rsi=ta.rsi(close, 14)
atr7= ta.atr(7)
ema60=ta.ema(close,60)

plot(ema60,"EMA 60", color.new(color.aqua,0))

//------------------------------
// Doji settings 
//------------------------------
//-----------------------------------------------MORNING DOJI STAR CODE
range1= high - low
tolerance = input.float(defval=0.09, title="MDS Tolerance",group= "DOJI SETTINGS", minval=0.01, maxval=1, step=0.01)/100

candle1 = math.abs (close[2] - open[2]) /range1[2] > .6 and close[2] < open[2]
candle2 = ((open[1] > close[1] and open[1] < close[1]*(1+tolerance)) or (open[1] < close[1] and open[1] > close[1]*(1-tolerance)) and close [1]<close[2]+range1[2])
candle3 = close > open and close > (close[2]+range1[2])

MDS = candle1 and candle2 and candle3

plotshape (MDS and close > ema60, text="MD", textcolor=color.yellow, offset=-1, location=location.abovebar, color=color.green, style=shape.triangleup)
plotshape (MDS and close < ema60, text="MD", textcolor=color.olive, offset=-1, location=location.belowbar, color=color.red, style=shape.triangledown)

//------------------------------------------------DOJI CODE

tolerance1= input.float(defval=0.05, title="DOJI Tolerance",group= "DOJI SETTINGS", minval=0.01, maxval=1, step=0.01)/100
Is_OC_Equal= (open > close and open < close*(1+tolerance1)) or (open < close and open > close*(1-tolerance1))

plotshape(Is_OC_Equal and close < ema60, text="D", textcolor=color.red, location=location.belowbar, color=color.red)
plotshape(Is_OC_Equal and close > ema60, text="D", textcolor = color.green, location=location.abovebar, color=color.green)

//------------------------------
// Filter
//------------------------------

xl_tp_percent      = input.float(9,step=0.5, title="Take Profit", group="EXIT LONG") 

sl_type_ll         = input.bool(true, "SL type Lowest Low", group="EXIT LONG")
sl_len             = input.int(100, "Stop Length", group="EXIT LONG")

max_loss_filter    = input.bool(false,"Max Loss Filter", group ="Filter")
filter_percent     = input.int(10, "Max Loss %", group="Filter")

sl_type_percent    = input.bool(false, "SL type Percent", group="EXIT LONG")
xl_sl_percent      = input.float(2,step=.5, title="Stop Loss", group="EXIT LONG") 

filter_stop= max_loss_filter == true ? close - ta.lowest (low, sl_len) < (close*filter_percent)/100 : true

if sl_type_percent == true 
    sl_type_ll := false

//------------------------------
// Entry Long
//------------------------------

el_cond = Is_OC_Equal and close > ta.ema(close, 60) and filter_stop
el_cond_02 = MDS and close > ta.ema(close, 60) and filter_stop

mess = "!buy " + syminfo.ticker // Executor command to buy automatically 

if el_cond 
    strategy.entry ("EL", strategy.long, alert_message = mess,comment = "EL cond 1")

plotshape(el_cond and strategy.position_size == 0, "el_long", shape.circle, color=color.green)

if el_cond_02       
    strategy.entry ("EL", strategy.long, alert_message = mess,comment = "EL cond 2" )

plotshape(el_cond_02 and strategy.position_size == 0, "el_long_02", shape.circle, color=color.green)

//------------------------------
//Exit Long TP - SL
//------------------------------

xl_sl_price = strategy.position_avg_price * (1-xl_sl_percent/100)
xl_tp_price = strategy.position_avg_price * (1+xl_tp_percent/100)

if sl_type_ll == true
    xl_sl_price := ta.lowest (low, sl_len) 

//------------------------------
//Trailing stop 
//------------------------------

xl_ts_percent      = input.float(1,   step=0.5, title= "Trailing theshold", group="TRAILING STOP")
xl_to_percent      = input.float(0.5, step=0.5, title= "Trailing offset",   group="TRAILING STOP")

xl_ts_tick = xl_ts_percent * close/syminfo.mintick/100
xl_to_tick = xl_to_percent * close/syminfo.mintick/100

mess_sell = "!sell " + syminfo.ticker // Executor command to sell automatically 

strategy.exit("XL+SL/TP", "EL", stop=xl_sl_price, limit=xl_tp_price, trail_points=xl_ts_tick, trail_offset=xl_to_tick,comment_loss= "STOP", comment_profit = "PROFIT",comment_trailing = "TS", alert_message = mess_sell)

//------------------------------
// Conditional close on MFI
//------------------------------

xl_cond= ta.crossover(mfi, 90)

if xl_cond
    strategy.close("XL", alert_message = mess_sell)

plotshape(xl_cond, "xl_cond", shape.circle, color=color.red)