
이 전략은 단순 이동 평균 (SMA) 교차 신호와 최고 회수 제어를 결합한 다중 하위 거래 시스템이다. 14과 28기 SMA의 교차를 사용하여 다중 하위 거래 신호를 생성하고, 전략의 최고 회수를 실시간으로 모니터링한다. 회수가 기본 임계치를 초과하면 전략은 자동으로 거래를 중단한다. 또한, 전략에는 전략의 위험 특성을 더 잘 이해하는 데 도움이되는 상세한 최고 - 하계 주기 분석 기능이 포함되어 있습니다.
거래 신호 생성:
피크 철수 제어:
픽-밸리 사이클 분석:
트렌드 추적과 리스크 관리를 결합하여: SMA 교차 전략은 고전적인 트렌드 추적 방법이며, 피크 회귀 제어는 추가적인 위험 관리 계층을 제공합니다. 이 조합은 시장 추세를 포착하면서 하향 위험을 효과적으로 제어 할 수 있습니다.
적응력: 최대 회수 및 최소 회수 마이너스를 파라미탈로 설정하여, 전략은 다양한 시장 환경 및 개인 위험 선호도에 따라 유연하게 조정할 수 있습니다.
투명한 위험 지표: 피크-밸리 사이클 분석은 상세한 역사적 회수 정보를 제공하여 거래자가 전략의 위험 특성을 직관적으로 이해할 수 있도록 도와 더 현명한 거래 결정을 내릴 수 있습니다.
자동화 위험 관리: 철수할 때, 전략은 자동으로 거래를 중단합니다. 이 메커니즘은 불리한 시장 환경에서 지속적인 손실을 방지하는 데 효과적입니다.
전체적인 성과 분석: 일반적인 회귀 지표 외에도 전략은 전략의 성과를 깊이 분석하는 데 도움이되는 상승, 회귀, 시간 정보를 포함한 상세한 정점-바닥 주기 데이터를 제공합니다.
역사적인 데이터에 지나치게 의존하는 것: SMA 교차 전략은 역사적 가격 데이터에 기반하여 빠르게 변화하는 시장에서 반응 지연으로 인해 잘못된 신호가 발생할 수 있습니다.
자주 거래하는 경우: 불안정한 시장에서 SMA는 자주 교차하여 과도한 거래와 높은 거래 비용을 초래할 수 있습니다.
이 사진의 제목은 “미국”입니다. 최대 회수 제어가 있음에도 불구하고, 시장의 급격한 변동이 있을 때, 단 한 번의 큰 하락은 여전히 큰 손실을 초래할 수 있다.
변수 민감성: 전략의 성능은 SMA 주기 및 회수 마이너스의 선택에 크게 의존하며, 부적절한 매개 변수 설정은 부적절한 결과를 초래할 수 있다.
“그건 정말 끔찍한 일이야. 최대 회수 마이너스 (maximum withdrawal threshold) 에 도달한 후 거래를 중단하면, 전략은 시장의 역전으로 인한 기회를 놓칠 수 있다.
동적 변수 조정을 도입합니다: 시장의 변동성에 따라 SMA 주기와 철회 마이너스를 조정하여 다른 시장 환경에 적응하는 것이 고려 될 수 있습니다.
추가적인 시장 필터를 추가합니다. RSI 또는 거래량과 같은 다른 기술적 인 지표 또는 기본 요소와 결합하여 잠재적인 가짜 신호를 필터링하십시오.
“이런 일이 벌어질 수 있다. 전체 창고가 아닌, 단독으로 결정하는 위험을 줄이기 위해, 점진적으로 창고와 창고를 건설할 수 있다.
“이건 정말 놀라운 일이에요. 철수 제어에 기초하여, 수익을 잠금하고 전체 수익률을 높이기 위해 동적 정지 기능을 추가하십시오.
자금 관리의 최적화: 계정 규모와 시장의 변동성에 기반한 역동적인 포지션 관리를 구현하여 위험을 더 잘 통제할 수 있습니다.
기계 학습 알고리즘을 소개합니다. 기계 학습 기술을 사용하여 매개 변수 선택과 신호 생성 프로세스를 최적화하여 전략의 적응성과 정확성을 향상시킵니다.
SMA 크로스 다공간 전략은 정점 회수 제어와 자동 종료를 결합한 양적 거래 시스템으로, 트렌드 추적과 위험 관리를 겸비한다. 그것은 간단한 이동 평균의 크로스 (cross) 를 통해 시장의 추세를 포착하고, 동시에 정점 회수 제어를 사용하여 하향 위험을 관리한다. 전략의 독특한 점은 상세한 정점 - 계곡 밑바닥 주기 분석 기능으로, 거래자에게 전략의 위험 특성을 깊이 이해하는 도구를 제공합니다.
전략에는 역사적 데이터와 변수 감수성에 대한 과도한 의존과 같은 몇 가지 고유한 위험이 있지만, 동적 변수 조정, 추가 시장 필터 및 더 지능적인 자금 관리를 도입하는 것과 같은 적절한 최적화 및 개선으로 안정성과 수익성을 크게 향상시킬 수 있습니다.
전체적으로, 이 전략은 거래자에게 좋은 출발점을 제공하며, 개인의 거래 목표와 위험 선호도를 충족시키기 위해 추가적으로 사용자 정의 및 최적화를 할 수 있습니다. 전략의 모듈형 설계는 다른 거래 전략이나 위험 관리 기술과 쉽게 통합 할 수있게 해 더 복잡하고 포괄적인 거래 시스템을 구축하는 토대를 마련합니다.
/*backtest
start: 2023-07-23 00:00:00
end: 2024-07-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
capital = 10000
//@version=5
strategy(title = "Correct Strategy Peak-Drawdown Cycles [Tradingwhale]", shorttitle = "Peak-Draw [Tradingwhale]", initial_capital = capital, overlay=true, margin_long=100, margin_short=100)
// The code below is from Tradingwhale LLC
/// ==============================================================================
// Peak-Trough Cycles with Date and Prev. RunUp
// Initialize variables
showTable = input.bool(true, title = "Plot Peak to Bottom Drawdown Cycles table?")
min_trough = input.float(3.0, title = "Define Minimum Drawdown/Trough to Display (%)", minval = 1, maxval = 100, step = 0.5, tooltip = "Peaks and Trough Cycles have to be roped in by either a lookback period or minmimum troughs to show. If you don't then every bar could be a peak or trough/bottom. I've decided to use minimum declines here because lookback seems more arbitrary.")
maxdraw = input.float(40.0, title = "Max Drawdown", minval = 1, maxval = 100, step = 0.5, tooltip = "Define the drawdown level where the srtategy stops executing trades.")
var float equityPeak = na
var float equityTrough = na
var int cycleCount = 0
var bool inDrawdown = false
var float initialCapital = capital
var float prevTrough = initialCapital
var float prevRunUp = na
var bool useLighterGray = true
var int lastYear = na
// Variable to indicate whether the strategy should end
var bool end_strategy = false
// Table to display data
var table resultTable = table.new(position.top_right, 5, 30, bgcolor=#ffffff00, frame_color=#4f4040, frame_width=1)
// Function to convert float to percentage string
f_to_percent(value) =>
str.tostring(value, "#.##") + "%"
// Function to get month/year string without commas
get_month_year_string() =>
str.tostring(year) + "/" + str.tostring(month)
// Update the table headers
if (bar_index == 0 and showTable)
table.cell(resultTable, 0, 0, "Show Min Trough: " + f_to_percent(min_trough), bgcolor=#a8a8a88f, text_size=size.normal)
table.cell(resultTable, 1, 0, "Cycle Count", bgcolor=#a8a8a88f, text_size=size.normal)
table.cell(resultTable, 2, 0, "Prev.RunUp(%)", bgcolor=#a8a8a88f, text_size=size.normal)
table.cell(resultTable, 3, 0, "Drawdown(%)", bgcolor=#a8a8a88f, text_size=size.normal)
table.cell(resultTable, 4, 0, "Year/Month", bgcolor=#a8a8a88f, text_size=size.normal)
// Track peaks and troughs in equity
if (na(equityPeak) or strategy.equity > equityPeak)
if (inDrawdown and strategy.equity > equityPeak and not na(equityTrough)) // Confirm end of drawdown cycle
drawdownPercentage = (equityPeak - equityTrough) / equityPeak * 100
if drawdownPercentage > min_trough
cycleCount += 1
prevRunUp := (equityPeak - prevTrough) / prevTrough * 100
if cycleCount <= 20 and showTable
currentYear = year
if na(lastYear) or currentYear != lastYear
useLighterGray := not useLighterGray
lastYear := currentYear
rowColor = useLighterGray ? color.new(color.gray, 80) : color.new(color.gray, 50)
table.cell(resultTable, 1, cycleCount, str.tostring(cycleCount), bgcolor=rowColor, text_size=size.normal)
table.cell(resultTable, 2, cycleCount, f_to_percent(prevRunUp), bgcolor=rowColor, text_size=size.normal)
table.cell(resultTable, 3, cycleCount, f_to_percent(drawdownPercentage), bgcolor=rowColor, text_size=size.normal)
table.cell(resultTable, 4, cycleCount, get_month_year_string(), bgcolor=rowColor, text_size=size.normal)
prevTrough := equityTrough
equityPeak := strategy.equity
equityTrough := na
inDrawdown := false
else if (strategy.equity < equityPeak)
equityTrough := na(equityTrough) ? strategy.equity : math.min(equityTrough, strategy.equity)
inDrawdown := true
// Calculate if the strategy should end
if not na(equityPeak) and not na(equityTrough)
drawdownPercentage = (equityPeak - equityTrough) / equityPeak * 100
if drawdownPercentage >= maxdraw
end_strategy := true
// This code below is from Tradingview, but with additions where commented (see below)
longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
if (longCondition) and not end_strategy // Add 'and not end_strategy' to your order conditions to automatically end the strategy if max_draw is exceeded/
strategy.entry("My Long Entry Id", strategy.long)
shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
if (shortCondition) and not end_strategy // Add 'and not end_strategy' to your order conditions to automatically end the strategy if max_draw is exceeded/
strategy.entry("My Short Entry Id", strategy.short)