예스스탁
예스스탁 답변
2022-02-14 14:45:19
안녕하세요
예스스탁입니다.
input : af(0.02), AFMAX(0.2);
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);
}
}
//Plot10(CSarv);
if (crossup(C,CSarv[1]) or crossup(C,CSarv[2]) or crossup(C,CSarv[3])) and (C >= CSarv or C >= CSarv[1]) Then
{
value1 = CSarv;
value11 = sDate;
}
if (CrossDown(C,CSarv[1]) or CrossDown(C,CSarv[2]) or CrossDown(C,CSarv[3])) and (C <= CSarv or C <= CSarv[1]) Then
{
value2 = CSarv;
Value21 = sDate;
}
if sDate == value11 Then
plot1(value1,"양수평");
Else
NoPlot(1);
if sDate == Value21 Then
plot2(value2,"음수평");
Else
NoPlot(2);
즐거운 하루되세요
> 한국사람73 님이 쓴 글입니다.
> 제목 : 수식
> 하기 수익에 대한 수정 부탁드립니다.
plot1,plot2 수평선이 당일 발생분은 당일 종가까지만 생성되고 다음날에는 연장 되지 않도록 부탁드립니다. (이전일에 발생한것은 삭제가 아닙니다)
감사합니다.
input : af(0.02), AFMAX(0.2);
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);
}
}
//Plot10(CSarv);
if (crossup(C,CSarv[1]) or crossup(C,CSarv[2]) or crossup(C,CSarv[3])) and (C >= CSarv or C >= CSarv[1]) Then
value1 = CSarv;
if (CrossDown(C,CSarv[1]) or CrossDown(C,CSarv[2]) or CrossDown(C,CSarv[3])) and (C <= CSarv or C <= CSarv[1]) Then
value2 = CSarv;
plot1(value1,"양수평");
plot2(value2,"음수평");