예스스탁
예스스탁 답변
2022-11-28 14:39:53
안녕하세요
예스스탁입니다.
input : 분(5),length(2),mult(2),useClose(true),크기(25),Period(60);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : dir(1),longcolor(Crimson),shortcolor(Blue),tx(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);
var : sum1(0),sum2(0),sum3(0),sum4(0),mav1(0),mav2(0),mav3(0),mav4(0);
var : lsma(0),lsma2(0),eq(0),zlsma(0),dir1(0);
Array : TrueRangev[100](0),AccumValue[100](0);
Array : oo[100](0),hh[100](0),ll[100](0),cc[100](0),hsc[100](0),LRLv[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];
LRLv[cnt] = LRLv[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];
var1 = 0;
var2 = 0;
}
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 == true 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 = hv[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));
IF dir == 1 Then
{
plot1(longStop,"Long Stop",longColor);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(shortStop,"Short Stop",shortColor);
}
}
if CC[Period] > 0 Then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
sum4 = 0;
for cnt = 0 to Period-1
{
sum1 = sum1 + AccumValue[cnt];
sum2 = sum2 + CC[cnt];
sum3 = sum3 + CC[cnt]*AccumValue[cnt];
sum4 = sum4 + AccumValue[cnt]^2;
}
mav1 = sum1/Period;
mav2 = sum2/Period;
mav3 = sum3/Period;
mav4 = sum4/Period;
LRLv[0] = (mav3 - mav1 * mav2) /(mav4 - (mav1^2)) * (AccumValue[0] - mav1) + mav2;
}
if LRLv[Period] > 0 Then
{
lsma = LRLv[0];
sum1 = 0;
sum2 = 0;
sum3 = 0;
sum4 = 0;
for cnt = 0 to Period-1
{
sum1 = sum1 + AccumValue[cnt];
sum2 = sum2 + LRLv[cnt];
sum3 = sum3 + LRLv[cnt]*AccumValue[cnt];
sum4 = sum4 + AccumValue[cnt]^2;
}
mav1 = sum1/Period;
mav2 = sum2/Period;
mav3 = sum3/Period;
mav4 = sum4/Period;
lsma2 = (mav3 - mav1 * mav2) /(mav4 - (mav1^2)) * (AccumValue[0] - mav1) + mav2;
eq= lsma-lsma2 ;
zlsma = lsma+eq ;
if dir == 1 and dir1 == -1 and hsc[0] > zlsma
Then
{
tx = Text_New(sDate,sTime,longStop,"▲");
Text_SetStyle(tx,2,0);
Text_SetSize(tx, 크기);
Text_SetColor(tx,longcolor);
}
if dir == -1 and dir[1] == 1 and hsc[0] < zlsma
Then
{
tx = Text_New(sDate,sTime,shortStop,"▼");
Text_SetStyle(tx,2,1);
Text_SetSize(tx, 크기);
Text_SetColor(tx,shortcolor);
}
}
}
즐거운 하루되세요
> 당일선물 님이 쓴 글입니다.
> 제목 : 지표수식 변환 요청드립니다
> 아래지표를 타주기분(5분)으로 변환부탁드립니다.
==================
input : length(2),mult(2),useClose(true),크기(25);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : hsc(0),dir(1),longcolor(Crimson),shortcolor(Blue),tx(0);
var : truehighv(0),TrueLowv(0),TrueRangev(0),hsatr(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
if index == 0 then
{
xOpen = open;
xClose = (O+H+L+C)/4;
xHigh = MaxList( high, xOpen, xClose);
xLow = MinList( low, xOpen,xClose);
}
else
{
xClose = (O+H+L+C)/4;
xOpen = (xOpen [1] + xClose [1])/2 ;
xHigh = MaxList(High, xOpen, xClose) ;
xLow = MinList(Low, xOpen, xClose) ;
}
////////
If xClose[1] > xHigh then
TrueHighv = xClose[1];
else
TrueHighv = xHigh;
If xClose[1] < xLow then
TrueLowv = xClose[1];
else
TrueLowv = xLow;
TrueRangev = TrueHighv - TrueLowv;
hsatr = ma(TrueRangev,length);
hsc = xclose ;
//////////
atrv = mult * hsatr;
longStop = IFf(useClose , highest(hsc, length) , highest(h,length)) - atrv;
longStopPrev = longStop[1];
longStop = iff(hsc[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = IFf(useClose , lowest(hsc, length) , lowest(L,length)) + atrv;
shortStopPrev = shortStop[1];
shortStop = iff(hsc[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop);
dir = iff(hsc > shortStopPrev , 1 ,iff( hsc < longStopPrev , -1 , dir));
IF dir == 1 Then
{
plot1(longStop,"Long Stop",longColor);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(shortStop,"Short Stop",shortColor);
}
////////
if dir == 1 and dir[1] == -1 and hsc > zlsma
Then
{
tx = Text_New(sDate,sTime,longStop,"▲");
Text_SetStyle(tx,2,0);
Text_SetSize(tx, 크기);
Text_SetColor(tx,longcolor);
}
if dir == -1 and dir[1] == 1 and hsc < zlsma
Then
{
tx = Text_New(sDate,sTime,shortStop,"▼");
Text_SetStyle(tx,2,1);
Text_SetSize(tx, 크기);
Text_SetColor(tx,shortcolor);
}
=========================
##ZLSMA
Input : Period(60);
var : lsma(0),lsma2(0),eq(0),zlsma(0);
lsma = LRL(C,Period);
lsma2 = LRL(lsma,Period);
eq= lsma-lsma2 ;
zlsma = lsma+eq ;
if zlsma > zlsma[1] Then
plot1(zlsma,"lsma");