[ブラックキャット] L1 マーティンゲイル頭皮戦略

作者: リン・ハーンゼロ3192, 日付: 2023-10-09 07:06:32
タグ:

マルティンゲール戦略 (MartinGale strategy) は,取引でよく使われる一般的な資金管理戦略である.これは,トレーダーが負債を毎回増やしてポジション規模を上げることで回復を求める際に用いられる.したがって,マーティンゲールは特定の戦略ではなく,補強,補強する戦略の総称である.

マルティン・ゲール戦略では,トレーダーは損失を伴う取引ごとにポジションの大きさを倍にする.これは,利益を得て利益を得るために,利益を得るために,利益を得るために,利益を得るために,利益を得ることを期待する.

マルティン・ゲイル戦略の背後にある理念は,平均法を利用することである.この戦略は,損失のたびにポジションの大きさを増加させることで,利益のある取引が最終的に発生すると仮定し,以前の損失を補うだけでなく利益を生み出します.これは,損失から迅速に回復しようとするトレーダーにとって特に魅力的かもしれません.

しかしながら,マーティンゲイル戦略には重大なリスクがあることに注意しなければならない. 取引者が継続的な損失期を経験するか,十分な資金がない場合,この戦略は大きな損失をもたらす可能性がある. この戦略は,利益の取引が特定の時間内に起こるという仮定に依存しており,特定の時間枠内で利益の取引が保証されないため,危険である. マーティン・ゲール戦略を実装することを検討するトレーダーは,自分のリスク承受力を慎重に評価し,潜在的な欠陥を十分に認識すべきである.潜在的な損失を軽減するために信頼できるリスク管理計画を確立することが非常に重要です.また,トレーダーは,この戦略がすべての市場状況に適用されない可能性があり,市場の変動に応じて調整が必要かもしれないことを認識すべきである.

簡単に言うと,マーティンゲール戦略は,損失の段階から回復しようとする試みとして,損失の度にポジションの大きさを増加させる資金管理戦略である.迅速な回復の可能性を提供する一方で,この取引方法を実行する前に,トレーダーは慎重に考慮すべき重大なリスクも存在している.

この取引の見解はあまり受け入れられていないが,私的なメッセージでこの話題について議論している人がいて,簡単な38線フレームワークを書いた.

MartinGaleのキャップ・ブレイク・戦略は,頻繁な取引によって利益を生む取引戦略である.これは移動平均線の交差点を利用して入口と出口信号を生成する.この戦略はTradingViewのPineスクリプト言語で実装されている.

