
닫힌 선 전략은 K 선 형태를 기반으로 한 양적 거래 전략이다. 이 전략은 닫힌 선 선 형태를 식별하여 구매/판매 신호를 찾는다.
이 전략의 핵심 원칙은: 현재 K 선은 음선이고, 전 K 선은 양선이며, 현재 K 선의 최저가격이 전 K 선의 최저가격보다 높을 때, 현재 K 선의 최고가격이 전 K 선의 최고가격보다 낮을 때, ?? 닫힌 양선 ?? 형태를 발생시킨다. 이것은 가격이 폐쇄된 상승 공간을 형성했다는 것을 의미하며, 다중의 힘이 곧 소모될 것을 보여준다. 이것은 판매 신호이다. 반대로, ?? 닫힌 음선 ?? 이 형성될 때, 구매 신호를 발생시킨다.
여기서 K선 개체의 평균값을 스톱라인으로 사용한다. 개체가 스톱라인 절반보다 크면 스톱라인이다.
폐쇄적 전략의 장점은 다음과 같습니다.
하지만, 폐쇄적인 전략에는 몇 가지 위험도 있습니다.
이러한 위험을 줄이기 위해, 거래량 조건 판단을 추가하거나, 이동 평균과 같은 다른 지표와 결합하여 시장 움직임을 종합적으로 판단하는 것을 고려할 수 있습니다. 스톱 손실 라인은 시장의 변동 정도에 따라 동적으로 조정 될 수 있습니다.
폐쇄적 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.
폐쇄선 전략은 K선 형태를 기반으로 한 정량화 전략으로서, 단순하고 이해하기 쉽고 구현할 수 있으며, 특정 구매 신호를 효과적으로 식별할 수 있다는 장점이 있다. 그러나 오류 신호를 발생하기 쉬운, 맹목적 인 등과 같은 몇 가지 제한이 있다. 이러한 문제 또한 이 전략에 최적화 방향을 제공한다. 거래량, 다중 주기 분석 및 기타 기술 지표와 같은 정보를 사용하여 통합 판단을 함으로써 이 전략의 효과를 더욱 강화할 수 있다.
/*backtest
start: 2023-11-20 00:00:00
end: 2023-11-27 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=3
strategy(title = "Noro's Harami Strategy v1.0", shorttitle = "Harami str 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(false, defval = false, title = "Short")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
//Body
body = abs(close - open)
abody = sma(body, 10)
//MinMax Bars
min = min(close, open)
max = max(close, open)
bar = close > open ? 1 : close < open ? -1 : 0
//Signals
up = bar == 1 and bar[1] == -1 and min > min[1] and max < max[1]
dn = bar == -1 and bar[1] == 1 and min > min[1] and max < max[1]
exit = ((strategy.position_size > 0 and bar == 1) or (strategy.position_size < 0 and bar == -1)) and body > abody / 2
//Trading
if up
if strategy.position_size < 0
strategy.close_all()
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
strategy.close_all()