예스스탁
예스스탁 답변
2023-05-04 11:54:17
안녕하세요
예스스탁입니다.
올리신 내용은 사용자함수 수식입니다.
그림만으로 저희가 어느부분을 수정해야 할지 알수없습니다.
즐거운 하루되세요
> 당일선물 님이 쓴 글입니다.
> 제목 : 수식도움 부탁드립니다.
> 수고하십니다.
아래수식을 이용한 예스챠트에서는 지표가 출렁거리는데,
그림 아래와 같이 해당타주기분의 종가완성봉 기준으로 지표가 출력되도록 수정부탁드립니다.(그림참조)
감사합니다.
//=================
input : 분(NumericSimple),useClose(NumericSimple),length(NumericSimple),mult(NumericSimple);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : dir(0),dir1(0);
var : truehighv(0),TrueLowv(0),hsatr(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xClose1(0),xOpen1(0),xHigh1(0),xLow1(0);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),ii(0);
var : sum(0),longStop1(0),shortStop1(0),hv(0),lv(0);
Array : TrueRangev[100](0),AccumValue[100](0);
Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[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
{
ii = ii +1;
For cnt = 99 DownTo 1
{
TrueRangev[cnt] = TrueRangev[cnt-1];
oo[cnt] = oo[cnt-1];
hh[cnt] = hh[cnt-1];
ll[cnt] = ll[cnt-1];
cc[cnt] = cc[cnt-1];
hsc[cnt] = hsc[cnt-1];
AccumValue[cnt] = AccumValue[cnt-1];
}
AccumValue[0] = AccumValue[0]+1;
oo[0] = o;
hh[0] = h;
ll[0] = l;
Xopen1 = xopen[1];
Xhigh1 = xhigh[1];
Xlow1 = xlow[1];
Xclose1 = xclose[1];
longStop1 = longStop[1];
ShortStop1 = shortStop[1];
dir1 = dir[1];
}
if hh[0] > 0 and h > hh[0] Then
hh[0] = h;
if ll[0] > 0 and l < ll[0] Then
ll[0] = l;
cc[0] = c;
if ii == 1 then
{
xOpen = oo[0];
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xHigh = MaxList(hh[0], xOpen, xClose);
xLow = MinList(ll[0], xOpen,xClose);
}
else
{
xClose = (oo[0]+hh[0]+ll[0]+cc[0])/4;
xOpen = (xOpen1 + xClose1)/2 ;
xHigh = MaxList(hh[0], xOpen, xClose) ;
xLow = MinList(ll[0], xOpen, xClose) ;
}
hsc[0] = xclose ;
if ii > 1 Then
{
If xClose1 > xHigh then
TrueHighv = xClose1;
else
TrueHighv = xHigh;
If xClose1 < xLow then
TrueLowv = xClose1;
else
TrueLowv = xLow;
TrueRangev[0] = TrueHighv - TrueLowv;
}
if ii > 2 Then
{
if TrueRangev[length-1] > 0 Then
{
sum = 0;
For cnt = 0 to length-1
{
sum = sum + TrueRangev[cnt];
}
hsatr = sum/length;
}
atrv = mult * hsatr;
hv = 0;
lv = 0;
For cnt = 0 to length-1
{
if useClose == 1 Then
{
if hv == 0 or (hv > 0 and hsc[cnt] > hv) Then
hv = hsc[cnt];
if lv == 0 or (lv > 0 and hsc[cnt] < lv) Then
lv = hsc[cnt];
}
Else
{
if hv == 0 or (hv > 0 and hh[cnt] > hv) Then
hv = hh[cnt];
if lv == 0 or (lv > 0 and ll[cnt] < lv) Then
lv = ll[cnt];
}
}
longStop = hv - atrv;
longStopPrev = longStop1;
longStop = iff(hsc[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = lv + atrv;
shortStopPrev = shortStop1;
shortStop = iff(hsc[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = iff(hsc[0] > shortStopPrev , 1 ,iff(hsc[0] < longStopPrev , -1 , dir1));
}
}
//====================