
이 전략은 축축점의 돌파구를 기반으로 반전 거래를 한다. 이 전략은 지정된 주기의 최고 가격과 최저 가격을 계산하여 축축점의 고점과 축축점의 낮점을 결정한다. 가격이 축축점의 고점을 초과할 때, 공백하고, 가격이 축축점의 낮점보다 낮을 때, 더 많이 한다. 이것은 전형적인 짧은 선 반전 전략이다.
이 전략의 핵심 논리는 축축 고점과 축축 저점을 계산하는 것이다. 축축 고점과 축축 저점의 계산 공식은 다음과 같다:
축 높점 = 가장 최근의 N1 루트 K 선의 최고 값의 합 / N1
축 하위점 = 가장 최근의 N2 루트 K 선의 최저값의 합 / N2
이 중 N1과 N2는 축점 계산에 필요한 K선 수를 나타내는 두 개의 파라미터로 설정할 수 있다.
축의 높고 낮은 점을 계산한 후, 전략은 거래를 할 수 있다. 구체적인 거래 규칙은 다음과 같다:
그래서, 그것은 축점 돌파를 기반으로 한 단선 반전 전략을 구현했습니다.
이것은 매우 간단한 역전략이며 다음과 같은 장점이 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
이러한 위험을 조절할 수 있는 방법은 파라미터를 조정하고, 탈락 전략을 설정하는 것이다.
이 전략은 여전히 최적화할 수 있는 여지가 있습니다:
이 전략은 매우 간단한 단선 축 역전 전략이다. 그것의 장점은 간단하고 이해하기 쉽고, 빈번한 거래에 적합하며, 역전 상황을 포착할 수 있다는 것이다. 그러나 또한 위험이 있으며, 위험을 줄이기 위해 추가적으로 최적화 할 필요가 있다.
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Pivot Reversal Strategy - FIGS & DATES 2.0", overlay=true, pyramiding=0, initial_capital=10000, currency="USD", default_qty_type=strategy.percent_of_equity, default_qty_value=100.0, commission_value=0.075)
leftBars = input(4)
rightBars = input(2)
// backtesting date range
from_day = input(defval=1, title="From Day", minval=1, maxval=31)
from_month = input(defval=1, title="From Month", minval=1, maxval=12)
from_year = input(defval=2018, title="From Year", minval=1900)
to_day = input(defval=1, title="To Day", minval=1, maxval=31)
to_month = input(defval=1, title="To Month", minval=1, maxval=12)
to_year = input(defval=9999, title="To Year", minval=1900)
time_cond = true
swh = pivothigh(leftBars, rightBars)
swl = pivotlow(leftBars, rightBars)
middle = (swh+swl)/2
swh_cond = not na(swh)
hprice = 0.0
hprice := swh_cond ? swh : hprice[1]
le = false
le := swh_cond ? true : le[1] and high > hprice ? false : le[1]
if le and time_cond
strategy.entry("LONG", strategy.long, comment="LONG", stop=hprice + syminfo.mintick)
swl_cond = not na(swl)
lprice = 0.0
lprice := swl_cond ? swl : lprice[1]
se = false
se := swl_cond ? true : se[1] and low < lprice ? false : se[1]
if se and time_cond
strategy.entry("SHORT", strategy.short, comment="SHORT", stop=lprice - syminfo.mintick)
//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)