
바위처럼 단단한 바닷가 전략은 브레이디 바닷가 거래 법칙을 따르는 양적 거래 전략이다. 그것은 가격을 뚫고 입구, 손실을 막고 손실을 막는 방법을 채택하고, 실제 파장에 따라 포지션 규모를 계산하고, 단독 손실을 엄격하게 통제한다. 이 전략은 장기적으로 안정적으로 작동하며, 강인한 바위처럼 부진과 회귀에 강하다.
바위처럼 단단한 해수욕 전략은 브레이크 엔트리에 있다. 구체적으로, 그것은 입력된 브레이크 사이클 파라미터를 기반으로 일정 사이클의 최고 가격과 최저 가격을 각각 계산한다. 가격이 최고 가격을 돌파할 때, 더 많은 엔트리를 하고, 가격이 최저 가격을 돌파할 때, 공백 엔트리를 한다.
예를 들어, 입시주기 파라미트가 20개의 K선으로 설정되어 있다면, 전략은 최근 20개의 K선에서 가장 높은 가격과 가장 낮은 가격을 추출한다. 만약 현재 K선의 종결 가격이 지난 20개의 K선에서 가장 높은 가격보다 높다면, 전략은 그 종결 가격 위치에서 더 많은 정지 명령을 내리고, 가장 높은 가격의 입시를 돌파할 때까지 기다린다.
바위처럼 튼튼한 해양 전략은 스톱로스 트래킹 스톱로스 출전을 한다. 그것은 입력된 출전 주기 파라미터를 기반으로, 동적으로 일정 주기 내의 최고 가격과 최저 가격을 계산한다. 이것은 전략의 출구 통로가 된다.
포지션을 다수 할 때, 가격이 출구 최저 가격을 넘어간다면 포지션 중지 손실이 빠져 납니다. 반대로 포지션을 공백 할 때, 가격이 출구 최저 가격을 넘어간다면 포지션 중지 손실이 빠져 납니다.
또한, 전략은 실제 파장에 따라 중지 손실을 계산하여 마지막 중단 선으로 사용한다. 가격이 출구 통로를 돌파하지 않는 한, 중지 손실은 수정 사항을 계속 추적하여 중지 손실 거리가 적절하게 보장되며, 너무 급진적이어서 불필요한 중지 손실이 발생하지 않으며, 너무 멀리 떨어져 손실을 효과적으로 제어 할 수 없습니다.
바위처럼 단단한 해수욕 전략은 실제 파동에 따라 하나의 거래 규모를 계산한다. 구체적으로, 그것은 먼저 출입 가격 근처의 잠재적 인 손실 비율을 계산하고, 예상되는 위험 요소에 따라 위치 규모를 역전한다. 따라서 거래 당 최대 손실을 효과적으로 제어 할 수 있다.
바위처럼 튼튼한 해안 전략은 브레이디 해안 거래법을 따르고, 입장 규칙과 출장 규칙을 엄격하게 시행하고, 변동하지 않습니다. 이것은 전략이 장기적으로 안정적으로 작동할 수 있도록 하며, 임시적인 판단 오류로 인해 시스템이 고장 나지 않습니다.
전략은 가격 돌파 입구를 채택하여 높은 수준의 오류 입구를 효과적으로 피할 수 있으며, 이로 인해 체계적인 손실의 가능성을 줄일 수 있습니다. 또한, 손실 추적 중지 방식을 채택하여 단독 손실을 제어하고, 연속 손실으로 인한 하락과 회귀가 발생하는 것을 최대한 억제합니다.
전략은 실제 파장을 통해 입장을 계산하고, 거래당 최대 손실을 허용 범위 내에서 엄격하게 제어하여, 단일 큰 손실로 인한 위험 초과물을 피합니다. 또한, 중지 손실 추적 방식을 사용하여 중지 손실 거리를 적절하게 보장하고, 적시에 중지 손실을 방지하고, 위험을 효과적으로 제어합니다.
만약 실황이 없는 진동폭이 돌파되면, 가짜 신호가 형성되어 시스템 오류로 인해 출전 손실이 발생하기 쉽다. 이 경우 출입 확인 조건을 높이고, 무효 돌파의 노이즈 간섭을 피하기 위해 매개 변수를 조정해야 한다.
전략의 매개 변수들 (예: 입시주기, 출구주기 등) 은 정적인 설정이다. 시장 환경이 크게 변하면, 이러한 매개 변수 설정은 무효가 될 수 있다. 이 때 매개 변수 설정을 재평가하고, 새로운 시장 상태에 적응하기 위해 매개 변수를 최적화할 필요가 있다.
전략은 가격 돌파를 판단하기 위해 flags와 같은 기술 지표를 사용합니다. 시장 추세와 변동 패턴이 크게 변하면 이러한 기술 지표는 무효가 될 수 있습니다.
전략에 일반적으로 사용되는 MA, MACD 등의 추세 판단 지표를 추가 할 수 있습니다. 상향 추세를 판단 할 때, 하향 추세를 판단 할 때, 역행 손실을 줄일 수 있습니다.
높은 수준의 시간 프레임의 기술 지표를 도입하여 종합적인 판단을 할 수 있다. 예를 들어 86400 레벨의 MA 라인 위치는 전반적인 이동 방향을 판단하고, 분기 차트에 대한 작동 신호를 추가로 확인한다.
기계 학습과 같은 방법을 통해, 역사 데이터에 따라 자동으로 최적화 파라미터를, 시장 환경 변화에 적응하기 위해 실시간으로 파라미터를 조정할 수 있습니다. 이것은 전략을 더 적응적이고 안정적으로 만들 수 있습니다.
바위처럼 단단한 해수욕 전략은 고전적인 해수욕 거래 규칙을 따르며, 가격의 돌파 입점과 손실 추적의 돌파 입점을 엄격하게 제어하고, 장기적으로 안정적으로 운영할 수 있으며, 우수한 부진 저항 역전력을 갖는다. 일부 돌파 실패, 변수 실패와 같은 위험을 경계해야 할지라도, 추세 판단, 시간 프레임 판단, 동적 변수 최적화 등의 수단을 도입함으로써 이러한 위험을 효과적으로 줄일 수 있으며, 전략의 안정적인 운영 능력을 크게 향상시킬 수 있다.
/*backtest
start: 2024-01-18 00:00:00
end: 2024-02-17 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("Real Turtle", shorttitle = "Real Turtle", overlay=true, pyramiding=1, default_qty_type= strategy.percent_of_equity,calc_on_order_fills=false, slippage=25,commission_type=strategy.commission.percent,commission_value=0.075)
//////////////////////////////////////////////////////////////////////
// Testing Start dates
testStartYear = input(2016, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
//Stop date if you want to use a specific range of dates
testStopYear = input(2030, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
// A switch to control background coloring of the test period
// Use if using a specific date range
testPeriodBackground = input(title="Color Background?", type=bool, defval=false)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=97)
testPeriod() => true
// Component Code Stop
//////////////////////////////////////////////////////////////////////
//How many candles we want to determine our position entry
enterTrade = input(20, minval=1, title="Entry Channel Length")
//How many candles we want ot determine our position exit
exitTrade = input(10, minval=1, title="Exit Channel Length")
//True Range EMA Length
trLength = input(13, minval=1, title="True Range Length")
//Go all in on every trade
allIn = input(false, title="Use whole position on every trade")
dRisk = input(2, "Use Desired Risk %")
//How much of emaTR to use for TS offset
multiEmaTR = input(2, "Desired multiple of ema Tr (N)")
//absolute value (highest high of of this many candles - lowest high of this many candles) . This is used if we want to change our timeframe to a higher timeframe otherwise just works like grabbing high o r low of a candle
//True range is calculated as just high - low. Technically this should be a little more complicated but with 24/7 nature of crypto markets high-low is fine.
trueRange = max(high - low, max(high - close[1], close[1] - low))
//Creates an EMA of the true range by our custom length
emaTR = ema(trueRange, trLength)
//Highest high of how many candles back we want to look as specified in entry channel for long
longEntry = highest(enterTrade)
//loweest low of how many candles back we want to look as specified in exit channel for long
exitLong = lowest(exitTrade)
//lowest low of how many candles back want to look as specified in entry channel for short
shortEntry = lowest(enterTrade)
//lowest low of how many candles back want to look as specified in exit channel for short
exitShort = highest(exitTrade)
//plots the longEntry as a green line
plot(longEntry[1], title="Long Entry",color=green)
//plots the short entry as a purple line
plot(shortEntry[1], title="Short Entry",color=purple)
howFar = barssince(strategy.position_size == 0)
actualLExit = strategy.position_size > 0 ? strategy.position_avg_price - (emaTR[howFar] * multiEmaTR) : longEntry - (emaTR * multiEmaTR)
actualLExit2 = actualLExit > exitLong ? actualLExit : exitLong
actualSExit = strategy.position_size < 0 ? strategy.position_avg_price + (emaTR[howFar] * multiEmaTR) : shortEntry + (emaTR * multiEmaTR)
actualSExit2 = actualSExit < exitShort ? actualSExit : exitShort
//plots the long exit as a red line
plot(actualLExit2[1], title="Long Exit",color=red)
//plots the short exit as a blue line
plot(actualSExit2[1], title="Short Exit",color=yellow)
//Stop loss in ticks
SLLong =(emaTR * multiEmaTR)/ syminfo.mintick
SLShort = (emaTR * multiEmaTR)/ syminfo.mintick
//Calculate our potential loss as a whole percentage number. Example 1 instead of 0.01 for 1% loss. We have to convert back from ticks to whole value, then divided by close
PLLong = ((SLLong * syminfo.mintick) * 100) / longEntry
PLShort = ((SLShort * syminfo.mintick) * 100) / shortEntry
//Calculate our risk by taking our desired risk / potential loss. Then multiple by our equity to get position size. we divide by close because we are using percentage size of equity for quantity in this script as not actual size.
//we then floor the value. which is just to say we round down so instead of say 201.54 we would just input 201 as TV only supports whole integers for quantity.
qtyLong = floor(((dRisk / PLLong) * strategy.equity) /longEntry )
qtyShort = floor(((dRisk / PLShort) * strategy.equity) /shortEntry )
qtyLong2 = allIn ? 100 : qtyLong
qtyShort2 = allIn ? 100 : qtyShort
//Only open long or short positions if we are inside the test period specified earlier
if testPeriod()
//Open a stop market order at our long entry price and keep it there at the quantity specified. This order is updated/changed on each new candlestick until a position is opened
strategy.entry("long", strategy.long, stop = longEntry, qty = qtyLong2)
//sets up or stop loss order by price specified in our actualLExit2 variable
strategy.exit("Stoploss-Long", "long", stop=actualLExit2)
//Open a stop market order at our short entry price and keep it there at the quantity specified. This order is updated/changed on each new candlestick until a position is opened
strategy.entry("short", strategy.short, stop = shortEntry, qty = qtyShort2)
//sets up or stop loss order by price specified in our actualLExit2 variable
strategy.exit("Stoploss-Short", "short", stop=actualSExit2)