예스스탁
예스스탁 답변
2021-01-04 11:50:04
안녕하세요
예스스탁입니다.
input : 익절틱수(10),손절틱수(10);
var : 이평1(0),이평2(0),t(0);
var : hh(0),hd(0),ht(0),hh1(0),hd1(0),ht1(0),고점추세선(0);
var : ll(0),ld(0),lt(0),ll1(0),ld1(0),lt1(0),저점추세선(0);
var : 돌파(0),붕괴(0);
이평1 = ma(C,20);
이평2 = ma(C,60);
If crossup(이평1,이평2) Then
{
t = 1;
hh = h;
hd = sDate;
ht = sTime;
hh1 = hh[1];
hd1 = hd[1];
ht1 = ht[1];
if hh1 > 0 Then
{
TL_SetExtRight(고점추세선,False);
고점추세선 = TL_New(hd1,ht1,hh1,hd,ht,hh);
TL_SetColor(고점추세선,RED);
TL_SetExtRight(고점추세선,true);
}
}
If crossdown(이평1,이평2) Then
{
t = -1;
ll = l;
ld = sDate;
lt = sTime;
ll1 = ll[1];
ld1 = ld[1];
lt1 = lt[1];
if ll1 > 0 Then
{
TL_SetExtRight(저점추세선,False);
저점추세선 = TL_New(ld1,lt1,ll1,ld,lt,ll);
TL_SetColor(저점추세선,BLUE);
TL_SetExtRight(저점추세선,true);
}
}
if t == 1 Then
{
if h > hh Then
{
hh = h;
hd = sDate;
ht = sTime;
TL_SetEnd(고점추세선,hd,ht,hh);
}
}
if t == -1 Then
{
if l < ll Then
{
ll = l;
ld = sDate;
lt = sTime;
TL_SetEnd(저점추세선,ld,lt,ll);
}
}
If c > TL_GetValue(고점추세선,sDate,sTime) and C[1] < TL_GetValue(고점추세선,sDate[1],sTime[1]) Then
{
돌파 = BLUE;
}
If c > TL_GetValue(저점추세선,sDate,sTime) and C[1] < TL_GetValue(저점추세선,sDate[1],sTime[1]) Then
{
돌파 = RED;
}
If c < TL_GetValue(고점추세선,sDate,sTime) and C[1] > TL_GetValue(고점추세선,sDate[1],sTime[1]) Then
{
붕괴 = BLUE;
}
If c < TL_GetValue(저점추세선,sDate,sTime) and C[1] > TL_GetValue(저점추세선,sDate[1],sTime[1]) Then
{
붕괴 = RED;
}
if 돌파 == RED and 붕괴 == RED and CrossUp(이평1,이평2) Then
Buy();
if 돌파 == BLUE and 붕괴 == BLUE and CrossDown(이평1,이평2) Then
Sell();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 미완 님이 쓴 글입니다.
> 제목 : 시스템매매 함수로 부탁드립니다.
> 아래와 같은 지표수식에서 돌파와 붕괴 지표가 RED로 바뀌고 이평1이 이평2를 돌파할때 매수
돌파와 붕괴 지표가 BLUE로 바뀌고 이평2가 이평1를 돌파할때 매도, 10틱 이익이면 청산, 10틱손실이면 손절할수 있게 수식을 분단위 기준으로 부탁드립니다.
var : 이평1(0),이평2(0),t(0);
var : hh(0),hd(0),ht(0),hh1(0),hd1(0),ht1(0),고점추세선(0);
var : ll(0),ld(0),lt(0),ll1(0),ld1(0),lt1(0),저점추세선(0);
이평1 = ma(C,20);
이평2 = ma(C,60);
Plot1(이평1);
Plot2(이평2);
If crossup(이평1,이평2) Then
{
t = 1;
hh = h;
hd = sDate;
ht = sTime;
hh1 = hh[1];
hd1 = hd[1];
ht1 = ht[1];
if hh1 > 0 Then
{
TL_SetExtRight(고점추세선,False);
고점추세선 = TL_New(hd1,ht1,hh1,hd,ht,hh);
TL_SetColor(고점추세선,RED);
TL_SetExtRight(고점추세선,true);
}
}
If crossdown(이평1,이평2) Then
{
t = -1;
ll = l;
ld = sDate;
lt = sTime;
ll1 = ll[1];
ld1 = ld[1];
lt1 = lt[1];
if ll1 > 0 Then
{
TL_SetExtRight(저점추세선,False);
저점추세선 = TL_New(ld1,lt1,ll1,ld,lt,ll);
TL_SetColor(저점추세선,BLUE);
TL_SetExtRight(저점추세선,true);
}
}
if t == 1 Then
{
if h > hh Then
{
hh = h;
hd = sDate;
ht = sTime;
TL_SetEnd(고점추세선,hd,ht,hh);
}
}
if t == -1 Then
{
if l < ll Then
{
ll = l;
ld = sDate;
lt = sTime;
TL_SetEnd(저점추세선,ld,lt,ll);
}
}
If c > TL_GetValue(고점추세선,sDate,sTime) and C[1] < TL_GetValue(고점추세선,sDate[1],sTime[1]) Then
{
plot3(L-0.5,"돌파",BLUe);
}
If c > TL_GetValue(저점추세선,sDate,sTime) and C[1] < TL_GetValue(저점추세선,sDate[1],sTime[1]) Then
{
plot3(L-0.5,"돌파",REd);
}
If c < TL_GetValue(고점추세선,sDate,sTime) and C[1] > TL_GetValue(고점추세선,sDate[1],sTime[1]) Then
{
plot4(H+0.5,"붕괴",BLUe);
}
If c < TL_GetValue(저점추세선,sDate,sTime) and C[1] > TL_GetValue(저점추세선,sDate[1],sTime[1]) Then
{
plot4(H+0.5,"붕괴",REd);
}