
이 전략은 5분 개시 가격의 상승과 하락을 기반으로 거래 결정을 내리고, 두 단계의 간격 돌파구를 사용하여 다양한 촉발 조건을 설정하여, 충격적인 추세에서 큰 가격 변화를 잡기위한 것입니다.
전략은 매일 2시간 5분 K선 전체의 개시 가격에 기반하여 현재 5분 K선의 상승/하락 비율을 계산하고, 상승/하락이 설정된 1단계 범위를 초과할 때, 그에 따른 구매 또는 판매 결정을 합니다. 동시에 스톱로스 및 스톱 포스트를 설정하여 포지션을 탈퇴합니다.
만약 스톱로스가 트리거되면, 하락이 계속 확대되고 2단계 스프레즈의 트리거 조건을 넘으면, 이전 주문을 취소하고, 2단계 스프레즈 아래의 새로운 구매 또는 판매 명령을 사용하며, 스톱로스와 스톱로스를 계속 추적한다.
두 단계의 간격을 설정함으로써, 흔들리는 상황에서 일부 소음을 필터링 할 수 있으며, 더 큰 가격 변화 때만 거래 할 수 있습니다. 또한 두 번째 단계의 간격을 활성화하면 너무 자주 유발되는 경우를 줄일 수 있습니다.
대책:
이 전략은 2단계 간격 돌파를 통해 가격 변동을 포착하고, 충격적인 상황에서 효과적으로 소음을 필터링한다. 전략 컨셉은 간단하고 명확하며, 파라미터를 최적화하면 더 좋은 효과를 얻을 수 있다. 다음 단계는 트렌드 판단 지표와 결합하여 트렌드 상황에서 전략 우위를 발휘할 수 있다.
/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Auto Entry Bot", overlay=true)
// Define input for the stop loss and take profit levels
stopLossPips = input.int(200, title="Stop Loss Pips", minval=1)
takeProfitPips = input.int(400, title="Take Profit Pips", minval=1)
// Calculate the percentage change from the 5-minute opening candle at 2:00 AM
var float openPrice = na
if (hour == 2 and minute == 0)
openPrice := open
percentageChange = (close - openPrice) / openPrice * 100
// Track the cumulative percentage change
var float cumulativeChange = 0
// Define input for the percentage change trigger
triggerPercentage1 = input.float(0.25, title="Percentage Change Trigger (%)", minval=0.01, step=0.01)
triggerPercentage2 = input.float(0.35, title="Additional Trigger Percentage (%)", minval=0.01, step=0.01)
// Check for price change trigger
if (percentageChange >= triggerPercentage1)
// Sell signal
strategy.entry("Sell", strategy.short)
strategy.exit("ExitSell", loss=stopLossPips, profit=takeProfitPips)
cumulativeChange := 0 // Reset cumulative change after a trade
if (percentageChange <= -triggerPercentage1)
// Buy signal
strategy.entry("Buy", strategy.long)
strategy.exit("ExitBuy", loss=stopLossPips, profit=takeProfitPips)
cumulativeChange := 0 // Reset cumulative change after a trade
// If the price keeps hitting stop loss, activate the second trigger
if (strategy.position_size < 0 and percentageChange <= -triggerPercentage2)
strategy.cancel("Sell") // Cancel previous sell order
strategy.entry("Sell2", strategy.short)
strategy.exit("ExitSell2", loss=stopLossPips, profit=takeProfitPips)
cumulativeChange := 0 // Reset cumulative change after a trade
if (strategy.position_size > 0 and percentageChange >= triggerPercentage2)
strategy.cancel("Buy") // Cancel previous buy order
strategy.entry("Buy2", strategy.long)
strategy.exit("ExitBuy2", loss=stopLossPips, profit=takeProfitPips)
cumulativeChange := 0 // Reset cumulative change after a trade