
岩のように堅い海戦略は,ブレイディの海取引法を従う定量取引戦略である.これは価格突破入場,止損追跡止損出場の方法を採用し,実際の波幅に基づいてポジションの規模を計算し,単一の損失を厳格に制御する.この戦略は,長期にわたって安定して動作し,堅い岩のように反転に抵抗する.
岩のように堅い海戦略は,突破入場である。具体的には,入力された突破周期パラメータに基づいて,特定の周期内の最高価格と最低価格をそれぞれ計算する。価格が最高価格を破るとき,多入場を行う;価格が最低価格を破るとき,空き入場を行う。
例えば,入場周期パラメータが20Kラインに設定された場合,戦略は最近20Kラインの最高価格と最低価格を抽出する.現在のKラインの閉店価格が過去20Kラインの最高価格より高い場合,戦略は,その閉店価格の位置で多発ストップを発行し,最高価格の入場を突破するのを待つ.
ストップ・トラッキング・ストップ・アウト・ゲームでは,入力されたアウト・サイクルのパラメータに基づいて,特定のサイクルの最高価格と最低価格を動的に計算します.これは戦略の退出チャネルになります.
持ったとき,出口の最低価格を下回った場合,ポジションの止損は退出する.逆に持ったとき,空いたとき,価格が出口の最高価格を下回った場合,ポジションの止損は退出する.
さらに,戦略は,実際の波幅に基づいてストップ・ロスを計算し,最後のストップ・ローズとして使用する.価格が退出チャネルを突破しない限り,ストップ・ロスは修正を常に追跡し,ストップ・ロスの距離がちょうど良いことを確保し,不要なストップを誘導する過剰な激進化も行われず,損失を効果的に制御できない距離も行われません.
岩のように堅固な海戦略は,実際の波幅に基づいて単一の取引規模を計算する.具体的には,最初に入場価格の近くの潜在的な損失の割合を計算し,次に,期待されるリスクパラメータに基づいて取引規模を反転させる.これは,取引毎の最大損失を効果的に制御する.
岩のように堅固な海戦略は,ブレイディ海取引法を従い,入場規則と出場規則を厳格に執行し,気まぐれに変化させない.これは,戦略を長期的に安定して動作させ,一時的な判断誤りによりシステムの障害を引き起こさないようにする.
戦略は,価格突破入場方法を採用し,高水準のFault入場のリスクを効果的に回避し,その結果,系統的な損失の可能性を減らすことができます.同時に,ストップ・ロース・トラッキング・ストップを採用し,単一の損失を制御し,連続的な損失による下落や撤回を最大限に抑制します.
戦略は,実際の波幅を計算してポジションを計算し,取引毎の最大損失を許容範囲内で厳格に制御し,単一の大きな損失によるリスク過剰を回避する.同時に,ストップ・損失追跡方法を採用し,ストップ・損失距離を適切に確保し,タイムリーにストップ・損失を発生させ,リスクを効果的に制御する.
状況が良くない振動突破は,偽信号が形成されやすいため,システム誤入場損失が発生する.この場合,入場確認条件を増やし,無効突破の騒音干渉を避けるためにパラメータを調整する必要があります.
入場周期,出場周期などの戦略のパラメータは静的な設定である.市場環境が大きく変化した場合,これらのパラメータ設定は失効する可能性がある.この場合,パラメータ設定を再評価し,新しい市場状態に適応するためにパラメータを最適化する必要があります.
戦略は,価格突破を判断するフラグなどの技術指標を使用している.市場動向や変動パターンが大きく変化すると,これらの技術指標は失効する可能性があります.この場合,より多くの技術指標判断を導入し,戦略の信頼性を全体的に最適化する必要があります.
策略に通常使用されるトレンド判断指標,例えばMA,MACDなどを加えることができます. 高いトレンドを判断する多量作業,低いトレンドを判断する空調作業を行うと,逆操作の損失を減らすことができます.
高級時間枠の技術指標を導入して総合判断を行うことができる.例えば86400レベルのMA線位置は,全体的な走行方向を判断し,分時図上の操作信号をさらに確認することができる.
機械学習などの手段により,歴史的データに基づいてパラメータを自動的に最適化し,市場環境の変化に適応するためにパラメータをリアルタイムで調整できます.これは,戦略をより適応的かつ安定させることができます.
岩のように堅固な海戦略は古典的な海取引の法則に従っており,価格突破入場とストップ・ローズ・トラッキングストップ・アウト場で,リスクを厳格に制御し,長期にわたって安定して動作し,優れた反転撤回能力を有している.いくつかの突破失敗,パラメータ失敗などのリスクは依然として予防する必要があるが,トレンド判断,タイムフレーム判断,ダイナミックパラメータ最適化などの手段を導入することにより,これらのリスクを効果的に軽減し,戦略の安定した動作能力を大幅に向上させることができる.全体的に言えば,この戦略は,非常に優れた安定性と反転撤回能力を有しており,信頼性と価値を持つ.
/*backtest
start: 2024-01-18 00:00:00
end: 2024-02-17 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("Real Turtle", shorttitle = "Real Turtle", overlay=true, pyramiding=1, default_qty_type= strategy.percent_of_equity,calc_on_order_fills=false, slippage=25,commission_type=strategy.commission.percent,commission_value=0.075)
//////////////////////////////////////////////////////////////////////
// Testing Start dates
testStartYear = input(2016, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
//Stop date if you want to use a specific range of dates
testStopYear = input(2030, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
// A switch to control background coloring of the test period
// Use if using a specific date range
testPeriodBackground = input(title="Color Background?", type=bool, defval=false)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=97)
testPeriod() => true
// Component Code Stop
//////////////////////////////////////////////////////////////////////
//How many candles we want to determine our position entry
enterTrade = input(20, minval=1, title="Entry Channel Length")
//How many candles we want ot determine our position exit
exitTrade = input(10, minval=1, title="Exit Channel Length")
//True Range EMA Length
trLength = input(13, minval=1, title="True Range Length")
//Go all in on every trade
allIn = input(false, title="Use whole position on every trade")
dRisk = input(2, "Use Desired Risk %")
//How much of emaTR to use for TS offset
multiEmaTR = input(2, "Desired multiple of ema Tr (N)")
//absolute value (highest high of of this many candles - lowest high of this many candles) . This is used if we want to change our timeframe to a higher timeframe otherwise just works like grabbing high o r low of a candle
//True range is calculated as just high - low. Technically this should be a little more complicated but with 24/7 nature of crypto markets high-low is fine.
trueRange = max(high - low, max(high - close[1], close[1] - low))
//Creates an EMA of the true range by our custom length
emaTR = ema(trueRange, trLength)
//Highest high of how many candles back we want to look as specified in entry channel for long
longEntry = highest(enterTrade)
//loweest low of how many candles back we want to look as specified in exit channel for long
exitLong = lowest(exitTrade)
//lowest low of how many candles back want to look as specified in entry channel for short
shortEntry = lowest(enterTrade)
//lowest low of how many candles back want to look as specified in exit channel for short
exitShort = highest(exitTrade)
//plots the longEntry as a green line
plot(longEntry[1], title="Long Entry",color=green)
//plots the short entry as a purple line
plot(shortEntry[1], title="Short Entry",color=purple)
howFar = barssince(strategy.position_size == 0)
actualLExit = strategy.position_size > 0 ? strategy.position_avg_price - (emaTR[howFar] * multiEmaTR) : longEntry - (emaTR * multiEmaTR)
actualLExit2 = actualLExit > exitLong ? actualLExit : exitLong
actualSExit = strategy.position_size < 0 ? strategy.position_avg_price + (emaTR[howFar] * multiEmaTR) : shortEntry + (emaTR * multiEmaTR)
actualSExit2 = actualSExit < exitShort ? actualSExit : exitShort
//plots the long exit as a red line
plot(actualLExit2[1], title="Long Exit",color=red)
//plots the short exit as a blue line
plot(actualSExit2[1], title="Short Exit",color=yellow)
//Stop loss in ticks
SLLong =(emaTR * multiEmaTR)/ syminfo.mintick
SLShort = (emaTR * multiEmaTR)/ syminfo.mintick
//Calculate our potential loss as a whole percentage number. Example 1 instead of 0.01 for 1% loss. We have to convert back from ticks to whole value, then divided by close
PLLong = ((SLLong * syminfo.mintick) * 100) / longEntry
PLShort = ((SLShort * syminfo.mintick) * 100) / shortEntry
//Calculate our risk by taking our desired risk / potential loss. Then multiple by our equity to get position size. we divide by close because we are using percentage size of equity for quantity in this script as not actual size.
//we then floor the value. which is just to say we round down so instead of say 201.54 we would just input 201 as TV only supports whole integers for quantity.
qtyLong = floor(((dRisk / PLLong) * strategy.equity) /longEntry )
qtyShort = floor(((dRisk / PLShort) * strategy.equity) /shortEntry )
qtyLong2 = allIn ? 100 : qtyLong
qtyShort2 = allIn ? 100 : qtyShort
//Only open long or short positions if we are inside the test period specified earlier
if testPeriod()
//Open a stop market order at our long entry price and keep it there at the quantity specified. This order is updated/changed on each new candlestick until a position is opened
strategy.entry("long", strategy.long, stop = longEntry, qty = qtyLong2)
//sets up or stop loss order by price specified in our actualLExit2 variable
strategy.exit("Stoploss-Long", "long", stop=actualLExit2)
//Open a stop market order at our short entry price and keep it there at the quantity specified. This order is updated/changed on each new candlestick until a position is opened
strategy.entry("short", strategy.short, stop = shortEntry, qty = qtyShort2)
//sets up or stop loss order by price specified in our actualLExit2 variable
strategy.exit("Stoploss-Short", "short", stop=actualSExit2)