이 전략은 일정 기간 동안의 변화율을 계산하여 구매와 판매의 시점을 결정한다. 이는 거래자가 단기 가격 변화의 기회를 잡을 수 있도록 도와준다.
이 전략은 주로 다음과 같은 지표들을 기반으로 합니다.
특정 구매 규칙:
구체적인 판매 규칙:
주문 규모는 총권익의 비율로 설정되어 있습니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
전체적으로, 이 전략은 가격 변화율, SMA 지표와 같은 도구를 충분히 활용하여 변동적인 상황에서 더 나은 성과를 얻을 수 있다.
이 전략에는 다음과 같은 위험도 있습니다.
변동률과 SMA 파라미터를 잘못 설정하면 거래 신호가 틀리거나 오류가 발생할 수 있다. 다른 시장에 맞는 파라미터를 조정할 필요가 있다.
주문의 크기가 너무 커지면 위험이 커집니다. 테스트 단계에서 주문 비율을 최적화하는 것이 좋습니다.
추적 스톱 손실은 충격 상황에서 조기 스톱 손실이 발생할 수 있습니다. 스톱 손실의 크기를 조정하는 것을 고려할 수 있습니다.
전략적 거래는 가설적 거래에 취약하다. 트렌드 판단과 손해 관리 위험을 결합해야 한다.
데이터 적합성을 재검토하는 위험. 전략의 강도를 여러 시장에서 여러 실험을 통해 검증해야 한다.
이러한 위험에 대해, 매개 변수 최적화, 주문 조정, 손해 방지 전략 최적화, 실전 검증 등의 수단으로 위험을 제어할 수 있다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
다른 기술 지표 판단을 추가하여 신호의 정확성을 향상시킵니다.
거래 횟수를 최적화하고, 거래 빈도를 낮추어 transactionsstab 시장의 영향을 줄인다.
브레이크 전략과 함께 중요한 가격대 근처에 브레이크 트레이딩 신호를 설정한다.
기계 학습 방법을 사용하여 자동으로 최적화 파라미터 설정을 한다.
여러 시장에서 여러 시간 동안 전략의 강도를 테스트하고 적응력을 향상시킵니다.
주식, 외환과 같은 다양한 종류의 특성을 고려하여 특화된 파라미터를 설정합니다.
실적 결과에 따라 전략 신호 및 위험 관리 방법을 계속 반복적으로 최적화하십시오.
이 전략은 변화율과 SMA 지표를 판단하여 짧은 선의 가격 변동에서 거래 기회를 찾습니다. 그것은 빠른 흐름을 포착하는 데 도움이되지만 위험 관리에 주의를 기울여야합니다. 매개 변수 최적화, 주문 조정, 중지 손실 전략 개선 및 실장 검증을 통해 전략의 안정성과 적응력을 지속적으로 향상시킬 수 있습니다. 이 전략은 수량 거래에 대한 참조 템플릿을 제공하지만 실제 적용에서는 시장 특성에 따라 조정 및 최적화가 필요합니다.
/*backtest
start: 2022-09-21 00:00:00
end: 2023-09-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// @version=4
// Author: Sonny Parlin (highschool dropout)
// Best if run on 5m timeframe
strategy(shorttitle="ROC+Strategy", title="Rate of Change Strategy",
overlay=true, currency=currency.USD,
initial_capital=10000)
// Inputs and variables
ss = input(14, minval=10, maxval=50, title="SMA Fast (days)")
ff = input(100, minval=55, maxval=200, title="SMA Slow (days)")
ref = input(30, minval=20, maxval=50, title="SMA Reference (days)")
lowOffset = input(0.023, "ROC Low (%)", minval=0, step=0.01)
highOffset = input(0.047, "ROC High (%)", minval=0, step=0.01)
orderStake = input(0.96, "Order Stake (%)", minval=0, step=0.01)
lookback = input(12, "Lookback Candles", minval=1, step=1)
// SMA
smaFast = sma(close, ss)
smaSlow = sma(close, ff)
smaRef = sma(close, ref)
ROC = (max(close[lookback],close) - min(close[lookback],close)) / max(close[lookback],close)
// Set up SMA plot but don't show by default
plot(smaFast, "smaFast", color=#00ff00, display = 0)
plot(smaSlow, "smaSlow", color=#ff0000, display = 0)
plot(smaRef, "smaRef", color=#ffffff, display = 0)
// The buy stratey:
// Guard that the low is under our SMA Reference line
// Guard that the rate of change over the lookback period is greater than our
// ROC lowOffset %, default is 0.023. (low < smaRef) and (ROC > lowOffset)
// SMA fast is on the rise and SMA slow is falling and they are very likely
// to cross. (rising(smaFast,1)) and (falling(smaSlow, 1))
enterLong = (low < smaRef) and (ROC > lowOffset) and (rising(smaFast,1)) and (falling(smaSlow,1))
// The sell Strategy:
// Guard that close is higher than our SMA reference line and that the rate of
// change over the lookback period is greater than our highOffset %, default
// is 0.047. (close > smaRef) and (ROC > highOffset)
// Guard that close has risen by 3 candles in a row (rising(close,3))
// Guard that we currently have profit (strategy.openprofit > 0)
// Guard that SMA fast is higher than smaSlow (smaFast > smaSlow)
// If it keeps going up past our close position the trailing stoploss will kick in!
enterShort = (close > smaRef) and (ROC > highOffset) and (rising(close,3)) and (strategy.openprofit > 0) and (smaFast > smaSlow)
// Order size is based on total equity
// Example 1:
// startingEquity = 2000
// close = 47434.93
// orderStake = 0.45
// (2,000 × orderStake) / close = orderSize = 0.0189733599 = approx $900
// Example 2:
// startingEquity = 2000
// close = 1.272
// orderStake = 0.45
// (startingEquity × orderStake) / close = orderSize = 707.5471698113 = approx $900
orderSize = (strategy.equity * orderStake) / close
// Trailing Stoploss
// I'm using 2.62 as my default value, play with this for different results.
longTrailPerc = input(title="Trailing Stoploss (%)",
type=input.float, minval=0.0, step=0.1, defval=3.62) * 0.01
longStopPrice = 0.0
longStopPrice := if (strategy.position_size > 0)
stopValue = close * (1 - longTrailPerc)
max(stopValue, longStopPrice[1])
else
0
if (enterLong)
strategy.entry("Open Long Position", strategy.long, orderSize, when=strategy.position_size <= 0)
if (enterShort)
strategy.exit(id="Close Long Position", stop=longStopPrice)
//plot(strategy.equity)