この戦略は,まず,ストップ・ヘッドとストップ・ロッドレベルなどの入力変数,および取引モード ("多頭,空頭,または双向) を定義する.次に,取引モードが多頭ヘッドに設定されている場合にのみ入力を許可するルールを設定する.

戦略ロジックは単純な移動平均 (SMA) の交差信号と交差信号の定義を使用する. それは短期SMA (SMA3) と長期SMA (SMA8) を計算し,それらをグラフに描画する.crossoverSignalとcrossunderSignalの変数は交差と交差の発生を追跡するために使用され,crossoverStateとcrossunderStateの変数は交差と交差の状態を決定する.

戦略は,現在の保有量に基づいて実行される. 保有量がゼロである場合 (保有量がない場合),戦略は交差と交差事件をチェックする. 交差事件が発生し,取引パターンが多くのヘッドインを許容した場合,複数のヘッドインを入力する. 入場価格,ストップ損失価格,ストップブレーキ価格,ストップ損失価格は,現在の閉じる価格とSMA8値に基づいて計算される. 同様に,交差事件が発生し,取引パターンが空頭インを許容した場合,空頭ポジションに入り,それに応じて価格を計算する. 多頭保有が存在し,現在の閉じる価格が停止価格または停止価格に達し,交差事件が発生した場合,多頭保有が平止されます.入場価格,停止価格,停止価格,停止価格がゼロにリセットされます.

同様に,空頭保有が存在し,現在の閉じる価格が停止価格または停止損失価格に達し,交差事件が発生した場合,空頭保有を平衡させ,価格変数をリセットします.

この戦略はまた,プロットシェイプ関数を使用して,グラフ上のエントリーとアウトリープ点を描く. 上向きの三角形は入札,下向きの三角形は入札,下向きの三角形は出札,上向きの三角形は出札.

概して,マーティンゲール・シェイバー戦略は,短期間の移動平均線の交差を活用して小利益を捕獲することを目的としている.それは,止金と止損レベルによってリスク管理を実現し,異なる取引モデルが異なる市場条件に適応することを可能にする.


//@version=5
 strategy('[blackcat] L1 MartinGale Scalping Strategy', overlay=true, pyramiding = 5)
 
 // Define input variables
// martingaleMultiplier = input(2, title="加倍倍数")
 takeProfit = input(1.03, title='Take Profit')
 stopLoss = input(0.95, title='Stop Loss')
 inputTradingMode = input.string(defval='Long', options=['Long', 'Short', 'BiDir'], title='Trading Mode')
 
 //The purpose of this rule is to forbid short entries, only long etries will be placed. The rule affects the following function: 'entry'.
strategy.risk.allow_entry_in(inputTradingMode == 'Long' ? strategy.direction.long : inputTradingMode == 'Short' ? strategy.direction.short : strategy.direction.all)

// Define strategy logic 
entryPrice = 0.0
stopPrice = 0.0
takeProfitPrice = 0.0
stopLossPrice = 0.0

// Define SMA crossover and crossunder signals
sma3 = ta.sma(close, 3)
sma8 = ta.sma(close, 8)
plot(sma3, color=color.yellow)
plot(sma8, color=color.fuchsia)
crossoverSignal = ta.crossover(sma3, sma8)
crossunderSignal = ta.crossunder(sma3, sma8)
crossoverState = sma3 > sma8
crossunderState = sma3 < sma8

if strategy.position_size == 0
    if crossoverState
       strategy.entry('Buy',strategy.long)
       entryPrice := close
       stopPrice := close - stopLoss * sma8[1]
       takeProfitPrice := close + takeProfit * sma8[1]
       stopLossPrice := stopPrice
       stopLossPrice
    if crossunderState
        strategy.entry('Sell', strategy.short)
        entryPrice := close
        stopPrice := close + stopLoss *  sma8[1]
        takeProfitPrice := close - takeProfit *  sma8[1]
        stopLossPrice := stopPrice
        stopLossPrice

if strategy.position_size > 0
    if (close > takeProfitPrice or close < stopLossPrice) and crossunderState
        strategy.close('Buy')
        entryPrice := 0.0
        stopPrice := 0.0
        takeProfitPrice := 0.0
        stopLossPrice := 0.0
        stopLossPrice
    else
        strategy.entry('Buy', strategy.long)
        entryPrice := close
        stopPrice := close - stopLoss *  sma8[1]
        takeProfitPrice := close + takeProfit *  sma8[1]
        stopLossPrice := stopPrice
        stopLossPrice

if strategy.position_size < 0
    if (close > takeProfitPrice or close < stopLossPrice) and crossoverState
        strategy.close('Sell')
        entryPrice := 0.0
        stopPrice := 0.0
        takeProfitPrice := 0.0
        stopLossPrice := 0.0
        stopLossPrice
    else
        strategy.entry('Sell', strategy.short)
        entryPrice := close
        stopPrice := close + stopLoss *  sma8[1]
        takeProfitPrice := close - takeProfit *  sma8[1]
        stopLossPrice := stopPrice
        stopLossPrice

// Plot entry and exit points
plotshape(strategy.position_size > 0 and crossoverSignal, 'Buy Entry', shape.triangleup, location.belowbar, color.new(color.green, 0), size=size.small)
plotshape(strategy.position_size > 0 and (close >= takeProfitPrice or close <= stopLossPrice), 'Buy Exit', shape.triangledown, location.abovebar, color.new(color.red, 0), size=size.small)
plotshape(strategy.position_size < 0 and crossunderSignal, 'Sell Entry', shape.triangledown, location.abovebar, color.new(color.red, 0), size=size.small)
plotshape(strategy.position_size < 0 and (close >= takeProfitPrice or close <= stopLossPrice), 'Sell Exit', shape.triangleup, location.belowbar, color.new(color.green, 0), size=size.small)

もっと