<div>length = input(title="CCI周期", type="number", value=200);
lengthph = input(title="平滑周期", type="number", value=10);
lengthphz = input(title="平滑增值", type="number", value=10);
up = input(title="区域上限", type="number", value=100);
down = input(title="区域下限", type="number", value=-100);
lineup = input(title="超级上限", type="number", value=300);
linedown = input(title="超级下限", type="number", value=-300);
linem = input(title="零轴", type="number", value=0);
tp = (high+low+close) / 3;
mt = ma(tp,length);
md = ma(abs(mt-tp),length);
cci = (tp-mt) / md /0.015;
draw(cci, title="CCI", color="red", showpricevalue=true, showtitle=true);
drawBand(up, down, title="常态区域", color="#FFF", transp=0.1);
draw(lineup, title="超级上限", linewidth=1, style="dashline", color="#FFF", transp=0.3);
draw(linedown, title="超级下限", linewidth=1, style="dashline", color="#FFF", transp=0.3);
draw(linem, title="零轴", linewidth=1, style="dashline", color="#FFF", transp=0.3);
draw(ma(ma(cci,lengthph),lengthph + lengthphz), title="MCCI", color="#FFF", showpricevalue=true, showtitle=true);</div> |