이 전략은 가격의 돌파구를 기반으로 거래 작업을 수행한다. 그것은 일정 주기 동안의 최고 가격과 최저 가격을 계산하고, 가격이 이러한 극한을 돌파할 때 거래 신호를 발생시킨다.
최근 N주기의 최고 가격upex와 최저 가격dnex를 계산한다.
가격이 에크스 (upex) 를 넘어서면 더 많이 해야 한다.
가격이 dnex보다 낮으면 공백을 다.
다만, 다만 또는 양방향 거래로 구성할 수 있다.
투입 가능한 자금 사용률
거래 시간 범위를 설정할 수 있습니다
이 전략은 가격 돌파 신호를 포착하여 트렌드 팔로잉을 구현한다. 돌파 검증 메커니즘과 파라미터 설정을 최적화하면 효과를 높일 수 있다. 그러나 가짜 돌파를 방지하고 위험을 통제하는 것에 주의를 기울여야 한다. 전체적으로 이 전략은 간단하고 효과적인 트렌드 거래 솔루션을 제공한다.
/*backtest
start: 2023-09-18 00:00:00
end: 2023-09-20 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy(title = "Noro's Brakeout Strategy v1.0", shorttitle = "Brakeout 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(true, defval = true, title = "Short")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")
len = input(4, defval = 4, minval = 1, maxval = 1000, title = "Length")
showlines = input(true, defval = true, title = "Show Lines?")
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")
//Extremums
upex = highest(high, len)
dnex = lowest(low, len)
col = showlines ? blue : na
plot(upex, color = col, linewidth = 2)
plot(dnex, color = col, linewidth = 2)
//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 : lot[1]
if (not na(close[len]))
strategy.entry("Long", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)), stop = upex + syminfo.mintick)
strategy.entry("Short", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)), stop = dnex - syminfo.mintick)
if time > timestamp(toyear, tomonth, today, 23, 59)
strategy.close_all()