日々の閉じる価格比較に基づく定量的な取引戦略

作者: リン・ハーンチャオチャン,日付: 2023-11-21 14:34:11
タグ:

img

概要

この戦略は"日々の閉じる価格比較戦略"と呼ばれる.これは日々の閉じる価格に基づいて取引決定を行う定量的な取引戦略である.この戦略は,現在の日々の閉じる価格と以前の日々の閉じる価格の違いを計算することによって取引信号を生成する.差が設定された限界を超えると,購入または販売オーダーが実行される.

戦略の論理

この戦略の主な論理は,現在のキャンドルスタイク/バーと前の間の閉じる価格を比較することです.具体的には:

  1. 現在の日々の閉店価格と以前の日々の閉店価格 (今日 - 昨日) の差を計算する.
  2. 差と昨日の閉店価格の比率を計算する (差/昨日の閉店)
  3. この比率が設定された正値を超えると,買い信号が生成され,比率が設定された負値を下回ると,売り信号が生成されます.
  4. シグナルに従ってロングまたはショートポジションを入力します

ストップ・ロスの条件を設定したり,収益を上げたりせず,入口と出口のスロージング・トリガー・シグナルに頼る.

利点分析

  • シンプルな論理,分かりやすい,量子取引の初心者にとって適しています
  • 日々の閉店価格のみに頼り,過度に頻繁な取引を避けます
  • 取引頻度は,上限値を調整することで制御できます.

リスク分析

  • ストップ損失なし,単一の取引損失を制御できない
  • 連続した取引信号を生成し,過剰な取引を引き起こす可能性があります.
  • 総損失をうまくコントロールできない

オプティマイゼーションの方向性

  • シングルトレード損失を制御するためにストップ損失ロジックを追加
  • 過剰取引を避けるためのエントリ数制限
  • 最適な取引頻度を見つけるためにパラメータを最適化

結論

この戦略は,日々の閉店価格を比較することによって取引信号を生成する.論理はシンプルで,初心者が学ぶのに適しています.しかし,特定のリスクを含み,ライブ取引のためにさらなる最適化が必要です.


/*backtest
start: 2022-11-14 00:00:00
end: 2023-11-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("Daily Close Comparison Strategy (by ChartArt) correct results", shorttitle="CA_-_Daily_Close_Strat", overlay=false)

// ChartArt's Daily Close Comparison Strategy
//
// Version 1.0
// Idea by ChartArt on February 28, 2016.
//
// This strategy is equal to the very
// popular "ANN Strategy" coded by sirolf2009,
// but without the Artificial Neural Network (ANN).
//
// Main difference besides stripping out the ANN
// is that I use close prices instead of OHLC4 prices.
// And the default threshold is set to 0 instead of 0.0014
// with a step of 0.001 instead of 0.0001.
//
// This strategy goes long if the close of the current day
// is larger than the close price of the last day.
// If the inverse logic is true, the strategy
// goes short (last close larger current close).
//
// This simple strategy does not have any
// stop loss or take profit money management logic.
//
// List of my work: 
// https://www.tradingview.com/u/ChartArt/
// 
//  __             __  ___       __  ___ 
// /  ` |__|  /\  |__)  |   /\  |__)  |  
// \__, |  | /~~\ |  \  |  /~~\ |  \  |  
// 
// 

threshold = input(title="Price Difference Threshold correct results", type=float, defval=0, step=0.004)

getDiff() =>
    yesterday=request.security(syminfo.tickerid, 'D', close[1])
    today=close
    delta=today-yesterday
    percentage=delta/yesterday
    
closeDiff = getDiff()
 
buying = closeDiff > threshold ? true : closeDiff < -threshold ? false : buying[1]

hline(0, title="zero line")

bgcolor(buying ? green : red, transp=25)
plot(closeDiff, color=silver, style=area, transp=75)
plot(closeDiff, color=aqua, title="prediction")

longCondition = buying
if (longCondition)
    strategy.entry("Long", strategy.long)

shortCondition = buying != true
if (shortCondition)
    strategy.entry("Short", strategy.short)

もっと