ライオン・フリックスバランス戦略

作者: リン・ハーンチャオチャン開催日:2023年11月2日16時55分
タグ:

img

概要

ライオン・フィスチャー・バランス戦略は,移動平均のクロスオーバーに基づいた簡単な短期取引戦略である.主に2つの移動平均を使用する - 速いMAが下から緩やかなMAを超えると,ロングに行く;速いMAが上から緩やかなMAを超えると,ポジションを閉じる. 戦略名は人気のある取引用語"ライオン・フィスチャー"から来ている.これは,小規模な価格アクションを捕捉し,MA間の狭いギャップから利益を得ることを意味する.

戦略の論理

この戦略は,2つの移動平均値を使用します.高速MA (smallMAPeriod) と遅いMA (bigMAPeriod).両MAは価格チャネルを形成し,高速MAはチャネルベースであり,遅いMAはチャネル上限です.価格がチャネルベースを上向きに突破すると,ロング;価格がチャネル上限を下向きに突破すると,閉店します.

具体的には,戦略はまず速いMA (smallMA) と遅いMA (bigMA) を計算する.その後,遅いMAの (100 - %BelowToBuy) %であるバイMA (buyMA) を計算する.速いMAがバイラインを上へと越えると,ロング;1%の利益に達するか,利益なしの7バーを保持すると,ポジションを閉じる.

概要すると,この戦略は,短期的な利益のためのMA間の"ライオン・フリク"を捉えることを目的としています.また,取引リスクごとに制御するための利益とストップ・ロスの条件を設定します.

利点分析

この戦略には以下の利点があります.

  1. シンプルなコンセプトで理解し実行が簡単です.ダブルMAクロスオーバーは最も基本的な技術指標戦略です.

  2. 簡単なバックテスト.この戦略は,追加の実装なしで,直接TradingView内蔵バックテストを使用します.

  3. 強力な可視化.TradingViewは,チャート上の取引信号と統計データを直接表示することができます.

  4. 制御可能なリスク. 戦略は,取引損失を効果的に制御するために,利益を取ることとストップ損失条件を設定します.

  5. 柔軟なカスタマイゼーション.ユーザーは,異なる製品や取引スタイルに合わせてMAパラメータやその他の指標を調整できます.

リスク分析

この戦略には次のリスクもあります

  1. 潜在的に過剰なシグナル.ダブルMA戦略は,統合中に誤ったシグナルを生む傾向があります.

  2. 単一インジケーター依存性.MAクロスのみを使用すると,他の要因を無視し,信号品質が低下する可能性があります.

  3. 難しいパラメータ最適化.最適なMA組み合わせを見つけるには,広範な計算が必要です.

  4. バックテストバイアス シンプルなダブルMA戦略は,ライブ取引よりもバックテストでよく機能します.

  5. ストップ・ロスは難しい.固定ストップ・ロスのレベルは,変化する市場状況に適応できないかもしれない.

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

戦略は以下の側面から改善できます.

  1. 集約中に効果のない信号を避けるために,ボリュームや変動などの他のフィルターを追加します.

  2. 逆トレンド取引を避けるためにトレンドバイアスを組み込む.トレンド方向性を決定するために,より長い期間のMAsを追加することができます.

  3. 機械学習を使って 最適なパラメータを 見つけます 例えば 連続パラメータ最適化や 遺伝アルゴリズムです

  4. ストップ・ロスの戦略を強化し,より柔軟性を得るため,ストップ・ロスを後押しし,ストップ・ロスを適応させる.

  5. 他の指標を使用して,より高い確率のエントリーポイントを特定するために,エントリータイミングを最適化します.

  6. 定量的な研究とバックテストを行い,最適化されたパラメータセットの安定性を向上させる.

  7. パラメータの組み合わせを体系的に最適化し評価するための自動取引システムを開発する.

結論

ライオン・フィスチャー・バランス戦略は,初心者が学ぶための優れたスタート戦略です. シンプルなダブルMAクロスオーバーロジックを適用し,短期的な価格変動を把握するために利益とストップ・ロスのルールを設定します. 戦略は理解し,実行しやすく,良好なバックテスト結果を示しています. しかし,最適化困難と疑わしいライブパフォーマンスに苦しんでいます. 他の指標を組み込み,パラメータを最適化し,自動取引システムを開発することによって戦略を改善することができます. 全体的に,ライオン・フィスチャー・バランス戦略は定量取引初心者にとって素晴らしい学習プラットフォームを提供します.


