
この戦略は,ダイナミックなタイムフレームの高低点突破を使用して取引信号を生成する.これは,現在のタイムフレームの最高価格と最低価格と,前回のタイムフレームのクローズアップ価格加減の一定数のポイントを比較して,買い買いをするかどうかを決定する.この方法は,異なる市場動向と変動に適応し,戦略の適応性と柔軟性を向上させる.
この戦略の核心は,異なるタイムフレームの高低点を利用して価格動きを判断することである. まず,ユーザが選択したタイムフレームに基づいて,対応する最高価格,最低価格,および閉店価格のデータを取得する. 次に,現在のタイムフレームの最高価格が前のタイムフレームの閉店価格より大きいかどうかを比較して,一定数のポイントを加算して,買入シグナルを決定する. 同様に,現在のタイムフレームの最低価格が前のタイムフレームの閉店価格より小さいかどうかを比較して,一定数のポイントを減算して,売出シグナルを決定する.
ダイナミックタイムフレーム高低点突破戦略は,異なるタイムフレームの価格データを活用して,高低点突破に基づいて取引信号を生成する.この戦略の論理は明確で,適応性が強く,実行しやすく,最適化できる.しかし,同時に,パラメータ感性,過適合,市場リスクなどの問題があり,実用化において継続的に最適化および改善する必要がある.パラメータを動的に調整し,リスク管理を導入し,他の指標と最適化コードと組み合わせた効率性などの措置をとることによって,戦略の安定性と収益性をさらに向上させ,取引を量化するための効果的なツールと考え方を提供することができる.
/*backtest
start: 2023-05-28 00:00:00
end: 2024-06-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(" NIFTY 65-15 ", overlay=true)
// Define input options for point settings and timeframe
points = input.int(60, title="Point Threshold", minval=1, step=1)
timeframe = input.timeframe("60", title="Timeframe", options=["1", "3", "5", "15", "30", "60", "240", "D", "W", "M"])
// Calculate high and low of the selected timeframe
high_timeframe = request.security(syminfo.tickerid, timeframe, high)
low_timeframe = request.security(syminfo.tickerid, timeframe, low)
close_timeframe = request.security(syminfo.tickerid, timeframe, close)
// Define conditions for Buy and Sell
buyCondition = high_timeframe > (close_timeframe[1] + points)
sellCondition = low_timeframe < (close_timeframe[1] - points)
// Entry and exit rules
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Close the positions based on the conditions
if (sellCondition)
strategy.close("Buy")
if (buyCondition)
strategy.close("Sell")
// Plot Buy and Sell signals on the chart
plotshape(series=buyCondition, title="Buy Entry", color=color.green, style=shape.triangleup, location=location.belowbar)
plotshape(series=sellCondition, title="Sell Entry", color=color.red, style=shape.triangledown, location=location.abovebar)
// Plot the equity curve of the strategy
plot(strategy.equity, title="Equity", color=color.blue, linewidth=2)