자본곡선에 기반한 포지션 관리 전략


생성 날짜: 2024-01-16 15:06:39 마지막으로 수정됨: 2024-01-16 15:06:39
복사: 1 클릭수: 738
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

자본곡선에 기반한 포지션 관리 전략

전략 개요

이 전략의 핵심 아이디어는 자본 곡선의 움직임에 따라 포지션 크기를 동적으로 조정하고, 수익을 올릴 때 포지션을 늘리고, 손실을 줄일 때 포지션을 줄여서 전반적인 위험을 제어하는 것입니다. 이 전략은 동시에 Chande 운동 지표, SuperTrend 지표 및 운동 지표를 결합하여 거래 신호를 식별합니다.

전략 원칙

이 전략은 자본 곡선이 하향 경향에 있는지 여부를 판단하는 두 가지 방법을 사용합니다. 1) 자본 곡선의 빠른 및 느린 간단한 이동 평균을 계산하고, 빠른 SMA가 느린 SMA보다 낮으면 하향으로 판단합니다. 2) 자본 곡선과 그 자체의 더 긴 기간의 간단한 이동 평균을 계산하고, 자본 곡선이 이동 평균보다 낮으면 하향으로 판단합니다.

자본 곡선이 하향으로 판단될 때, 포지션은 설정에 따라 일정 비율로 감소 또는 증가한다. 예를 들어, 50% 감소가 설정되면 원래 10%의 포지션은 5%로 감소한다. 이 전략은 수익을 올릴 때 포지션 규모를 확대하고 손실을 줄일 때 포지션 규모를 줄여 전체 위험을 제어한다.

전략적 이점

  • 자본 곡선을 사용하여 시스템 전체의 손실을 판단하고, 포지션을 동적으로 조정하면 위험을 제어하는 데 도움이 됩니다.
  • 여러 지표들을 조합하여 입시를 판단하여 수익률을 높일 수 있습니다.
  • 각기 다른 위험 선호도에 맞게 위치 조정할 수 있는 변수

전략적 위험

  • 포지션이 커지면 손실도 커집니다.
  • 잘못된 매개 변수 설정으로 인해 포지션 조정이 너무 급진적일 수 있습니다.
  • 포지션 관리는 시스템적 위험을 완전히 피할 수 없습니다.

더 나은 생각

  • 다른 포지션 조정 매개 변수의 효과를 테스트합니다.
  • 자금 곡선의 움직임을 판단하는 다른 지표의 조합을 시도하십시오.
  • 입학 조건을 최적화하고 승률을 높여라

요약하다

이 전략의 전반적인 생각은 명확하고, 자본 곡선의 동적 조정 포지션을 활용하여 위험을 효과적으로 제어할 수 있으며, 추가 테스트 및 최적화를 할 가치가 있다. 변수 설정 및 손해 중지 전략도 충분히 고려해야 하며, 과격한 작업으로 인한 위험을 피한다.

