예스스탁
예스스탁 답변
2024-05-23 09:56:15
안녕하세요
예스스탁입니다.
Input : a(1), length(10),크기(15);
var : truehighv(0),TrueLowv(0),TrueRangev(0),xatr(0),nLoss(0),src(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xATRTrailingStop(0),poss(0), emav(0), ab(False), be(False),tx(0) ;
var : dir(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;
xatr = ma(TrueRangev,length);
nLoss = a * xatr ;
##########
src = xClose ;
xATRTrailingStop = 0.0 ;
xATRTrailingStop = iff(src > xATRTrailingStop[1] and src[1] > xATRTrailingStop[1],
max(xATRTrailingStop[1], src - nLoss),
iff(src < xATRTrailingStop[1] and src[1] < xATRTrailingStop[1],
min(xATRTrailingStop[1],src + nLoss),
iff(src > xATRTrailingStop[1], src - nLoss, src + nLoss)));
poss = 0 ;
poss = iff(src[1] < xATRTrailingStop[1] and src > xATRTrailingStop[1], 1,
iff(src[1] > xATRTrailingStop[1] and src < xATRTrailingStop[1], -1, poss[1])) ;
emav = ema(src,1);
if crossup(emav, xATRTrailingStop) Then
ab = true ;
Else
ab = False;
if crossup(xATRTrailingStop, emav) Then
be = true ;
Else
be = False;
////////////
dir = iff(src > xATRTrailingStop and ab == true , 1 ,iff( src < xATRTrailingStop and be == true , -1 , dir));
if dir == 1 and dir[1] == -1
Then
{
Buy();
}
if dir == -1 and dir[1] == 1
Then
{
Sell();
}
즐거운 하루되세요
> 신대륙발견 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> Input : a(1), length(10),크기(15);
var : truehighv(0),TrueLowv(0),TrueRangev(0),xatr(0),nLoss(0),src(0) ;
var : xClose(0),xOpen(0),xHigh(0),xLow(0);
var : xATRTrailingStop(0),poss(0), emav(0), ab(False), be(False),tx(0) ;
var : dir(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;
xatr = ma(TrueRangev,length);
nLoss = a * xatr ;
##########
src = xClose ;
xATRTrailingStop = 0.0 ;
xATRTrailingStop = iff(src > xATRTrailingStop[1] and src[1] > xATRTrailingStop[1],
max(xATRTrailingStop[1], src - nLoss),
iff(src < xATRTrailingStop[1] and src[1] < xATRTrailingStop[1],
min(xATRTrailingStop[1],src + nLoss),
iff(src > xATRTrailingStop[1], src - nLoss, src + nLoss)));
poss = 0 ;
poss = iff(src[1] < xATRTrailingStop[1] and src > xATRTrailingStop[1], 1,
iff(src[1] > xATRTrailingStop[1] and src < xATRTrailingStop[1], -1, poss[1])) ;
emav = ema(src,1);
if crossup(emav, xATRTrailingStop) Then
ab = true ;
Else
ab = False;
if crossup(xATRTrailingStop, emav) Then
be = true ;
Else
be = False;
////////////
dir = iff(src > xATRTrailingStop and ab == true , 1 ,iff( src < xATRTrailingStop and be == true , -1 , dir));
Plot1( dir);
if dir == 1 and dir[1] == -1
Then
{
tx = Text_New(sDate,sTime,low,"▲");
Text_SetStyle(tx,2,0);
Text_SetSize(tx, 크기);
Text_SetColor(tx,black);
}
if dir == -1 and dir[1] == 1
Then
{
tx = Text_New(sDate,sTime,high,"▼");
Text_SetStyle(tx,2,1);
Text_SetSize(tx, 크기);
Text_SetColor(tx,black);
}
위 수식을 시스템식으로 좀 바꿔주세요.