“价量突破买入策略”是一种旨在通过检测在指定的蜡烛图范围内同时出现价格和交易量突破来识别买入机会的交易策略。该策略首先将特定数量的蜡烛线作为价格和交易量的检查窗口。这些值被用作基准来识别突破条件。当收盘价和交易量都超过预定窗口内观察到的最大值时,交易就会开始。价格必须高于指定的移动平均线,作为趋势指标,确保所有交易都与主流市场趋势一致。
“价量突破买入策略”是一种适用于高波动性市场的趋势追踪策略。通过同时考虑价格和交易量的突破,并结合长期SMA作为趋势过滤,该策略可以较好地捕捉强势行情中的交易机会。但是,该策略在趋势不明显或者波动性较小的市场中可能表现不佳,并且可能面临频繁交易的风险。因此,在实际应用中,需要根据不同的市场特点和个人交易风格,对该策略进行适当的优化和调整,以提高其稳定性和盈利能力。
/*backtest start: 2023-05-11 00:00:00 end: 2024-05-16 00:00:00 period: 1d basePeriod: 1h 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/ // © tradedots //@version=5 strategy("Price and Volume Breakout Buy Strategy [TradeDots]", overlay=true, initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 70, commission_type = strategy.commission.percent, commission_value = 0.01) input_price_breakout_period = input.int(60, "Price Breakout Period") input_volume_breakout_period = input.int(60, "Volume Breakout Period") input_trendline_legnth = input.int(200, "Trendline Length") input_order_direction = input.string("Long", options = ["Long", "Short", "Long and Short"], title = "Order Direction") price_highest = ta.highest(input_price_breakout_period) price_lowest = ta.lowest(input_price_breakout_period) volume_highest = ta.highest(volume, input_volume_breakout_period) // Long Orders if close > price_highest[1] and volume > volume_highest[1] and close > ta.sma(close, input_trendline_legnth) and strategy.opentrades == 0 and input_order_direction != "Short" strategy.entry("Long", strategy.long) // line.new(bar_index[input_price_breakout_period], price_highest[1], bar_index, price_highest[1], color = #9cff87, width = 2) // label.new(bar_index,low, "🟢 Breakout Buy", style = label.style_label_up, color = #9cff87) // Close when price is below moving average for 5 consecutive days if close < ta.sma(close, input_trendline_legnth) and close[1] < ta.sma(close, input_trendline_legnth) and close[2] < ta.sma(close, input_trendline_legnth) and close[3] < ta.sma(close, input_trendline_legnth) and close[4] < ta.sma(close, input_trendline_legnth) and strategy.opentrades.size(strategy.opentrades - 1) > 0 strategy.close("Long") // label.new(bar_index, high, "🔴 Close Position", style = label.style_label_down, color = #f9396a, textcolor = color.white) // Short Orders if close < price_lowest[1] and volume > volume_highest[1] and close < ta.sma(close, input_trendline_legnth) and strategy.opentrades == 0 and input_order_direction != "Long" strategy.entry("Short", strategy.short) // line.new(bar_index[input_price_breakout_period], price_lowest[1], bar_index, price_lowest[1], color = #f9396a, width = 2) // label.new(bar_index,high , "🔴 Breakout Sell", style = label.style_label_down, color = #f9396a, textcolor = color.white) // Close when price is above moving average for 5 consecutive days if close > ta.sma(close, input_trendline_legnth) and close[1] > ta.sma(close, input_trendline_legnth) and close[2] > ta.sma(close, input_trendline_legnth) and close[3] > ta.sma(close, input_trendline_legnth) and close[4] > ta.sma(close, input_trendline_legnth) and strategy.opentrades.size(strategy.opentrades - 1) < 0 strategy.close("Short") // label.new(bar_index, low, "🟢 Close Position", style = label.style_label_up, color = #9cff87) plot(ta.sma(close, input_trendline_legnth), color = color.white, linewidth = 2) plotcandle(open, high, low, close, title='Candles', color = (close > ta.sma(close, input_trendline_legnth) ? #9cff87 : #f9396a), wickcolor=(close > ta.sma(close, input_trendline_legnth) ? #9cff87 : #f9396a), force_overlay = true)