/*backtest
start: 2023-10-02 00:00:00
end: 2023-11-01 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/
// © TraderHalai
// This script was born out of my quest to be able to display strategy back test statistics on charts to allow for easier backtesting on devices that do not natively support backtest engine (such as mobile phones, when I am backtesting from away from my computer). There are already a few good ones on TradingView, but most / many are too complicated for my needs.
//
//Found an excellent display backtest engine by 'The Art of Trading'. This script is a snippet of his hard work, with some very minor tweaks and changes. Much respect to the original author.
//
//Full credit to the original author of this script. It can be found here: https://www.tradingview.com/script/t776tkZv-Hammers-Stars-Strategy/?offer_id=10&aff_id=15271
//
// This script can be copied and airlifted onto existing strategy scripts of your own, and integrates out of the box without implementation of additional functions. I've also added Max Runup, Average Win and Average Loss per trade to the orignal script.
//
//Will look to add in more performance metrics in future, as I further develop this script.
//
//Feel free to use this display panel in your scripts and strategies.

//Thanks and enjoy! :)
//@version=5
// strategy("Strategy BackTest Display Statistics - TraderHalai", overlay=true, default_qty_value= 5, default_qty_type = strategy.percent_of_equity, initial_capital=10000,  commission_type=strategy.commission.percent, commission_value=0.1)

//DEMO basic strategy - Use your own strategy here -  Jaws Mean Reversion from my profile used here
source = input(title = "Source", defval = close)
smallMAPeriod = input(title = "Small Moving Average", defval = 2)
bigMAPeriod = input(title = "Big Moving Average", defval = 8)
percentBelowToBuy = input(title = "Percent below to buy %", defval = 1)

smallMA = ta.sma(source, smallMAPeriod)
bigMA =  ta.sma(source, bigMAPeriod) 
buyMA = ((100 - percentBelowToBuy) / 100) * ta.sma(source, bigMAPeriod)[0]

buy = ta.crossunder(smallMA, buyMA)
if(buy)
    strategy.entry("BUY", strategy.long)

if(strategy.openprofit >= strategy.position_avg_price * 0.01) // 1% profit target
    strategy.close("BUY")

if(ta.barssince(buy) >= 7) //Timed Exit, if you fail to make 1 percent in 7 candles.
    strategy.close("BUY")
    
///////////////////////////// --- BEGIN TESTER CODE --- ////////////////////////
// COPY below into your strategy to enable display
////////////////////////////////////////////////////////////////////////////////

// strategy.initial_capital = 50000
// // Declare performance tracking variables
// drawTester = input.bool(true, "Draw Tester")
// var balance = strategy.initial_capital
// var drawdown = 0.0
// var maxDrawdown = 0.0
// var maxBalance = 0.0
// var totalWins = 0
// var totalLoss = 0

// // Prepare stats table
// var table testTable = table.new(position.top_right, 5, 2, border_width=1)
// f_fillCell(_table, _column, _row, _title, _value, _bgcolor, _txtcolor) =>
//     _cellText = _title + "\n" + _value
//     table.cell(_table, _column, _row, _cellText, bgcolor=_bgcolor, text_color=_txtcolor)
    
// // Custom function to truncate (cut) excess decimal places
// truncate(_number, _decimalPlaces) =>
//     _factor = math.pow(10, _decimalPlaces)
//     int(_number * _factor) / _factor
    
// // Draw stats table
// var bgcolor = color.new(color.black,0)
// if drawTester
//     if barstate.islastconfirmedhistory
//         // Update table
//         dollarReturn = strategy.netprofit
//         f_fillCell(testTable, 0, 0, "Total Trades:", str.tostring(strategy.closedtrades), bgcolor, color.white)
//         f_fillCell(testTable, 0, 1, "Win Rate:", str.tostring(truncate((strategy.wintrades/strategy.closedtrades)*100,2)) + "%", bgcolor, color.white)
//         f_fillCell(testTable, 1, 0, "Starting:", "$" + str.tostring(strategy.initial_capital), bgcolor, color.white)
//         f_fillCell(testTable, 1, 1, "Ending:", "$" + str.tostring(truncate(strategy.initial_capital + strategy.netprofit,2)), bgcolor, color.white)
//         f_fillCell(testTable, 2, 0, "Avg Win:", "$"+ str.tostring(truncate(strategy.grossprofit / strategy.wintrades, 2)), bgcolor, color.white)
//         f_fillCell(testTable, 2, 1, "Avg Loss:", "$"+ str.tostring(truncate(strategy.grossloss / strategy.losstrades, 2)), bgcolor, color.white)
//         f_fillCell(testTable, 3, 0, "Profit Factor:", str.tostring(truncate(strategy.grossprofit / strategy.grossloss,2)), strategy.grossprofit > strategy.grossloss ? color.green : color.red, color.white)
//         f_fillCell(testTable, 3, 1, "Max Runup:",  str.tostring(truncate(strategy.max_runup, 2 )), bgcolor, color.white)
//         f_fillCell(testTable, 4, 0, "Return:", (dollarReturn > 0 ? "+" : "") + str.tostring(truncate((dollarReturn / strategy.initial_capital)*100,2)) + "%", dollarReturn > 0 ? color.green : color.red, color.white)
//         f_fillCell(testTable, 4, 1, "Max DD:", str.tostring(truncate((strategy.max_drawdown / strategy.equity) * 100 ,2)) + "%", color.red, color.white)
// // --- END TESTER CODE --- ///////////////

もっと