답변완료
지표식 변환이 가능할까요?
트레이딩뷰에서 사용하던 웨이브트렌드 라는 지표인데
예스트레이더에서 사용하고 싶은데 공부 부족으로 헤매고 있습니다ㅠ
혹시 도움을 주실수 있을까요?
(sma는 ma와 같다고 하네요)
-----------------------------------------------------------------
n1 = input(10, "Channel Length")
n2 = input(19, "Average Length")
sma1 = input(7, "SMA Length")
r=input(8, title="Period", type=integer, minval=1)
obLevel1 = input(60, "Over Bought Level 1")
obLevel2 = input(53, "Over Bought Level 2")
osLevel1 = input(-60, "Over Sold Level 1")
osLevel2 = input(-53, "Over Sold Level 2")
b=ema(close,r)
buy_g=close[3]<b
sell_g=close[3]>b
ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1,sma1)
plot(0, color=gray)
plot(obLevel1, color=red)
plot(osLevel1, color=green)
plot(obLevel2, color=red)
plot(osLevel2, color=green)
plot(wt1, color=green)
plot(wt2, color=red)
plot(crossover(wt1, wt2)and buy_g ? wt2 : na, color = black , style = circles, linewidth = 3)
plot(crossunder(wt1, wt2)and sell_g ? wt2 : na, color = black , style = circles, linewidth = 3)
plot(crossover(wt1, wt2) and buy_g ? wt2 : na, color = green , style = circles, linewidth = 2)
plot(crossunder(wt1, wt2) and sell_g ? wt2 : na, color = (wt2 - wt1 > 0 ? red : lime) , style = circles, linewidth = 2)
barcolor(crossover(wt1, wt2)and buy_g ? (wt2 - wt1 > 0 ? aqua : yellow) : na)
barcolor(crossunder(wt1, wt2)and sell_g ? (wt2 - wt1 > 0 ? aqua : yellow) : na)
bgcolor(crossover(wt1,wt2) and buy_g ? green : na, transp=75)
bgcolor(crossunder(wt1,wt2) and sell_g ? red : na, transp=75)
alertcondition(crossover(wt1,wt2) and buy_g, title='Buy', message='Buy Alert')
alertcondition(crossunder(wt1,wt2) and sell_g, title='Sell', message='Sell Alert')
2022-02-14
1414
글번호 156284
지표
답변완료
수정 부탁 드립니다.
안녕 하세요.
항상 도움 수셔서 감사드립니다.
한번더 요청을 드립니다.
1.마지막 고저라인 차트 끝까지 그려지게 수정해 주셨는데
반대 라인이 생성되면 끊어져야 되는데 계속 남아 두 라인이 있게 됩니다
수정 부탁 드리고요.
2.ZigZag 라인 상승,하락 색상을 구분해서 표시되게 부탁 드립니다.
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),
Text1(0),처리구분(""),T(0),TL21(0),TL31(0),TL4(0),TL41(0),TL5(0),TL51(0);
Array:고점[10,2](0),저점[10,2](0); //가격,위치
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and
Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then
처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then
처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
T = 1;
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and
TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(TL21);
Text_Delete(Text1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
//TL21 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+PriceScale*10,sDate[eBar],sTime[eBar],저점[1,1]+PriceScale*10);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1], NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 2, 1);
TL_SetSize(TL2,3);
TL_SetColor(TL2,REd); //저점
TL_SetSize(TL21,1);
TL_SetColor(TL21,YELLOw); //저점
}
}
If 처리구분 == "저점처리" Then
{
T = -1;
lastLoVal = L;
If 저점[1,2] < 고점[1,2] then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and
TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
TL_Delete(TL3);
TL_Delete(TL31);
Text_Delete(Text1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
//TL31 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-PriceScale*10,sDate[eBar],sTime[eBar],고점[1,1]-PriceScale*10);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(저점[1,1],1));
Text_SetStyle(Text1, 2, 10);
TL_SetSize(TL3,3);
TL_SetColor(TL3,BLUe);
TL_SetSize(TL31,1);
TL_SetColor(TL31,YELLOw);
}
}
TL_SetSize(TL1,1);
TL_SetColor(TL1,GRAy);
TL_Delete(TL4);
TL_Delete(TL41);
TL_Delete(TL5);
TL_Delete(TL51);
if T == 1 then
{
TL4 = TL_New(sDate[index-고점[1,2]],sTime[index-고점[1,2]],고점[1,1],sDate,sTime,고점[1,1]);
// TL41 = TL_New(sDate[index-고점[1,2]],sTime[index-고점[1,2]],고점[1,1]-PriceScale*10,sDate,sTime,고점[1,1]-PriceScale*10);
TL_SetColor(TL4,BLUE);
TL_SetSize(TL4,3);
TL_SetExtRight(TL4,true);
TL_SetColor(TL41,YELLOw);
TL_SetSize(TL41,1);
TL_SetExtRight(TL41,true);
TL_SetExtRight(TL2,true);
TL_SetExtRight(TL3,False);
}
if T == -1 then
{
TL4 = TL_New(sDate[index-저점[1,2]],sTime[index-저점[1,2]],저점[1,1],sDate,sTime,저점[1,1]);
//TL41 = TL_New(sDate[index-저점[1,2]],sTime[index-저점[1,2]],저점[1,1]+PriceScale*10,sDate,sTime,저점[1,1]+PriceScale*10);
TL_SetColor(TL5,REd); //저점
TL_SetSize(TL5,3);
TL_SetExtRight(TL5,true);
TL_SetColor(TL51,YELLOw); //저점
TL_SetSize(TL51,1);
TL_SetExtRight(TL51,true);
TL_SetExtRight(TL3,true);
TL_SetExtRight(TL2,False);
}
감사합니다.
2022-02-14
1417
글번호 156283
지표