예스스탁
예스스탁 답변
2023-09-19 11:58:23
안녕하세요
예스스탁입니다.
input : x1(21),alpha(1),mmdband(true);
var : x2(0),xh(0),xl(0),hl2(0);
var : a1(0),a2(0),a3(0),a4(0);
var : b1(0),Buycond(False),Sellcond(False),xs(0);
var : y1(0),aa(0),aa1(0),aa2(0),aa3(0);
x2 = atr(x1) * alpha ;
xh = close + x2;
xl = close - x2 ;
hl2 = (h+l)/2;
var1 = ma(hl2*volume * volume, Ceiling(x1/4)) / ma(volume, Ceiling(x1/4));
var2 = ma(volume * volume, Ceiling(x1/4)) / ma(volume, Ceiling(x1/4));
var3 = ma(hl2*volume * volume, Ceiling(x1/2)) / ma(volume, Ceiling(x1/2));
var4 = ma(volume * volume, Ceiling(x1/2)) / ma(volume, Ceiling(x1/2));
a1 = var1/Var2;
a2 = Var3/Var4;
a3 = 2*a1-a2;
a4 = ma(a3* volume, Ceiling(x1/2)) / ma(volume, Ceiling(x1/2));
b1 = 0.0;
b1 = iff(IsNan(b1[1]) == true , ma(close, x1) , (b1[1] * (x1 - 1) + close) / x1);
buycond = a4<=xl and close>b1;
sellcond = a4>=xh and close<b1;
xs = 0;
xs = iff(buycond == true , 1 , iff(sellcond == true , -1 , xs[1]));
y1=ma(IFf(close<Open,low,high),16);
aa=2*ema(y1,2)-ema(y1,4);
aa1=highest(high,16);
aa2=lowest(low,16);
aa3=(aa1-aa2)*0.618;
plot1(aa+aa3,"1",purple);
plot2(aa-aa3,"2",orange);
plot3(aa,"3",black);
즐거운 하루되세요
> 다올 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 적용가능하도록 변형 부탁 드립니다.
indicator("Purple Cloud [MMD]",overlay=true, timeframe="", timeframe_gaps=true)
x1 = input(21, "Period")
alpha = input.float(1, "Alpha", step = 0.1)
mmdband=input(true,'MMD Bands')
x2 = ta.atr(x1) * alpha
xh = close + x2
xl = close - x2
a1=ta.vwma(hl2*volume,math.ceil(x1/4))/ta.vwma(volume,math.ceil(x1/4))
a2=ta.vwma(hl2*volume,math.ceil(x1/2))/ta.vwma(volume,math.ceil(x1/2))
a3=2*a1-a2
a4=ta.vwma(a3,x1)
b1 = 0.0
b1 := na(b1[1]) ? ta.sma(close, x1) : (b1[1] * (x1 - 1) + close) / x1
buy = a4<=xl and close>b1
sell = a4>=xh and close<b1
xs = 0
xs := buy ? 1 : sell ? -1 : xs[1]
barcolor( color = xs==1 ? color.purple :xs==-1? color.orange:na)
plotshape(buy and xs != xs[1], title = "BUY", text = 'B', style = shape.labelup, location = location.belowbar, color= color.purple, textcolor = color.white, size = size.tiny)
plotshape(sell and xs != xs[1], title = "SELL", text = 'S', style = shape.labeldown, location = location.abovebar, color= color.orange, textcolor = color.white, size = size.tiny)
xx1 = if close < open
low
else
high
xx2 = if close[1] < open[1]
low[1]
else
high[1]
xx3 = if close[2] < open[2]
low[2]
else
high[2]
xx4 = if close[3] < open[3]
low[3]
else
high[3]
xx5 = if close[4] < open[4]
low[4]
else
high[4]
xx6 = if close[5] < open[5]
low[5]
else
high[5]
xx7 = if close[6] < open[6]
low[6]
else
high[6]
xx8 = if close[7] < open[7]
low[7]
else
high[7]
xx9 = if close[8] < open[8]
low[8]
else
high[8]
xx10 = if close[9] < open[9]
low[9]
else
high[9]
xx11 = if close[10] < open[10]
low[10]
else
high[10]
xx12 = if close[11] < open[11]
low[11]
else
high[11]
xx13 = if close[12] < open[12]
low[12]
else
high[12]
xx14 = if close[13] < open[13]
low[13]
else
high[13]
xx15 = if close[14] < open[14]
low[14]
else
high[14]
xx16 = if close[15] < open[15]
low[15]
else
high[15]
y1=(xx1+xx2+xx3+xx4+xx5+xx6+xx7+xx8+xx9+xx10+xx11+xx12+xx13+xx14+xx15+xx16)/16
aa=2*ta.ema(y1,2)-ta.ema(y1,4)
aa1=ta.highest(high,16)
aa2=ta.lowest(low,16)
aa3=(aa1-aa2)*0.618
plot(aa+aa3,color=mmdband?color.purple:na,transp=40)
plot(aa-aa3,color=mmdband?color.orange:na,transp=40)
plot(aa,color=mmdband?color.black:na,transp=40)
alertcondition(buy and xs != xs[1], "PC Long", "PC Long")
alertcondition(sell and xs != xs[1], "PC Short", "PC Short")