예스스탁
예스스탁 답변
2022-12-01 11:30:52
안녕하세요
예스스탁입니다.
input : 분(15),length(2),mult(2),useClose(true),크기(25);
var : ATrv(0),longStop(0),longStopprev(0),shortStop(0),shortStopPrev(0);
var : dir(1),dir1(0),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);
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[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));
}
}
var : ATrvv(0),lS(0),lSprev(0),sS(0),sSPrev(0);
var : hscv(0),dirv(1),lc(Orange),sc(lightgreen),txv(0);
var : th(0),TL(0),TRv(0),hsatrv(0) ;
var : xC(0),xO(0),xH(0),xL(0);
if index == 0 then
{
xO = open;
xC = (O+H+L+C)/4;
xH = MaxList( high, xO, xC);
xL = MinList( low, xO,xC);
}
else
{
xC = (O+H+L+C)/4;
xO = (xO[1] + xC[1])/2 ;
xH = MaxList(High, xO, xC) ;
xL = MinList(Low, xO, xC) ;
}
////////
If xC[1] > xH then
TH = xC[1];
else
TH = xH;
If xC[1] < xL then
TL = xC[1];
else
TL = xL;
TRv = TH - TL;
hsatrv = ma(TRv,length);
hscv = xC;
atrvv = mult * hsatrv;
lS = IFf(useClose , highest(hscv, length) , highest(xH,length)) - atrvv;
lSPrev = lS[1];
lS = iff(hscv[1] > lSPrev , max(lS, lSPrev) , lS);
sS = IFf(useClose , lowest(hscv, length) , lowest(xL,length)) + atrvv;
sSPrev = sS[1];
sS = iff(hscv[1] < sSPrev , min(sS, sSPrev) , sS);
dirv = iff(hscv > sSPrev , 1 ,iff(hscv < lSPrev , -1 , dirv));
if dirv == 1 and dirv[1] == -1 Then
{
if MarketPosition <= 0 and dir == 1 Then
Buy();
}
if dirv == -1 and dirv[1] == 1 Then
{
if MarketPosition >= 0 and dir == -1 Then
sell();
}
if MarketPosition == 1 Then
{
if c < lS Then
ExitLong("bx1");
ExitLong("bx2",AtStop,lS[BarsSinceEntry]);
ExitLong("bx3",AtLimit,EntryPrice+abs(EntryPrice- ls[BarsSinceEntry])*2);
}
if MarketPosition == -1 Then
{
if c > sS Then
ExitShort("sx1");
ExitShort("sx2",AtStop,sS[BarsSinceEntry]);
ExitShort("sx3",AtLimit,EntryPrice-abs(EntryPrice- sS[BarsSinceEntry])*2);
}
즐거운 하루되세요
> 당일선물 님이 쓴 글입니다.
> 제목 : 시스템식 도움부탁드립니다
> 아래지표를 활용하여
타주기분(15) ▲ 중 일때 현주기 ▲ 발생시 매수
타주기분(15) ▼ 중 일때 현주기 ▼ 발생시 매도
매수 청산 = 현주기 longstop 선을 종가상 아래일때
매도 청산 = 현주기 shortstop 선을 종가상 위 일때
매수손절= 신호발생시 longstop 선 값 하회시 손절
매도손절= 신호발생시 shortstop 선 값 상회시 손절
매수익절 = 신호발생시 (현재가 - longstop ) * 2 도달시
매도익절 = 신호발생시 (shortstop - 현재가 )* 2 도달시
을 시스템 식으로 부탁드립니다
수고하세요
===========
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(Orange),shortcolor(lightgreen),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(xHigh,length)) - atrv;
longStopPrev = longStop[1];
longStop = iff(hsc[1] > longStopPrev , max(longStop, longStopPrev) , longStop);
shortStop = IFf(useClose , lowest(hsc, length) , lowest(xLow,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 Then
{
tx = Text_New(sDate,sTime,longStop,"▲");
Text_SetStyle(tx,2,0);
Text_SetSize(tx, 크기);
Text_SetColor(tx,red);
}
if dir == -1 and dir[1] == 1 Then
{
tx = Text_New(sDate,sTime,shortStop,"▼");
Text_SetStyle(tx,2,1);
Text_SetSize(tx, 크기);
Text_SetColor(tx,blue);
}