예스스탁
예스스탁 답변
2021-03-03 15:53:06
안녕하세요
예스스탁입니다.
해당 수식에서 파동은 파라볼릭종가지표가 기준입니다.
파라볼릭종가를 매일 초기화해서 새로 계산하면 아래와 같습니다.
장초반에 변곡이 많을 수 있습니다.
당일기준 파라볼릭종가도 같이 출력되게 추가해 드립니다.
input : af(0.02), AFMAX(0.2),크기(0);
input : 텍스트출력(1);
var : T(0),HH(0),LL(0),HD(0),HT(0),LD(0),LT(0),TL1(0),TL2(0),cnt(0),count(0);
var : HH1(0),LL1(0),HD1(0),HT1(0),LD1(0),LT1(0),DarkGray(0);
var : ni(0),nP(0),nN(0),tx1(0),tx2(0),hi(0),li(0);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0),CSarv(0);
if Index == 0 or Bdate != Bdate[1] Then
{
Direction = 0;
SAR_Value = C;
AF_Value = 0.02;
HighValue = High;
LowValue = Low;
EP = 0;
}
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = low;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = High;
}
}
CSarv = SAR_Value;
}
else
{
if SAR_Value != 0 && EP == 0 then
{
if Direction == 1 then
{
EP = HighValue;
AF_Value = AF;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
else
{
EP = LowValue;
AF_Value = Af;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
CSarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if Close > Close[1] then Direction = 1;
else
if Close < Close[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if Close < Close[1] then
{
Direction = -1;
SAR_Value = HighValue;
CSarv = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
CSarv = SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
Plot1(CSarv);
if crossup(c,CSarv) Then
{
T = 1;
HH = H;
HD = sdate;
HT = stime;
Hi = Index;
HH1 = HH[1];
HD1 = HD[1];
HT1 = HT[1];
if LL > 0 Then
{
ni = Hi-Li+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Tx1 = Text_New(HD,HT,HH,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,MAGENTA);
Text_SetSize(tx1,크기);
}
}
}
if CrossDown(c,CSarv) Then
{
T = -1;
LL = L;
LD = sdate;
LT = stime;
Li = Index;
LL1 = LL[1];
LD1 = LD[1];
LT1 = LT[1];
if HH > 0 Then
{
ni = Li-Hi+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Tx2 = Text_New(LD,LT,LL,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,BLUE);
Text_SetSize(tx2,크기);
}
}
}
if T == 1 then
{
if H > HH Then
{
HH = H;
HD = sdate;
HT = stime;
HI = Index;
ni = Hi-Li+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Text_Delete(tx1);
Tx1 = Text_New(HD,HT,HH,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,MAGENTA);
Text_SetSize(tx1,크기);
}
}
}
if T == -1 then
{
if L < LL Then
{
LL = L;
LD = sdate;
LT = stime;
Li = Index;
ni = Li-Hi+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Text_Delete(tx2);
Tx2 = Text_New(LD,LT,LL,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,BLUE);
Text_SetSize(tx2,크기);
}
}
}
Plot1(CSarv,"당일파라볼릭종가",iff(C>CSarv,RED,BLUE));
즐거운 하루되세요
> 크라켄 님이 쓴 글입니다.
> 제목 : 수정부탁드립니다
> 안녕하세요.
아래식에서 파동의시작을 국내선물 장시작시간부터 계산되고 종료후에는 초기화되어
익일장은 또 새롭게 계산되는식으로 수정하면 좋겠습니다,
도움 부탁드립니다.
input : af(0.02), maxAF(0.2),크기(0);
input : 텍스트출력(1);
var : T(0),HH(0),LL(0),HD(0),HT(0),LD(0),LT(0),TL1(0),TL2(0),cnt(0),count(0);
var : HH1(0),LL1(0),HD1(0),HT1(0),LD1(0),LT1(0),DarkGray(0);
var : ni(0),nP(0),nN(0),tx1(0),tx2(0),hi(0),li(0);
var1 = CSar(af,maxAF);
if crossup(c,var1) Then
{
T = 1;
HH = H;
HD = sdate;
HT = stime;
Hi = Index;
HH1 = HH[1];
HD1 = HD[1];
HT1 = HT[1];
if LL > 0 Then
{
ni = Hi-Li+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Tx1 = Text_New(HD,HT,HH,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,MAGENTA);
Text_SetSize(tx1,크기);
}
}
}
if CrossDown(c,var1) Then
{
T = -1;
LL = L;
LD = sdate;
LT = stime;
Li = Index;
LL1 = LL[1];
LD1 = LD[1];
LT1 = LT[1];
if HH > 0 Then
{
ni = Li-Hi+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Tx2 = Text_New(LD,LT,LL,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,BLUE);
Text_SetSize(tx2,크기);
}
}
}
if T == 1 then
{
if H > HH Then
{
HH = H;
HD = sdate;
HT = stime;
HI = Index;
ni = Hi-Li+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Text_Delete(tx1);
Tx1 = Text_New(HD,HT,HH,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,MAGENTA);
Text_SetSize(tx1,크기);
}
}
}
if T == -1 then
{
if L < LL Then
{
LL = L;
LD = sdate;
LT = stime;
Li = Index;
ni = Li-Hi+1;
nP = CountIf(C>O,ni);
nN = CountIf(C<O,ni);
if 텍스트출력 == 1 then
{
Text_Delete(tx2);
Tx2 = Text_New(LD,LT,LL,NumToStr(ni,0)+"("+NumToStr(nP,0)+","+NumToStr(nN,0)+")");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,BLUE);
Text_SetSize(tx2,크기);
}
}
}