暗号通貨を定期的に購入するための戦略


作成日: 2024-01-08 17:05:10 最終変更日: 2024-01-08 17:05:10
コピー: 2 クリック数: 613
1
フォロー
1617
フォロワー

暗号通貨を定期的に購入するための戦略

概要

控えめな保有戦略は,定期的な暗号通貨の購入戦略であり,暗号通貨の繰り返し購入と保有によって資産の価値を高めるための戦略である.この戦略は,主に定期的な購入信号,保有信号,退出信号の3つの主要な構成要素で構成されている.

戦略原則

この戦略の基本的な論理は:

  1. 起動時に購入シグナルを送信し,最初の購入を行う.

  2. 購入シグナルを送信し,Quote通貨でさらに多くのBase通貨を購入します.

  3. 数値が設定値に達すると,退出指示を送信し,ポジションを平らにする.

  4. 退出のタイミングが来たとき,退出信号を送り,戦略を停止し,すべてのポジションを平定する.

コスト平均と継続的な保有の効果は,暗号通貨の繰り返し購入と保有によって実現できます.

優位分析

この戦略の利点は以下の通りです.

  1. 定期的な暗号通貨の購入が可能で,購入の時間のリスクが軽減されます.

  2. 繰り返し購入することで,暗号通貨の平均保有コストを減らすことができます.

  3. ポジションを継続的に増やすことで,ポートフォリオの成長利益を得ることができます.

  4. 購入と退出のタイミングをカスタマイズし,自動化が可能.

  5. 操作が簡単で,使いやすい.

リスク分析

この戦略には以下のリスクもあります.

  1. 暗号通貨市場におけるシステムリスク,価格の大幅な変動の可能性

  2. 退出のタイミングが悪い場合, 損害を早期に防ぐことができません.

  3. 資金の管理が不適切であることも,負けない損失を招きます.

最適化の方向

この戦略は以下の点で最適化できます.

  1. 市場状況に応じて,購入の時間間隔と金額を動的に調整する.

  2. ストップシグナルが付加され,価格がサポート値を下回った時に平仓を停止する.

  3. 市場を判断する他の要素と組み合わせて,市場を始めるのに最適なタイミングを決める.

要約する

この持有素朴な戦略は,定期的な購入と持有方法によって暗号通貨のコスト平均とポートフォリオの付加価値の効果を実現する.使用方法の掌握を前提とした,比較的単純な量化戦略である.より多くの最適化を導入することにより,この戦略をより賢くし,市場環境の変化に適応させることができる.

ストラテジーソースコード
/*backtest
start: 2023-01-01 00:00:00
end: 2024-01-07 00:00:00
period: 1d
basePeriod: 1h
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/
// © Merdoc390

//@version=5

// The idea with this script is to use 3commas DCA bot to keep buying crypto, but not 'close the deal' which sells the crypto. 

// Basic idea is to keep adding funds, which increases the buy. 
// When you cancel the sale, you keep the crypto, thus HODL.
// I use this to build my positions that I short sale on Coinbase.com, so I need to cancel the deal after several candles so I can 
// trade them. 

// 3commas HODL DCA Bot article:
// https://3commas.io/blog/3commas-hodl-dca-bot-strategy
// This article includes the bot setup on 3Commas:
// Basicially you start the trade, then add funds to the trade, buying more crypto, then eventually cancel the deal.
// When you create the bot, you set the take profit really high, like 999%. Since it is unlikey to hit the value, it will never sell


// Credit to Irakli Gun as inspriation
// https://3commas.io/blog/3commas-hodl-dca-bot-strategy

strategy(title='HODL Simple v1', shorttitle="HODL'er", 
 calc_on_every_tick=false, calc_on_order_fills=true, process_orders_on_close =true,
 format=format.price, precision=4, overlay=true, pyramiding=365, 
 currency=currency.USD, default_qty_value=10, default_qty_type=strategy.cash , initial_capital=3650, 
 commission_type=strategy.commission.percent, commission_value=0.1)


var startFirstDeal = true
var done = false
var dealCount = 0
var totalDealCount = 0 


i_closeCount = input.int(defval=7,title="Close at Candle Count:",tooltip="How many buy candles to convert to a buy, otherwise it will remain open until end of timeframe.",group="Trade Range")
Start_date   = input(defval=timestamp('2023-09-21 16:30'),title="Start Date/Time",group="Trade Range")
Finish_date  = input(defval=timestamp('2023-09-21 23:05'),title="End Date/Time",group="Trade Range")

i_startBotAndDealMessage     = input(defval="paste your message here",title="Message to start bot and deal", tooltip="Message for 'start bot and deal",                        group="3Commas",display=display.all) 
i_addFundsMessage            = input(defval="paste your message here",title="Message for deal add funds signal in the quote currency",  tooltip="Using the quote (such as USD), to purchase more.",group="3Commas",display=display.all)
i_cancelTheDealMessage       = input(defval="paste your message here",title="Message to cancel the deal",tooltip="If you paste only cancel the deal, the bot will wait until next candle to add funds.\nOption is to also paste the add funds message to also add a buy position.",       group="3Commas",display=display.all)
i_cancelAndStopMessage       = input(defval="paste your message here",title="Message to cancel all bot deals and stop the bot",tooltip="Paste 3c bot messagage for Cancel all and Stop Bot",     group="3Commas",display=display.all)

time_cond = true

// check exit first
if not startFirstDeal and not done and dealCount < i_closeCount 
    strategy.close("Long")
    alert(i_cancelAndStopMessage)
    // log.info("Time expired, stopping bot, Total Deal Count:{0}",totalDealCount)
    done := true
// check if add funds after first deal
else if time_cond and not startFirstDeal and dealCount < i_closeCount 
    strategy.entry("Long", strategy.long)
    alert(i_addFundsMessage)
    // log.info("Deal Count:{0}, totalDeals:{1}",dealCount,totalDealCount)
    dealCount := dealCount + 1
    totalDealCount := totalDealCount + 1

else if time_cond and startFirstDeal and dealCount <= i_closeCount 
    strategy.entry("Long", strategy.long)
    // log.info("Start deal message, startFirst")
    alert(i_startBotAndDealMessage)
    startFirstDeal := false

else if time_cond and dealCount >= i_closeCount 
    strategy.close("Long")
    alert(i_cancelTheDealMessage)
    // log.info("Over Trades limit of {1}, resetting. Canceling. DealCount: {0}", dealCount, i_closeCount)
    dealCount := 0
    startFirstDeal := true

else if time_cond
    log.error("case not covered")