예스스탁
예스스탁 답변
2024-11-29 13:26:25
안녕하세요
예스스탁입니다.
input : 분(30),length(20),hh(8),mult(3);
var : k(2),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0);
Var : tx1(0), tx2(0),upv(0),dnv(0),upv1(0),dnv1(0);
var : S1(0),D1(0),TM(0),TF(0),cnt(0);
Array : src[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or
(Bdate == Bdate[1] and 분 == 1 and TM > TM[1]) Then
{
for cnt = 99 downto 1
{
src[cnt] = src[cnt-1];
}
upv1 = upv[1];
dnv1 = dnv[1];
Condition1 = False;
Condition2 = False;
}
src[0] = C;
if src[length] > 0 Then
{
sume = 0;
for i = 0 to length-1
{
sum = 0;
sumw = 0;
for j = 0 to length-1
{
w = exp(-(pow(i-j,2)/(hh*hh*2)));
sum = sum+src[j]*w;
sumw = sumw+w;
}
y2 = sum/sumw;
sume = sume+abs(src[i] - y2);
}
mae = sume/length*mult;
upv = y2+mae;
dnv = y2-mae;
Plot1(y2);
Plot2(upv);
Plot3(dnv);
if upv1 > 0 and Condition1 == False and src[0] < upv and src[1] >= upv1 Then
{
Condition1 = true;
tx1 = Text_New_Self(sdate,stime,H,"▼");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,Cyan);
Text_setsize(Tx1,15);
}
if Condition1 == true Then
{
Text_SetLocation(tx2,sDate,sTime,L);
if !(src[0] < upv and src[1] >= upv1) Then
{
Text_Delete(tx1);
Condition1 = False;
}
}
if dnv1 > 0 and Condition2 == False and src[0] > dnv and src[1] <= dnv1 Then
{
Condition2 = true;
tx2 = Text_New_Self(sdate,stime,L,"▲");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,Black);
Text_setsize(Tx2,15);
}
if Condition2 == true Then
{
Text_SetLocation(tx2,sDate,sTime,L);
if !(src[0] > dnv and src[1] <= dnv1) Then
{
Condition2 = False;
Text_Delete(tx2);
}
}
}
}
즐거운 하루되세요
> 비듬싸순 님이 쓴 글입니다.
> 제목 : 수고하십니다
>
항상노고에 감사드리며
타주기분봉으로 할수있게 부탁드립니다
input : length(20),hh(8),mult(3);
var : k(2),src(0),n(0),sume(0),i(0),j(0),y2(0),sum(0),sumw(0),w(0),mae(0);
Var : tx1(0), tx2(0);
src = Close;
n = barindex;
//if IsLastBar업데이트[영문으로는 쓰기금지라 한글로 씀] and barindex>length then
//y = 0
sume = 0;
for i = 0 to length-1
{
sum = 0;
sumw = 0;
for j = 0 to length-1
{
w = exp(-(pow(i-j,2)/(hh*hh*2)));
sum = sum+src[j]*w;
sumw = sumw+w;
}
y2 = sum/sumw;
sume = sume+abs(src[i] - y2);
}
mae = sume/length*mult;
if CrossDown(src,y2+mae) then
{
tx1 = Text_New_Self(sdate,stime,H,"▼");
Text_SetStyle(tx1,2,1);
Text_SetColor(tx1,Cyan);
Text_setsize(Tx1,15);
}
if CrossUp(src,y2-mae) then
{
tx2 = Text_New_Self(sdate,stime,L,"▲");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,Black);
Text_setsize(Tx2,15);
}
Plot1(y2);
Plot2(y2+mae);
Plot3(y2-mae);