예스스탁
예스스탁 답변
2023-04-03 15:52:18
안녕하세요
예스스탁입니다.
input : tenSMAlen(10),fiftySMAlen(50),PPlen(10),PPVolLen(5);
var : upday(False),VolUpDay(False),tenSMA(0),fiftySMA(0),tx(0);
var : PPvol1(0),PPvol2(0),cnt(0),MAcross(False),PocketPivot1(False),PocketPivot2(False);
UpDay = close > open and close[0] > close[1];
VolUpDay = close[0] > close[1];
tenSMA = ma(close,tenSMAlen);
fiftySMA = ma(close,fiftySMAlen);
PPvol1 = 0;
for cnt = 1 to PPlen
{
if volume[0] > volume[cnt] Then
PPvol1 = PPvol1+ 1;
else
PPvol1 = 0;
}
PPvol2 = 0;
for cnt = 1 to PPVolLen
{
if volume[0] > volume[cnt] Then
PPvol2 = PPvol2+1;
else
PPvol2 = 0;
}
MAcross = open < tenSMA and close > tenSMA or open < fiftySMA and close > fiftySMA or
close[1] < tenSMA and close[0] > tenSMA or close[1] < fiftySMA and close[0] > fiftySMA;
PocketPivot1 = PPvol1 == PPlen and UpDay and MAcross;
PocketPivot2 = PPvol2 == PPVolLen and VolUpDay;
if PocketPivot1 == true Then
{
tx = text_new(sDate,sTime,L,"▲");
Text_SetStyle(tx,2,0);
Text_SetColor(tx,rgb(51,153,255));
Text_SetSize(tx,20);
}
if PocketPivot1 == False and PocketPivot2 == true Then
{
tx = text_new(sDate,sTime,H,"▼");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,rgb(225,225,0));
Text_SetSize(tx,20);
}
즐거운 하루되세요
> 분노의물타기 님이 쓴 글입니다.
> 제목 : 지표 작성 부탁드립니다.
> 트레이딩뷰에 있는 지표인데 예스트레이더에서 사용할 수 있도록 가공해 주시면 감사하겠습니다.
아래는 트레이딩뷰에 있는 지표 작성 코드입니다. 매번 성의있는 답변 주시는 덕에 도움 많이 받고 있습니다. 감사합니다. ~
//@version=4
study(title="Pocket Pivots", shorttitle="Pocket Pivots", overlay=true)
tenSMAlen = input(10, minval=1, title="SMA1 Length")
fiftySMAlen = input(50, minval=1, title="SMA2 Length")
PPlen = input(10, minval=5, title="Pocket Pivot Length")
PPVolLen = input(5, minval=5, title="Volume Pocket Pivot Length")
UpDay = close > open and close[0] > close[1]
VolUpDay = close[0] > close[1]
tenSMA = sma(close,tenSMAlen)
fiftySMA = sma(close,fiftySMAlen)
//Volume on the pocket pivot day has to be greater than the previous Pocket Pivot Length days - default is 10. PPvol1 must count up to PPlen
PPvol1 = 0
for i = 1 to PPlen
if volume[0] > volume[i]
PPvol1 += 1
else
PPvol1 := 0
//Volume on the pocket pivot day has to be greater than the previous Pocket Pivot Length days - default is 5. PPvol2 must count up to PPVollen
PPvol2 = 0
for i = 1 to PPVolLen
if volume[0] > volume[i]
PPvol2 += 1
else
PPvol2 := 0
//Check if price has crossed or gapped over 10 day or 50 day SMA
MAcross = open < tenSMA and close > tenSMA or open < fiftySMA and close > fiftySMA or close[1] < tenSMA and close[0] > tenSMA or close[1] < fiftySMA and close[0] > fiftySMA
//Will show indicator when Pocket Pivot Volume and KMA crosses have occured
PocketPivot1 = PPvol1 == PPlen and UpDay and MAcross
plotshape(PocketPivot1 ? 1 : na, style=shape.triangleup, location=location.belowbar, color=color.rgb(51,153,255), size=size.small)
//Will show Yellow Triangle Down indicator when Volume Pocket Pivot is met and current day close is greater than yesterday;s close
PocketPivot2 = PPvol2 == PPVolLen and VolUpDay
plotshape(PocketPivot1 != 1 and PocketPivot2 ==1 ? 1 : na, style=shape.triangledown, location=location.belowbar, color=color.rgb(225,225,0), size=size.small)
//Alerts Conditions
alertcondition(PocketPivot1 == 1, title='Pocket Pivot', message='Pocket Pivot Triggered!')
alertcondition(PocketPivot2 == 1, title='Volume Pocket Pivot', message='Volume Pocket Pivot Triggered!')