该策略是一个基于技术指标的日内多头交易策略。主要利用三种技术指标来判断多头入场时机:1. 摆动低点 2. 看涨K线形态 3. 极度超卖。同时使用ATR(Average True Range)指标来计算止损和止盈价格。该策略适用于所有周期和所有标的。
该策略主要基于以下原理: 1. 在上涨趋势中,股价经常会出现回调,形成局部低点,这些局部低点往往是很好的买入机会。策略使用摆动低点来捕捉这些买入机会。 2. 某些特殊的K线形态往往预示着趋势反转或者趋势延续,策略使用看涨三线敲击形态来判断反转买入时机。 3. 当股价连续数日下跌后,空头力量逐渐衰竭,继续下跌的空间有限,股价随时可能反弹向上,策略使用极度超卖指标来捕捉这些反转买入机会。 4. 股价波动具有周期性和相似性,可以用ATR指标来衡量,并以此计算合适的止盈止损距离。
该日内多头突破策略是一个基于摆动低点、看涨形态和超卖反转的量化交易策略。利用三种技术指标从不同角度捕捉多头买点。同时使用ATR波动率指标计算动态止盈止损位。在上涨行情中能够充分捕捉利润,但是在震荡行情中面临频繁交易风险。策略还有一些优化空间,可以考虑引入趋势判断、优化参数和指标等方法进一步提高策略效果。
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LuxTradeVenture
//@version=5
strategy("Intraday Bullish Script", overlay=true, margin_long=100, margin_short=100)
// Settings for Strategy 1
entryCondition1 = input.bool(true, title="Use Entry Condition - Strategy 1")
// Input for ATR multiplier for stop loss
atrMultiplierforstoploss = input.float(2, title="ATR Multiplier for Stop Loss")
// Input for ATR multiplier for target price
atrMultiplierforlongs = input.float(4, title="ATR Multiplier for Target Price")
// Calculate ATR
atrLength = input.int(14, title="ATR Length")
atrValue = ta.atr(atrLength)
// Swing low condition - Strategy 1
swingLow1 = low == ta.lowest(low, 12) or low[1] == ta.lowest(low, 12)
///
maj_qual = 6 //input(6)
maj_len = 30 //input(30)
min_qual = 5 //input(5)
min_len = 5 //input(5)
lele(qual, len) =>
bindex = 0.0
bindex := nz(bindex[1], 0)
sindex = 0.0
sindex := nz(sindex[1], 0)
ret = 0
if close > close[4]
bindex := bindex + 1
bindex
if close < close[4]
sindex := sindex + 1
sindex
if bindex > qual and close < open and high >= ta.highest(high, len)
bindex := 0
ret := -1
ret
if sindex > qual and close > open and low <= ta.lowest(low, len)
sindex := 0
ret := 1
major = lele(maj_qual, maj_len)
minor = lele(min_qual, min_len)
ExaustionLow = major == 1 ? 1 : 0
Bullish3LineStrike = close[3] < open[3] and close[2] < open[2] and close[1] < open[1] and close > open[1]
// Entry and Exit Logic for Strategy 2
// Create variables to track trade directions and entry prices for each strategy
var int tradeDirection1 = na
var float entryLongPrice1 = na
// Calculate entry prices for long positions - Strategy 1
if (swingLow1 or Bullish3LineStrike)
entryLongPrice1 := close
tradeDirection1 := 1
// Calculate target prices for long positions based on ATR - Strategy 1
targetLongPrice1 = entryLongPrice1 + (atrMultiplierforlongs * atrValue)
// Calculate stop loss prices for long positions based on entry - Strategy 1
stopLossLongPrice1 = entryLongPrice1 - (atrMultiplierforstoploss * atrValue)
// Entry conditions for Strategy 1
if (tradeDirection1 == 1 and (swingLow1 or Bullish3LineStrike))
strategy.entry("Long - Strategy 1", strategy.long)
// Exit conditions for long positions: When price reaches or exceeds the target - Strategy 1
if (close >= targetLongPrice1)
strategy.close("Long - Strategy 1", comment="Take Profit Hit")
// Exit conditions for long positions: When price hits stop loss - Strategy 1
if (close <= stopLossLongPrice1)
strategy.close("Long - Strategy 1", comment="Stop Loss Hit")