커뮤니티
질문입니다.
2018-07-02 11:30:21
167
글번호 120178
당일 매매 후 다음날이나 혹은 그 이후에 스탑로스나 스탑트레일링을 적용하여 매매를 하려고 합니다. 당일과 그 다음날 이후 검색 조건이 달라질 텐데 종목검색과 시스템을 어떻게 짜야할지 감이 오질 않네요.
도움 부탁드립니다.
1. 종목검색 조건은 당일 장중 매매 기준으로
3거래일전 양봉이 아닐 것
2거래일전 양봉
1거래일전 양봉
0거래일전 양봉
2,1,0 거래일전 상한가가 없을 것 (상한가 조건으로 부탁드립니다.)
if O[3] > C[3] and O[2] < C[2] and O[1] < C[1] and O < C
find(1);
2. 매매조건은 당일 15시 15분에 시장가 매수
이후 스탑로스 또는 스탑트레일링 조건에 의해 매매
당일 청산 말고 지정한 시간 뒤에 청산하고자 하면 어떤조건을 추가해야하나요?(ex.진입시점 이후 2거래일 뒤 전량청산)
(스팟에서 1분봉 확장차트에 신호를 적용하여 매매하고 있습니다.)
input : 매수금액(50000);
if stime == 151500 and O < C Then
{
buy("b",AtMarket,def,Floor(매수금액/C));
}
SetStopLoss(2);
SetStopTrailing(1,2,PercentStop,1); //최소 2% 수익 이후에 최고 가격대비 1% 하락하면 청산
답변 1
예스스탁 예스스탁 답변
2018-07-02 11:36:25
안녕하세요
예스스탁입니다.
1. 종목검색
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
if CodeCategory() == 2 then
{
if date >= 20030721 then
{
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
up7 = int(UpLimit/1+0.00001)*1;
}
}
Else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then
{
if sdate < 20101004 Then
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
if countif(C>O,3) == 3 and C[4] <= O[4] Then
find(1);
2 시스템
input : 매수금액(50000);
var : dd(0),ED(0);
if bdate != bdate[1] Then
dd = dd+1;
if stime >= 151500 and stime[1] < 150000 and DayOpen < DayClose Then
{
if MarketPosition == 0 Then
{
buy("b",AtMarket,def,Floor(매수금액/C));
ED = dd;
}
}
#매수후 2일후부터 동작
if MarketPosition == 1 and dd >= ED+2 then
{
SetStopLoss(2);
SetStopTrailing(1,2,PercentStop,1);
SetStopEndofday(151800);
}
Else
{
SetStopLoss(0);//해제
SetStopTrailing(0,0);//해제
SetStopEndofday(0);//해제
}
즐거운 하루되세요
> 가이츠 님이 쓴 글입니다.
> 제목 : 질문입니다.
> 당일 매매 후 다음날이나 혹은 그 이후에 스탑로스나 스탑트레일링을 적용하여 매매를 하려고 합니다. 당일과 그 다음날 이후 검색 조건이 달라질 텐데 종목검색과 시스템을 어떻게 짜야할지 감이 오질 않네요.
도움 부탁드립니다.
1. 종목검색 조건은 당일 장중 매매 기준으로
3거래일전 양봉이 아닐 것
2거래일전 양봉
1거래일전 양봉
0거래일전 양봉
2,1,0 거래일전 상한가가 없을 것 (상한가 조건으로 부탁드립니다.)
if O[3] > C[3] and O[2] < C[2] and O[1] < C[1] and O < C
find(1);
2. 매매조건은 당일 15시 15분에 시장가 매수
이후 스탑로스 또는 스탑트레일링 조건에 의해 매매
당일 청산 말고 지정한 시간 뒤에 청산하고자 하면 어떤조건을 추가해야하나요?(ex.진입시점 이후 2거래일 뒤 전량청산)
(스팟에서 1분봉 확장차트에 신호를 적용하여 매매하고 있습니다.)
input : 매수금액(50000);
if stime == 151500 and O < C Then
{
buy("b",AtMarket,def,Floor(매수금액/C));
}
SetStopLoss(2);
SetStopTrailing(1,2,PercentStop,1); //최소 2% 수익 이후에 최고 가격대비 1% 하락하면 청산
다음글
이전글