예스스탁
예스스탁 답변
2020-04-28 11:00:52
안녕하세요
예스스탁입니다.
1 지표
input : vortexLen(30),emaLen(10),colorBars(true),plotVLines(false);
var : posSum(0),negSum(0),tRange(0),vmPlus(0),vmNeg(0);
var : plusEMA(0),negEMA(0),vDiff(0),vColor(0);
posSum = AccumN(abs(high - low[1]), vortexLen);
negSum = AccumN(abs(low - high[1]), vortexLen);
tRange = AccumN(atr(1), vortexLen);
vmPlus = posSum / tRange;
vmNeg = negSum / tRange;
plusEMA = ema(vmPlus, emaLen);
negEMA = ema(vmNeg, emaLen);
vDiff = abs(plusEMA - negEMA);
// PLOTTING:
vColor = iff(plusEMA > negEMA and plusEMA >= plusEMA[1] ,red ,
iff(plusEMA > negEMA and plusEMA < plusEMA[1] ,MAGENTA,
iff( negEMA >= plusEMA and negEMA > negEMA[1] , CYAN,
iff(negEMA > plusEMA and negEMA < negEMA[1] ,BLUE,vcolor))));
plot1(vDiff,"diff",vColor);
plot2(iff(plotVLines,plusEMA,nan),"VI +",green);
plot3(iff(plotVLines,negEMA,nan),"VI -",red);
2 강조
input : vortexLen(30),emaLen(10),colorBars(true),plotVLines(false);
var : posSum(0),negSum(0),tRange(0),vmPlus(0),vmNeg(0);
var : plusEMA(0),negEMA(0),vDiff(0),vColor(0);
posSum = AccumN(abs(high - low[1]), vortexLen);
negSum = AccumN(abs(low - high[1]), vortexLen);
tRange = AccumN(atr(1), vortexLen);
vmPlus = posSum / tRange;
vmNeg = negSum / tRange;
plusEMA = ema(vmPlus, emaLen);
negEMA = ema(vmNeg, emaLen);
vDiff = abs(plusEMA - negEMA);
// PLOTTING:
vColor = iff(plusEMA > negEMA and plusEMA >= plusEMA[1] ,red ,
iff(plusEMA > negEMA and plusEMA < plusEMA[1] ,MAGENTA,
iff( negEMA >= plusEMA and negEMA > negEMA[1] , CYAN,
iff(negEMA > plusEMA and negEMA < negEMA[1] ,BLUE,vcolor))));
if colorBars == true then
{
PlotPaintBar(H,L,"강조",vColor);
}
즐거운 하루되세요
> thegin 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> // INPUT VARIABLES FOR VORTEX:
vortexLen = input(30, title="Length for Vortex", minval=1)
emaLen = input(10, title="Length of Positive and Negative EMA's", type=input.integer, minval=1)
colorBars = input(true, title="Color Price Bars Based on Vortex?")
plotVLines = input(false, title="Plot VI+ and VI- Lines?")
// VORTEX CALCULATION:
//Returns positive and negative trendlines.
vortex(posSum, negSum, vLen)=>
tRange = sum(atr(1), vLen)
vmPlus = posSum / tRange
vmNeg = negSum / tRange
[vmPlus, vmNeg]
[vPlus, vNeg] = vortex(sum(abs(high - low[1]), vortexLen), sum(abs(low - high[1]), vortexLen), vortexLen)
plusEMA = ema(vPlus, emaLen)
negEMA = ema(vNeg, emaLen)
vDiff = abs(plusEMA - negEMA)
// PLOTTING:
var color vColor = na
vColor := plusEMA > negEMA and plusEMA >= plusEMA[1] ? #1b5e20 : plusEMA > negEMA and plusEMA < plusEMA[1] ? #a5d6a7 : negEMA >= plusEMA and negEMA > negEMA[1] ? #b71c1c : negEMA > plusEMA and negEMA < negEMA[1] ? #c76a72 : nz(vColor[1])
plot(vDiff, style=plot.style_histogram, color=vColor, linewidth=3, transp=0)
plot(plotVLines ? plusEMA : na, title="VI +", color=color.green, linewidth=2)
plot(plotVLines ? negEMA : na, title="VI -", color=color.red, linewidth=2)
barcolor(colorBars ? vColor : na)
항상 도움주심을 감사드립니다.
좋은 하루 되세요