
この戦略は,市場の異常現象に基づく取引システムであり,主に木曜日の夜閉店から金曜日の閉店までの市場行動特性を利用して取引する.この戦略は,固定された入場と出場時間を採用し,反測によってこの市場モデルの有効性を検証する.この戦略は,10%の資金を使用し,単一の取引を行い,滑り点と手数料の要因を考慮して,反測結果の真偽性を確保する.
戦略の中核となるロジックは、次の主要な要素に基づいています。
この戦略は,市場異常現象に基づく古典的な取引システムであり,厳格な時間管理と保守的な資金管理によって潜在的利益を得ます.戦略の論理はシンプルですが,市場環境の変化によるリスクに注意する必要があります. リアルタイム取引では,より保守的なポジション制御とより優れたリスク管理機構を採用することを推奨しています.
/*backtest
start: 2024-11-11 00:00:00
end: 2024-12-10 08:00:00
period: 4h
basePeriod: 4h
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/
// © piirsalu
//@version=5
strategy("Gold Friday Anomaly Strategy",
default_qty_type=strategy.percent_of_equity,
slippage = 1, commission_value=0.0005,
process_orders_on_close = true,
initial_capital = 50000,
default_qty_value=500,
overlay = true)
/////////////////////////////////////////////////////////////////////////////////////
// . USER INPUTS . //
/////////////////////////////////////////////////////////////////////////////////////
// Define backtest start and end dates
st_yr_inp = input(defval=2000, title='Backtest Start Year')
st_mn_inp = input(defval=01, title='Backtest Start Month')
st_dy_inp = input(defval=01, title='Backtest Start Day')
en_yr_inp = input(defval=2025, title='Backtest End Year')
en_mn_inp = input(defval=01, title='Backtest End Month')
en_dy_inp = input(defval=01, title='Backtest End Day')
// Set start and end timestamps for backtesting
start = timestamp(st_yr_inp, st_mn_inp, st_dy_inp, 00, 00)
end = timestamp(en_yr_inp, en_mn_inp, en_dy_inp, 00, 00)
/////////////////////////////////////////////////////////////////////////////////////
// . STRATEGY LOGIC . //
/////////////////////////////////////////////////////////////////////////////////////
// Check if the current day is Friday
isFriday = (dayofweek == dayofweek.friday)
// Initialize a candle counter
var int barCounter = 0
// Increment the candle counter on each new bar
barCounter := barCounter + 1
// Define trading session time ranges
pre_mkt = time(timeframe.period, '0400-0800:23456')
mkt_hrs = time(timeframe.period, '0800-1600:23456')
eod = time(timeframe.period, '1200-1600:23456')
/////////////////////////////////////////////////////////////////////////////////////
// . STRATEGY ENTRY & EXIT . //
/////////////////////////////////////////////////////////////////////////////////////
// Enter a long position on the first candle of Friday within the backtest period
if dayofweek == 4 and time >= start and time <= end
strategy.entry("BuyOnFriday", strategy.long)
// Close the position after holding it for 4 candles
if (barCounter % 1 == 0)
strategy.close("BuyOnFriday")