
この戦略は”火曜日の反転戦略 ((週末のフィルター) “と呼ばれ,主な考え方は平均線および他のフィルター条件に基づいて,条件を満たした月曜日の開盤買い,水曜日の開盤売り,火曜日の反転の動きを捕捉する.この戦略は,RSI,ATRなどの指標をフィルターし,5月などの特定の時間を除外して,戦略の勝率と利益リスク比率を向上させる.
火曜日の逆転戦略 ((週末のフィルター) は,平均線,RSI,ATRなどの指標の組み合わせを判断し,特定の時間に買い物指数,火曜日の逆転の動きを捕捉する.戦略の取引頻度は低く,手数料コストは低く,時間帯のフィルターと指標のフィルターにより,戦略の勝率とリスク収益比率が向上する.しかし,戦略には一定の制限とリスクがあります.
/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © muikol
//@version=5
strategy("Turnaround Tuesday", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.035)
// Inputs for MA period, filter_1, filter_2, month filter, and testing period
ma_period = input(30, title="Moving Average Period")
use_filter_1 = input(true, title="Use RSI Filter")
use_filter_2 = input(true, title="Use ATR Filter")
use_month_filter = input(true, title="Exclude May")
start_date = input(defval=timestamp("2009-01-01 00:00:00"), title="Start Backtest")
end_date = input(defval=timestamp("2025-01-01 00:00:00"), title="End Backtest")
// Data calculations
MA_tt = ta.sma(close, ma_period)
atr10 = ta.atr(10)
rsi3 = ta.rsi(close, 3)
c_1 = close[1]
// Entry conditions
isMonday = dayofweek == dayofweek.monday
bear = close[1] < MA_tt[1]
filter_1 = use_filter_1 ? rsi3[1] < 51 : true
filter_2 = use_filter_2 ? c_1/atr10[1] < 95 : true
notMay = use_month_filter ? month != 5 : true
entryCondition = isMonday and bear and notMay and filter_1 and filter_2
// Date check
inTestPeriod = true
// Exit conditions
isWednesdayOpen = dayofweek == dayofweek.wednesday
// Entry and exit triggers
if entryCondition and inTestPeriod
strategy.entry("Buy", strategy.long)
if isWednesdayOpen and strategy.position_size > 0 and inTestPeriod
strategy.close("Buy")
// Plot the moving average
plot(MA_tt, title="Moving Average", color=color.blue)