長期ヘッジ戦略

作者: リン・ハーンチャオチャン,日付: 2023-09-14 16時56分34秒
タグ:

戦略の論理

この戦略は,長期的動向に基づいて資産の配置とヘッジを決定します.

論理的には

  1. ベース資産,移動平均期間の選択と解消

  2. 資産の単純な移動平均を計算する

  3. 価格がMAを超えると 長期的に上昇傾向を示し 資産を長期化させる

  4. 価格がMAを下回ると長期的に下落傾向を示し,資産を短縮する

  5. また,長時間のみまたは短時間のみで行うことができます

  6. 資産価格とMAを比較して長期トレンドを判断する

  7. 短期変動をカバーするために反対の立場をとる

この戦略は短期リスクをカバーし,資産の長期的傾向に焦点を当て,安定した利益を実現します.

利点

  • 長期傾向を決定するための単純なMAシステム

  • ロング/ショートペアリングはシステムリスクを効果的にカバーする

  • 長い信号と短い信号

リスク

  • MAは価格変動に遅れ

  • 長期ポジションの保有コスト

  • リスク管理の必要性

概要

この戦略は,リスク管理を重視し,長期および短期資産の組み合わせを使用してヘッジをします.しかし,MA遅延と保有コストは考慮する必要があります.


/*backtest
start: 2023-08-14 00:00:00
end: 2023-09-13 00:00:00
period: 1h
basePeriod: 15m
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/
// © danilogalisteu

//@version=4
strategy("Long Term L/S", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

base = input("BMFBOVESPA:IBOV")
period = input(5, 'SMA Period', input.integer)
resolution = input(title="SMA Resolution", type=input.resolution, defval='M')
strat = input(title="Strategy", defval="Long/Short", options=["Long Only", "Long/Short", "Short Only"])
strat_val = strat == "Long Only" ? 1 : strat == "Long/Short" ? 0 : -1

base_cl = security((base), resolution, close)
base_ma = sma(base_cl, period)

longCondition = crossover(base_cl, base_ma)
if (longCondition)
    if strat_val > -1
        strategy.entry("LONG", strategy.long)
    if strat_val < 1
        strategy.close("SHORT")

shortCondition = crossunder(base_cl, base_ma)
if (shortCondition)
    if strat_val > -1
        strategy.close("LONG")
    if strat_val < 1
        strategy.entry("SHORT", strategy.short)

//plot(longCondition?1:0, 'L', color.blue)
//plot(shortCondition?-1:0, 'S', color.red)

もっと