전략 소스 코드
/*backtest
start: 2024-01-08 00:00:00
end: 2024-01-15 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © shardison
//@version=5

//EXPLANATION
//"Trading the equity curve" as a risk management method is the 
//process of acting on trade signals depending on whether a system’s performance
//is indicating the strategy is in a profitable or losing phase.
//The point of managing equity curve is to minimize risk in trading when the equity curve is  in a downtrend. 
//This strategy has two modes to determine the equity curve downtrend:
//By creating two simple moving averages of a portfolio's equity curve - a short-term
//and a longer-term one - and acting on their crossings. If the fast SMA is below
//the slow SMA, equity downtrend is detected (smafastequity < smaslowequity).
//The second method is by using the crossings of equity itself with the longer-period SMA (equity < smasloweequity).
//When "Reduce size by %" is active, the position size will be reduced by a specified percentage
//if the equity is "under water" according to a selected rule. If you're a risk seeker, select "Increase size by %"
//- for some robust systems, it could help overcome their small drawdowns quicker.

strategy("Use Trading the Equity Curve Postion Sizing", shorttitle="TEC", default_qty_type = strategy.percent_of_equity, default_qty_value = 10, initial_capital = 100000)

//TRADING THE EQUITY CURVE INPUTS
useTEC           = input.bool(true, title="Use Trading the Equity Curve Position Sizing")
defulttraderule  = useTEC ? false: true
initialsize      = input.float(defval=10.0, title="Initial % Equity")
slowequitylength = input.int(25, title="Slow SMA Period")
fastequitylength = input.int(9, title="Fast SMA Period")
seedequity = 100000 * .10
if strategy.equity == 0
    seedequity
else
    strategy.equity
slowequityseed   = strategy.equity > seedequity ? strategy.equity : seedequity
fastequityseed   = strategy.equity > seedequity ? strategy.equity : seedequity
smaslowequity    = ta.sma(slowequityseed, slowequitylength)
smafastequity    = ta.sma(fastequityseed, fastequitylength)
equitycalc       = input.bool(true, title="Use Fast/Slow Avg", tooltip="Fast Equity Avg is below Slow---otherwise if unchecked uses Slow Equity Avg below Equity")
sizeadjstring    = input.string("Reduce size by (%)", title="Position Size Adjustment", options=["Reduce size by (%)","Increase size by (%)"])
sizeadjint       = input.int(50, title="Increase/Decrease % Equity by:")
equitydowntrendavgs = smafastequity < smaslowequity
slowequitylessequity = strategy.equity < smaslowequity

equitymethod = equitycalc ? equitydowntrendavgs : slowequitylessequity

if sizeadjstring == ("Reduce size by (%)")
    sizeadjdown = initialsize * (1 - (sizeadjint/100))
else
    sizeadjup = initialsize * (1 + (sizeadjint/100))
c = close
qty = 100000 * (initialsize / 100) / c
if useTEC and equitymethod
    if sizeadjstring == "Reduce size by (%)"
        qty := (strategy.equity * (initialsize / 100) * (1 - (sizeadjint/100))) / c
    else
        qty := (strategy.equity * (initialsize / 100) * (1 + (sizeadjint/100))) / c
    
//EXAMPLE TRADING STRATEGY INPUTS
CMO_Length = input.int(defval=9, minval=1, title='Chande Momentum Length')
CMO_Signal = input.int(defval=10, minval=1, title='Chande Momentum Signal')

chandeMO = ta.cmo(close, CMO_Length)
cmosignal = ta.sma(chandeMO, CMO_Signal)

SuperTrend_atrPeriod = input.int(10, "SuperTrend ATR Length")
SuperTrend_Factor = input.float(3.0, "SuperTrend Factor", step = 0.01)
Momentum_Length = input.int(12, "Momentum Length")
price = close

mom0 = ta.mom(price, Momentum_Length)
mom1 = ta.mom( mom0, 1)
[supertrend, direction] = ta.supertrend(SuperTrend_Factor, SuperTrend_atrPeriod)
stupind = (direction < 0 ? supertrend : na)
stdownind = (direction < 0? na : supertrend)

//TRADING CONDITIONS
longConditiondefault = ta.crossover(chandeMO, cmosignal) and (mom0 > 0 and mom1 > 0 and close > stupind) and defulttraderule
if (longConditiondefault)
    strategy.entry("DefLong", strategy.long, qty=qty)

shortConditiondefault = ta.crossunder(chandeMO, cmosignal) and (mom0 < 0 and mom1 < 0 and close < stdownind) and defulttraderule
if (shortConditiondefault)
    strategy.entry("DefShort", strategy.short, qty=qty)
    
longCondition = ta.crossover(chandeMO, cmosignal) and (mom0 > 0 and mom1 > 0 and close > stupind) and useTEC
if (longCondition)
    strategy.entry("AdjLong", strategy.long, qty = qty)

shortCondition = ta.crossunder(chandeMO, cmosignal) and (mom0 < 0 and mom1 < 0 and close < stdownind) and useTEC
if (shortCondition)
    strategy.entry("AdjShort", strategy.short, qty = qty)
plot(strategy.equity)
plot(smaslowequity, color=color.new(color.red, 0))
plot(smafastequity, color=color.new(color.green, 0))