视频策略代码:
//@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)
还没有评论,快来发表第一个评论!