예스스탁
예스스탁 답변
2024-11-01 15:47:57
안녕하세요
예스스탁입니다.
if 조건 then
{
실행문1;
실행문2;
실행문3;
....
}
if문에 포함되는 실행문이 여러개일경우 {}로 묶으셔야 합니다.
input : pd(22), bbl(20), mult(2.0), lb(50), ph(0.85), pl(1.01);
var : wvf(0),sDev(0),midLine(0), upperBand(0), rangeHigh(0),color(0), OverSold(0),TL1(0), TX1(0), TL2(0), TX2(0) ;
var : wvf_inv(0), sDev2(0),midLine2(0), upperBand2(0), rangeHigh2(0),color2(0), Overbought(0);
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100;
wvf_inv = ((high-lowest(close, pd))/lowest(close, pd))*100;
sDev = mult * std(wvf, bbl);
midLine = ma(wvf, bbl);
upperBand = midLine + sDev;
rangeHigh = (highest(wvf, lb)) * ph;
sDev2 = mult * std(wvf_inv, bbl);
midLine2 = ma(wvf_inv, bbl);
upperBand2 = midLine2 + sDev2;
rangeHigh2 = (highest(wvf_inv, lb)) * ph;
if wvf >= upperBand or wvf >= rangeHigh Then
OverSold = 1;
Else
OverSold = 0;
color = iff(OverSold == 1, RGB(000,255,000), RGB(128,128,128));
if wvf_inv >= upperBand2 or wvf_inv >= rangeHigh2 Then
Overbought = 1;
Else
Overbought = 0;
if CountIF(OverSold[1] > 0 ,4) == 4 and OverSold == 0 Then
{
color = RED;
TL1 = TL_New(sDate, sTime, 0, sDate, sTime, 999999999);
TX1 = Text_New(sDate, sTime, Lowest(L,pd),"매수" );
TL_SetColor(TL1, Lime);
TEXT_SetColor(TX1, Lime);
Text_SetStyle(TX1, 0, 0);
}
color2 = iff(Overbought == 1, RGB(255,102,0), GRAY);
if CountIF(Overbought[1] > 0 ,4) == 4 and Overbought == 0 Then
{
color2 = BLUE;
TL2 = TL_New(sDate, sTime, 0, sDate, sTime, 999999999);
TX2 = Text_New(sDate, sTime, Lowest(H,pd),"매도" );
TL_SetColor(TL2, Blue);
TEXT_SetColor(TX2, Blue);
Text_SetStyle(TX2, 0, 0);
}
Plot1(-wvf,"wvf",color);
plot2(wvf_inv,"wvf_inv",color2);
즐거운 하루되세요
> 비듬싸순 님이 쓴 글입니다.
> 제목 : 수고하십니다
>
수고하십니다
변곡점에 세로선 처리하다 수식이 이상하게 됐습니다
수정 부탁드립니다
input : pd(22), bbl(20), mult(2.0), lb(50), ph(0.85), pl(1.01);
var : wvf(0),sDev(0),midLine(0), upperBand(0), rangeHigh(0),color(0), OverSold(0),TL1(0), TX1(0), TL2(0), TX2(0) ;
var : wvf_inv(0), sDev2(0),midLine2(0), upperBand2(0), rangeHigh2(0),color2(0), Overbought(0);
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100;
wvf_inv = ((high-lowest(close, pd))/lowest(close, pd))*100;
sDev = mult * std(wvf, bbl);
midLine = ma(wvf, bbl);
upperBand = midLine + sDev;
rangeHigh = (highest(wvf, lb)) * ph;
sDev2 = mult * std(wvf_inv, bbl);
midLine2 = ma(wvf_inv, bbl);
upperBand2 = midLine2 + sDev2;
rangeHigh2 = (highest(wvf_inv, lb)) * ph;
if wvf >= upperBand or wvf >= rangeHigh Then
OverSold = 1;
Else
OverSold = 0;
color = iff(OverSold == 1, RGB(000,255,000), RGB(128,128,128));
if wvf_inv >= upperBand2 or wvf_inv >= rangeHigh2 Then
Overbought = 1;
Else
Overbought = 0;
if CountIF(OverSold[1] > 0 ,4) == 4 and OverSold == 0 Then
color = RED;
TL1 = TL_New(sDate, sTime, 0, sDate, sTime, 999999999);
TX1 = Text_New(sDate, sTime, Lowest(L,pd),"매수" );
TL_SetColor(TL1, Lime);
TEXT_SetColor(TX1, Lime);
Text_SetStyle(TX1, 0, 0);
color2 = iff(Overbought == 1, RGB(255,102,0), GRAY);
if CountIF(Overbought[1] > 0 ,4) == 4 and Overbought == 0 Then
color2 = BLUE;
TL2 = TL_New(sDate, sTime, 0, sDate, sTime, 999999999);
TX2 = Text_New(sDate, sTime, Lowest(H,pd),"매도" );
TL_SetColor(TL2, Blue);
TEXT_SetColor(TX2, Blue);
Text_SetStyle(TX2, 0, 0);
Plot1(-wvf,"wvf",color);
plot2(wvf_inv,"wvf_inv",color2);