K线课堂丨内包K线:可靠的建仓形态

K线课堂丨内包K线:可靠的建仓形态

00:00
24:54

视频策略代码:


//@version=4

strategy("内包k线做多策略", overlay=true)


// 计算条件

high_condition = high[2] > high[1] and low[2] < low[1]

entry_condition = close > open and close > close[1]

downtrend_condition = high < high[3] and high[3] < high[6]


// 计算KDJ指标

length = 14

highestHigh = highest(high, length)

lowestLow = lowest(low, length)

rsv = (close - lowestLow) / (highestHigh - lowestLow) * 100

fastK = ema(rsv, 3)

slowK = ema(fastK, 3)

slowD = ema(slowK, 3)

kdj_k_condition = slowK < 30


PV = abs(highest(6)-lowest(6)) * 0.2 *100



// 做多信号

if (high_condition and entry_condition and downtrend_condition and kdj_k_condition)

    strategy.entry("做多", strategy.long)


// 止盈设置

strategy.exit("止盈", "做多", profit=PV,loss=PV)



以上内容来自专辑
用户评论

    还没有评论,快来发表第一个评论!