
이 전략은 candle의 실물 부분을 기반으로, EMA 지표와 결합하여 시장 추세 방향을 판단하여 ORIGINAL PRIMITIVE TREND TRACKING의 효과를 구현합니다. 큰 선이있을 때 더 많이하고, 큰 선이있을 때 공백을 만들고, 시장 추세를 추적합니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
위험은 다음과 같은 방법으로 줄일 수 있습니다.
이 정책은 다음과 같은 측면에서 최적화될 수 있습니다.
이 전략은 원시적인 간단한 유형의 트렌드 추적 전략에 속한다. 촛불 구조 판단을 통해 트렌드 방향을 효과적으로 추적할 수 있다. 동시에 빠른 스톱 로스 메커니즘을 설정하여 수익을 잠금할 수 있다. 이 전략은 트렌드 추적 포트폴리오를 보완할 수 있지만 위험을 줄이기 위해 여전히 최적화해야 한다.
/*backtest
start: 2023-10-23 00:00:00
end: 2023-11-22 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "Noro's Primitive Strategy v1.0", shorttitle = "Primitive str 1.0", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.0, pyramiding = 10)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usebody = input(true, defval = true, title = "Use body")
useus = input(true, defval = true, title = "Use UUP")
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(01, defval = 01, 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")
//Logic
body = abs(close - open)
sbody = ema(body, 30) / 2
bar = close > open ? 1 : close < open ? -1 : 0
//Signals
up = bar == -1 and (body > sbody or usebody == false) and (close < strategy.position_avg_price or strategy.position_size <= 0 or useus == false)
dn = bar == 1 and (body > sbody or usebody == false) and (close > strategy.position_avg_price or strategy.position_size >= 0 or useus == false)
//Trading
if up
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))
if dn
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 00, 00)))
if time > timestamp(toyear, tomonth, today, 00, 00)
strategy.close_all()