この戦略は,ビル・ウィリアムズの魚指数に基づいているが,別の価格入力Heiken Ashi線を使用している.これは1分から5分間の時間枠に適用されるショートラインスカルピング戦略である.
この戦略の主な取引原則は以下の通りです.
標準のではなくハイケン・アシを価格の入力として使用する。ハイケン・アシは市場の騒音をフィルターしてトレンドを識別する。
ビル・ウィリアムズ魚指標の3つの平均線:下線,歯線,唇線を適用する.それらは移動平均と同じで,トレンドの方向を判断する.
3つの均線が下線最低,歯線中,唇線最高と並べられているとき,多頭傾向を表す.下線最高,歯線中,唇線最低と並べられているとき,空頭傾向を表す.
Heiken Ashiの実体方向と魚線並列の状況によって判断され,入場する.実体が上向きで魚線が並列して見多ければ,見多めにする.実体が下向きで魚線が並列して見空ならば,見空する.
釣り糸の並び順が変化すると,トレンドが逆転することを示す.
固定ストップ,ストップ・ロスの数設定によるリスク管理. 選択可能な目標利益ポイント,ストップ・ロスの数,トラッキング・ストップ・ロスは,各個損失を制御する.
この戦略は,Heiken Ashiのトレンド識別と,魚線の反転判断の両方を用いた2つのフィルターを組み合わせ,高確率のショートライン取引戦略を形成する.
この戦略の主な利点は以下の通りです.
双指数フィルタリングにより偽信号が減少する.ハイケン・アシと魚線の組み合わせにより信号の質が向上する.
明確な直感的なトレンド判断 釣り糸の配列ははっきりと信頼でき,曖昧な状況が生じない
効率的なショートライン取引のキャプチャ. 1分から5分周期のスカルピング取引に適しています.
シンプルなパラメータ設定.複雑な最適化を必要とせず,少数のパラメータを使用できます.
厳格なリスク管理. ストップ・ストップ・ストップ・ポイントを使用し,各損失を制御する.
明確な入場・退出メカニズム 釣り行列の変化に応じて平仓を開く
この戦略は,初心者でも簡単に使用できます.
この戦略の主なリスクは
撤回リスク: 魚線が頻繁に信号を発信するので,取引頻度や滑り場コストが増加する.
振動の危険 整合の際に線が頻繁に交差し,誤信号が生じます
過剰最適化のリスク.パラメータを不適切に最適化すると,曲線が過剰に適合する可能性があります.
指数の失敗のリスク. 市場の極端な状況では,釣り糸は完全に失敗する可能性があります.
ストップダメージは突破されるリスクである. 急速な突破はストップダメージを誘発して損失を引き起こす可能性がある.
取引頻度が高いリスク. 取引頻度が高いと取引コストが増加し,不必要なスライドポイントの損失が発生する.
期待管理,最適化ストップ・ロズ戦略,取引頻度制御などの方法によって上記のリスクを緩和することができる.
この戦略は以下の点で最適化できます.
他の指標を統合して信号フィルタリングを行い,勝利率を上げます.例えば,RSIなどの強い指標を組み合わせます.
ATRのダイナミックストップを設定して,単一損失のリスクを制御する.
ポジション管理モジュールを追加し,ポジション開設毎の規模を最適化します.トレンドがより明るくなり,ポジションを拡大できます.
グラフィックスや形状などの技術分析方法と組み合わせて,入学の正確性を向上させる.
市場タイプ (株式,外貨など) に応じてパラメータを最適化して,その品種に適したものにします.
機械学習モジュールを追加し,パラメータの自己適応最適化を実現する.
Expectancyの勝率を計算し,ストップ・ストップ・損失比率を最適化する.
この戦略は,継続的に改善することで,安定したショートライン取引戦略の1つになる可能性があります.
この戦略は,ハイケン・アシとビル・ウィリアムズ魚指数を用いて,高確率のショートライン取引戦略を形成する.指数の二重フィルター,簡単なパラメータ設定,明確な入場・退出機構などの利点があり,トレンドの変化を効果的にキャプチャしてスカルピング取引を行うことができる.しかし,市場で発生するウィップサウスの取引ミスを警戒し,ストップ・ロスのリスクを制御する必要もある.この戦略は,継続的な最適化により,比較的安定したショートライン取引システムになる.
/*backtest
start: 2022-09-18 00:00:00
end: 2023-09-24 00:00:00
period: 4d
basePeriod: 1d
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/
// © 03.freeman
//Scalping strategy based on Bill Williams Alligator technique but applied to heikin ashi candles
//This strategy has to be applied to standard candles and low time frames (1min to 5min)
//@version=4
strategy("Bill Williams Alligator improved", shorttitle="Scalping alligator",overlay=true)
//source = input(close)
useHA = input (true,"Use heikin ashi candle?")
// ----------MA calculation - ChartArt-------------
smoothinput = input(1, minval=1, maxval=5, title='Moving Average Calculation: (1=SMA), (2=EMA), (3=WMA), (4=Linear), (5=VWMA)')
calc_ma(src,l) =>
smoothinput == 1 ? sma(src, l):smoothinput == 2 ? ema(src, l):smoothinput == 3 ? wma(src, l):smoothinput == 4 ? linreg(src, l,0):smoothinput == 5 ? vwma(src,l):na
//----------------------------------------------
heikinashi_close = security(heikinashi(syminfo.tickerid), timeframe.period, close)
heikinashi_open = security(heikinashi(syminfo.tickerid), timeframe.period, open)
heikinashi_hl2 = security(heikinashi(syminfo.tickerid), timeframe.period, hl2)
direzione=heikinashi_close>heikinashi_open and heikinashi_close[1]>heikinashi_open[1]? 1 : heikinashi_close<heikinashi_open and heikinashi_close[1]<heikinashi_open[1]? -1 : 0
jawLength = input(13, minval=1, title="Jaw Length")
teethLength = input(8, minval=1, title="Teeth Length")
lipsLength = input(5, minval=1, title="Lips Length")
jawOffset = input(8, title="Jaw Offset")
teethOffset = input(5, title="Teeth Offset")
lipsOffset = input(3, title="Lips Offset")
jaw = calc_ma(heikinashi_hl2, jawLength)
teeth = calc_ma(heikinashi_hl2, teethLength)
lips = calc_ma(heikinashi_hl2, lipsLength)
plot(jaw, title="jaw",offset = jawOffset, color=#3BB3E4)
plot(teeth, title="teeth",offset = teethOffset, color=#FF006E)
plot(lips, title="lips",offset = lipsOffset, color=#36C711)
longCondition = direzione[0]==1 and jaw<teeth and jaw<lips and teeth<lips
shortCondition = direzione[0]==-1 and jaw>teeth and jaw>lips and teeth>lips
// Strategy: (Thanks to JayRogers)
// === STRATEGY RELATED INPUTS ===
//tradeInvert = input(defval = false, title = "Invert Trade Direction?")
// the risk management inputs
inpTakeProfit = input(defval = 0, title = "Take Profit Points", minval = 0)
inpStopLoss = input(defval = 0, title = "Stop Loss Points", minval = 0)
inpTrailStop = input(defval = 0, title = "Trailing Stop Loss Points", minval = 0)
inpTrailOffset = input(defval = 0, title = "Trailing Stop Loss Offset Points", minval = 0)
// === RISK MANAGEMENT VALUE PREP ===
// if an input is less than 1, assuming not wanted so we assign 'na' value to disable it.
useTakeProfit = inpTakeProfit >= 1 ? inpTakeProfit : na
useStopLoss = inpStopLoss >= 1 ? inpStopLoss : na
useTrailStop = inpTrailStop >= 1 ? inpTrailStop : na
useTrailOffset = inpTrailOffset >= 1 ? inpTrailOffset : na
// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() => direzione[0]==1 and jaw<teeth and jaw<lips and teeth<lips // functions can be used to wrap up and work out complex conditions
exitLong() => jaw>teeth or jaw>lips or teeth>lips
strategy.entry(id = "Buy", long = true, when = enterLong() ) // use function or simple condition to decide when to get in
strategy.close(id = "Buy", when = exitLong() ) // ...and when to get out
// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() => direzione[0]==-1 and jaw>teeth and jaw>lips and teeth>lips
exitShort() => jaw<teeth or jaw<lips or teeth<lips
strategy.entry(id = "Sell", long = false, when = enterShort())
strategy.close(id = "Sell", when = exitShort() )
// === STRATEGY RISK MANAGEMENT EXECUTION ===
// finally, make use of all the earlier values we got prepped
strategy.exit("Exit Buy", from_entry = "Buy", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
strategy.exit("Exit Sell", from_entry = "Sell", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
// === Backtesting Dates === thanks to Trost
testPeriodSwitch = input(false, "Custom Backtesting Dates")
testStartYear = input(2020, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testStartHour = input(0, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,testStartHour,0)
testStopYear = input(2020, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testStopHour = input(23, "Backtest Stop Hour")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,testStopHour,0)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false
isPeriod = true
// === /END
if not isPeriod
strategy.cancel_all()
strategy.close_all()