
이 글은 백분율 하락을 기반으로 한 양적 거래 전략을 소개한다. 이 전략은 백분율 하락을 설정하고 적절한 시간 주기를 선택하여 구매와 판매의 시기를 결정한다. 가격이 이전 종결 가격에 비해 상승하거나 감소하면 지정된 백분율 하락을 초과하면 구매 또는 판매 신호를 유발한다. 이 전략은 사용자의 위험 선호와 시장 상황에 따라 유연하게 조정될 수 있으며, 다양한 금융 도구의 거래에 적용된다.
이 전략의 핵심은 가격의 변화의 비율에 따라 거래 신호를 생성하는 것입니다. 첫째, 사용자는 가격의 이전 종결 가격에 대한 변화의 정도를 나타내는 백분율 적자를 설정해야합니다. 또한 사용자는 1 분, 1 시간, 1 일과 같은 시간 주기도 선택해야합니다. 그 기간의 최고 가격, 최저 가격 및 종결 가격을 계산하기 위해. 전략은 실시간으로 시장 가격을 모니터링하고, 현재 시간 주기 최고 가격이 이전 종결 가격을 초과하면 구매 신호를 유발합니다. 현재 시간 주기 최저 가격이 이전 종결 가격을 초과하면 판매 신호를 유발합니다.
이 글은 백분율 하락에 기반한 정량 거래 전략으로, 가격 변화의 백분율 하락과 시간 주기 를 설정하여 자동으로 구매 및 판매 신호를 생성한다. 이 전략은 작동이 간단하고, 유연성이 강하며, 적용 범위가 넓지만, 동시에 시장의 변동, 파라미터 설정 및 과다조치 등의 위험에 직면한다. 중지 중지 장치, 동적으로 파라미터를 조정하고 다른 기술 지표와 결합하여 전략의 성능을 더욱 최적화하여 실제 거래에서의 효과를 높일 수 있다.
/*backtest
start: 2023-05-28 00:00:00
end: 2024-06-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("GBS Percentage", overlay=true)
// Define input options for percentage settings and timeframe
percentage = input.float(1.04, title="Percentage Threshold", minval=0.01, step=0.01) / 100
timeframe = input.timeframe("D", title="Timeframe", options=["1", "3", "5", "15", "30", "60", "240", "D", "W", "M"])
// Calculate high, low, and close of the selected timeframe
high_timeframe = request.security(syminfo.tickerid, timeframe, high)
low_timeframe = request.security(syminfo.tickerid, timeframe, low)
close_timeframe = request.security(syminfo.tickerid, timeframe, close)
// Calculate the percentage threshold based on the previous close
threshold = close_timeframe[1] * percentage
// Define conditions for Buy and Sell
buyCondition = high_timeframe > (close_timeframe[1] + threshold)
sellCondition = low_timeframe < (close_timeframe[1] - threshold)
// Entry and exit rules
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Close the positions based on the conditions
if (sellCondition)
strategy.close("Buy")
if (buyCondition)
strategy.close("Sell")
// Plot Buy and Sell signals on the chart
plotshape(series=buyCondition, title="Buy Entry", color=color.green, style=shape.triangleup, location=location.belowbar)
plotshape(series=sellCondition, title="Sell Entry", color=color.red, style=shape.triangledown, location=location.abovebar)
// Plot the equity curve of the strategy
plot(strategy.equity, title="Equity", color=color.blue, linewidth=2)