
이 전략은 가격 통로 지표에 기반하여 동력 파라미터를 설정하여 다양한 주기의 최고 가격과 최저 가격의 평균을 계산하여 가격 통로 중선을 형성합니다. 이를 기준으로 긴 선과 짧은 선을 설정합니다. 가격이 긴 선을 돌파 할 때, 더 많은 것을하십시오. 가격이 짧은 선을 돌파 할 때, 공백을하십시오. 평준 상태는 가격의 통로 중선으로 돌아갑니다.
이 전략은 가격 통로 지표를 사용하여 다양한 주기 동안의 최고 가격과 최저 가격의 평균을 계산하여 가격 통로 중선을 형성한다. 중선을 기준으로, Shift 파라미터를 통해 긴 선과 짧은 선을 설정한다. 구체적으로, 긴 선의 계산 공식은: 중선 + ((중선 × 긴 선 파라미트%); 짧은 선의 계산 공식은: 중선 + ((중선 × 짧은 선 파라미트%) 이다.
가격이 긴 선보다 낮을 때, 제한 가격 단편을 사용하여 여러 주문을 열고; 가격이 짧은 선보다 높을 때, 제한 가격 단편을 사용하여 여러 주문을 열고. 다중 공중선에서 손실을 막는 방법은 가격 회귀 채널 중선이다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
최적화 변수, 중지 주문, 또는 다른 지표 판단과 결합하여 위와 같은 위험을 줄일 수 있습니다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
이 전략은 가격 통로 지표 설계 아이디어에 기반하고, 포지션 개척을 사용하여 위험을 효과적으로 제어할 수 있다. 그러나 또한 파라미터 최적화 공간이 넓고, 손해 차단 장치가 개선되어야 하는 문제 등이 있다.
/*backtest
start: 2022-11-29 00:00:00
end: 2023-12-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=3
strategy(title = "Noro's PCMA Strategy v1.0", shorttitle = "PCMA 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 = "Lot, %")
per = input(3, title = "Length")
shortlevel = input(10.0, title = "Short line (red)")
longlevel = input(-5.0, title = "Long line (lime)")
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")
//Price Channel
h = highest(high, per)
l = lowest(low, per)
c = (h + l) / 2
ll = c + ((c / 100) * longlevel)
sl = c + ((c / 100) * shortlevel)
//Lines
shortcolor = needshort ? red : na
longcolor = needlong ? lime : na
plot(sl, linewidth = 2, color = shortcolor, title = "Short line")
plot(c, linewidth = 2, color = blue, title = "SMA line")
plot(ll, linewidth = 2, color = longcolor, title = "Long line")
//Trading
size = strategy.position_size
lot = 0.0
lot := size == 0 ? strategy.equity / close * capital / 100 : lot[1]
if (not na(close[per])) and size == 0 and needlong
strategy.entry("L", strategy.long, lot, limit = ll, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if (not na(close[per])) and size == 0 and needshort
strategy.entry("S", strategy.short, lot, limit = sl, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if (not na(close[per])) and size > 0
strategy.entry("Close", strategy.short, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if (not na(close[per])) and size < 0
strategy.entry("Close", strategy.long, 0, limit = c, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59)
strategy.close_all()