커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
7559
글번호 230811
답변완료
수식 부탁드립니다
if 매수조건1 Then { buy("b1");}
if 매도조건1 Then { Sell("s1");}
if 매수조건2 Then { buy("b2");}
if 매도조건2 Then { Sell("s2");}
if 매수조건3 Then { buy("b3");}
if 매도조건3 Then { Sell("s3");}
위와 같이 3개의 전략을 사용시
직전, 5일간 거래중
매수손익과 매도손익 합인 ( b1 + s1 ) ,( b2 + s2 ) ,( b3 + s3 ) 이 3개의 수익중
가장 큰 수익의 전략신호가 발생할때
오늘, 진입(매수 또는, 매도)할려고 합니다
수식 부탁드립니다
2013-06-10
204
글번호 64145
답변완료
이동평균
안녕하세요, 수고 많으십니다. ^^
ma(C[Length],short) 과 ma(C,short)[Length] 의 차이가 궁금합니다
대단히 감사합니다.
2013-06-10
203
글번호 64126
답변완료
문의 드립니다.
너무 귀찮게 해드려 미안합니다.
간단한 것 같은데 너무 어렵습니다.ㅎㅎㅎ
1,질문
틱차트에서 3봉전 10봉의 최고가를 돌파하면 매수진입,
최저가를 돌파하면 매도 진입을 할려고 하는데 이 고가와 저가 지표는 간단히 만들어 차트에 구동이 잘 되는데 시스템에서는 신호가 나오지 않습니다.
input : period1(3), period2(10);
var : HighCh(0), LowCh(0);
HighCh = highest(H[period1], period2);
LowCh = Lowest(L[period1], period2);
if c[1] < HighCh[1] and c > HighCh and c > o then buy();
if c[1] > LowCh[1] and c < LowCh and c < o then sell();
이렇게 작성을 했는데 신호가 발생하지 않습니다...ㅎㅎ
다른 진입 신호는 나오는데 이것만 안 나오는데 아무리 생각해도 안 풀립니다.
2,질문
진입봉이 그날 봉의 5번째 이내 이면 첫봉에서 진입봉까지의 최저가 이하 이면 매수청산
매도진입 상태이면 최고가 이상이면 매도 청산을 할려고 하는데 전에 질문을 드린 것은
진입봉에서 창산하는 것으로 잘 못 질문을 드렸습니다.죄송합니다.
3,질문 매수진입상태에서 (marketposition == 1 이렇게 먼저 조건을 부여한 상태) 청산신호가 난 봉이 우연히 매도 진입 (지금 포지션과 반대의 신호)와 겹치면 청산과 동시에 반대로 진입하고 싶은데 가능 할런지요?
부탁드립니다.
답을 받고도 이해가 되지 않으면 전화로 문의를 드리고 싶습니다.
2013-06-10
206
글번호 64125
답변완료
왜 안될까요?
/* 아래 수식을 작성했는데, 지표 출력이 안되네요...뭐가 잘못된 것인지 모르겠어요...
참조데이터는 연결선물차트에서 모두 불러놓고 했습니다.
보시면 아시겠지만,
등가옵션을 매번 불러오기 귀찮아서 자동으로 바뀌게 하고 싶습니다. 양등가 및 양외가,양내가 각 2개씩을 표시하고, 선굵기와 색으로 구분하려고 합니다.
아래 식에서 한개를 골라서 구간을 0 < 코스피지수 < 300 으로 바꾸면 그것만 전구간에 표시되네요... 모든 선은 설정에서 점으로 바꿨습니다.
코스피지수는 코스피200입니다.
외부변수 입력으로 근월물, 차월물, 차차월물을 바꿀수 있으면 더 좋겠습니다.
*/
Var : OPTION1(0),OPTION2(0),OPTION3(0),OPTION4(0),OPTION5(0),
OPTION6(0),OPTION7(0),OPTION8(0),OPTION9(0),OPTION10(0),
OPTION11(0),OPTION12(0),OPTION13(0),OPTION14(0),OPTION15(0),
OPTION16(0),OPTION17(0),OPTION18(0),OPTION19(0),OPTION20(0),
OPTION21(0),OPTION22(0),OPTION23(0),OPTION24(0),OPTION25(0),
OPTION26(0),OPTION27(0),OPTION28(0),OPTION29(0),OPTION30(0),
OPTION31(0),OPTION32(0),OPTION33(0),OPTION34(0),OPTION35(0),
OPTION36(0),OPTION37(0),OPTION38(0),OPTION39(0),OPTION40(0),
OPTION41(0),OPTION42(0),OPTION43(0),OPTION44(0);
Var : 선굵기0(0),선굵기1(1),선굵기2(2),선굵기3(3),선굵기4(4),선굵기5(5),선굵기6(6);
Var : 코스피지수(0);
Option1 = data2(c); Option2 = data3(c); Option3 = data4(c); Option4 = data5(c); Option5 = data6(c);
Option6 = data7(c); Option7 = data8(c); Option8 = data9(c); Option9 = data10(c); Option10 = data11(c);
Option11 = data12(c); Option12 = data13(c); Option13 = data14(c); Option14 = data15(c); Option15 = data16(c);
Option16 = data17(c); Option17 = data18(c); Option18 = data19(c); Option19 = data20(c); Option20 = data21(c);
Option21 = data22(c); Option22 = data23(c);
Option23 = data24(c); Option24 = data25(c); Option25 = data26(c); Option26 = data27(c); Option27 = data28(c);
Option28 = data29(c); Option29 = data30(c); Option30 = data31(c); Option31 = data32(c); Option32 = data33(c);
Option33 = data34(c); Option34 = data35(c); Option35 = data36(c); Option36 = data37(c); Option37 = data38(c);
Option38 = data39(c); Option39 = data40(c); Option40 = data41(c); Option41 = data42(c); Option42 = data43(c);
Option43 = data44(c); Option44 = data45(c);
코스피지수 = data45(c);
If 285-1.25 <= 코스피지수 and 285+1.25 >= 코스피지수 Then{
Plot1(Option1,"285.0",RED,def,선굵기4);
Plot23(Option23,"285.0",BLUE,def,선굵기4);
}
Else If 285-3.75 <= 코스피지수 and 285+3.75 >= 코스피지수 Then{
Plot1(Option1,"285.0",RED,def,선굵기2);
Plot23(Option23,"285.0",BLUE,def,선굵기2);
}
Else If 285-6.25 <= 코스피지수 and 285+6.25 >= 코스피지수 Then{
Plot1(Option1,"285.0",RED,def,선굵기0);
Plot23(Option23,"285.0",BLUE,def,선굵기0);
}
If 282.5-1.25 <= 코스피지수 and 282.5+1.25 >= 코스피지수 Then{
Plot2(Option2,"282.5",RED,def,선굵기4);
Plot24(Option24,"282.5",BLUE,def,선굵기4);
}
Else If 282.5-3.75 <= 코스피지수 and 282.5+3.75 >= 코스피지수 Then{
Plot2(Option2,"282.5",RED,def,선굵기2);
Plot24(Option24,"282.5",BLUE,def,선굵기2);
}
Else If 282.5-6.25 <= 코스피지수 and 282.5+6.25 >= 코스피지수 Then{
Plot2(Option2,"282.5",RED,def,선굵기0);
Plot24(Option24,"282.5",BLUE,def,선굵기0);
}
If 280.0-1.25 <= 코스피지수 and 280.0+1.25 >= 코스피지수 Then{
Plot3(Option3,"280.0",RED,def,선굵기4);
Plot25(Option25,"280.0",BLUE,def,선굵기4);
}
Else If 280.0-3.75 <= 코스피지수 and 280.0+3.75 >= 코스피지수 Then{
Plot3(Option3,"280.0",RED,def,선굵기2);
Plot25(Option25,"280.0",BLUE,def,선굵기2);
}
Else If 280.0-6.25 <= 코스피지수 and 280.0+6.25 >= 코스피지수 Then{
Plot3(Option3,"280.0",RED,def,선굵기0);
Plot25(Option25,"280.0",BLUE,def,선굵기0);
}
If 277.5-1.25 <= 코스피지수 and 277.5+1.25 >= 코스피지수 Then{
Plot4(Option4,"277.5",RED,def,선굵기4);
Plot26(Option26,"277.5",BLUE,def,선굵기4);
}
Else If 277.5-3.75 <= 코스피지수 and 277.5+3.75 >= 코스피지수 Then{
Plot4(Option4,"277.5",RED,def,선굵기2);
Plot26(Option26,"277.5",BLUE,def,선굵기2);
}
Else If 277.5-6.25 <= 코스피지수 and 277.5+6.25 >= 코스피지수 Then{
Plot4(Option4,"277.5",RED,def,선굵기0);
Plot26(Option26,"277.5",BLUE,def,선굵기0);
}
If 275.0-1.25 <= 코스피지수 and 275.0+1.25 >= 코스피지수 Then{
Plot5(Option5,"275.0",RED,def,선굵기4);
Plot27(Option27,"275.0",BLUE,def,선굵기4);
}
Else If 275.0-3.75 <= 코스피지수 and 275.0+3.75 >= 코스피지수 Then{
Plot5(Option5,"275.0",RED,def,선굵기2);
Plot27(Option27,"275.0",BLUE,def,선굵기2);
}
Else If 275.0-6.25 <= 코스피지수 and 275.0+6.25 >= 코스피지수 Then{
Plot5(Option5,"275.0",RED,def,선굵기0);
Plot27(Option27,"275.0",BLUE,def,선굵기0);
}
If 272.5-1.25 <= 코스피지수 and 272.5+1.25 >= 코스피지수 Then{
Plot6(Option6,"272.5",RED,def,선굵기4);
Plot28(Option28,"272.5",BLUE,def,선굵기4);
}
Else If 272.5-3.75 <= 코스피지수 and 272.5+3.75 >= 코스피지수 Then{
Plot6(Option6,"272.5",RED,def,선굵기2);
Plot28(Option28,"272.5",BLUE,def,선굵기2);
}
Else If 272.5-6.25 <= 코스피지수 and 272.5+6.25 >= 코스피지수 Then{
Plot6(Option6,"272.5",RED,def,선굵기0);
Plot28(Option28,"272.5",BLUE,def,선굵기0);
}
If 270.0-1.25 <= 코스피지수 and 270.0+1.25 >= 코스피지수 Then{
Plot7(Option7,"270.0",RED,def,선굵기4);
Plot29(Option29,"270.0",BLUE,def,선굵기4);
}
Else If 270.0-3.75 <= 코스피지수 and 270.0+3.75 >= 코스피지수 Then{
Plot7(Option7,"270.0",RED,def,선굵기2);
Plot29(Option29,"270.0",BLUE,def,선굵기2);
}
Else If 270.0-6.25 <= 코스피지수 and 270.0+6.25 >= 코스피지수 Then{
Plot7(Option7,"270.0",RED,def,선굵기0);
Plot29(Option29,"270.0",BLUE,def,선굵기0);
}
If 267.5-1.25 <= 코스피지수 and 267.5+1.25 >= 코스피지수 Then{
Plot8(Option8,"267.5",RED,def,선굵기4);
Plot30(Option30,"267.5",BLUE,def,선굵기4);
}
Else If 267.5-3.75 <= 코스피지수 and 267.5+3.75 >= 코스피지수 Then{
Plot8(Option8,"267.5",RED,def,선굵기2);
Plot30(Option30,"267.5",BLUE,def,선굵기2);
}
Else If 267.5-6.25 <= 코스피지수 and 267.5+6.25 >= 코스피지수 Then{
Plot8(Option8,"267.5",RED,def,선굵기0);
Plot30(Option30,"267.5",BLUE,def,선굵기0);
}
If 265.0-1.25 <= 코스피지수 and 265.0+1.25 >= 코스피지수 Then{
Plot9(Option9,"265.0",RED,def,선굵기4);
Plot31(Option31,"265.0",BLUE,def,선굵기4);
}
Else If 265.0-3.75 <= 코스피지수 and 265.0+3.75 >= 코스피지수 Then{
Plot9(Option9,"265.0",RED,def,선굵기2);
Plot31(Option31,"265.0",BLUE,def,선굵기2);
}
Else If 265.0-6.25 <= 코스피지수 and 265.0+6.25 >= 코스피지수 Then{
Plot9(Option9,"265.0",RED,def,선굵기0);
Plot31(Option31,"265.0",BLUE,def,선굵기0);
}
If 262.5-1.25 <= 코스피지수 and 262.5+1.25 >= 코스피지수 Then{
Plot10(Option10,"262.5",RED,def,선굵기4);
Plot32(Option32,"262.5",BLUE,def,선굵기4);
}
Else If 262.5-3.75 <= 코스피지수 and 262.5+3.75 >= 코스피지수 Then{
Plot10(Option10,"262.5",RED,def,선굵기2);
Plot32(Option32,"262.5",BLUE,def,선굵기2);
}
Else If 262.5-6.25 <= 코스피지수 and 262.5+6.25 >= 코스피지수 Then{
Plot10(Option10,"262.5",RED,def,선굵기0);
Plot32(Option32,"262.5",BLUE,def,선굵기0);
}
If 260.0-1.25 <= 코스피지수 and 260.0+1.25 >= 코스피지수 Then{
Plot11(Option11,"260.0",RED,def,선굵기4);
Plot33(Option33,"260.0",BLUE,def,선굵기4);
}
Else If 260.0-3.75 <= 코스피지수 and 260.0+3.75 >= 코스피지수 Then{
Plot11(Option11,"260.0",RED,def,선굵기2);
Plot33(Option33,"260.0",BLUE,def,선굵기2);
}
Else If 260.0-6.25 <= 코스피지수 and 260.0+6.25 >= 코스피지수 Then{
Plot11(Option11,"260.0",RED,def,선굵기0);
Plot33(Option33,"260.0",BLUE,def,선굵기0);
}
If 257.5-1.25 <= 코스피지수 and 257.5+1.25 >= 코스피지수 Then{
Plot12(Option12,"257.5",RED,def,선굵기4);
Plot34(Option34,"257.5",BLUE,def,선굵기4);
}
Else If 257.5-3.75 <= 코스피지수 and 257.5+3.75 >= 코스피지수 Then{
Plot12(Option12,"257.5",RED,def,선굵기2);
Plot34(Option34,"257.5",BLUE,def,선굵기2);
}
Else If 257.5-6.25 <= 코스피지수 and 257.5+6.25 >= 코스피지수 Then{
Plot12(Option12,"257.5",RED,def,선굵기0);
Plot34(Option34,"257.5",BLUE,def,선굵기0);
}
If 255.0-1.25 <= 코스피지수 and 255.0+1.25 >= 코스피지수 Then{
Plot13(Option13,"255.0",RED,def,선굵기4);
Plot35(Option35,"255.0",BLUE,def,선굵기4);
}
Else If 255.0-3.75 <= 코스피지수 and 255.0+3.75 >= 코스피지수 Then{
Plot13(Option13,"255.0",RED,def,선굵기2);
Plot35(Option35,"255.0",BLUE,def,선굵기2);
}
Else If 255.0-6.25 <= 코스피지수 and 255.0+6.25 >= 코스피지수 Then{
Plot13(Option13,"255.0",RED,def,선굵기0);
Plot35(Option35,"255.0",BLUE,def,선굵기0);
}
If 252.5-1.25 <= 코스피지수 and 252.5+1.25 >= 코스피지수 Then{
Plot14(Option14,"252.5",RED,def,선굵기4);
Plot36(Option36,"252.5",BLUE,def,선굵기4);
}
Else If 252.5-3.75 <= 코스피지수 and 252.5+3.75 >= 코스피지수 Then{
Plot14(Option14,"252.5",RED,def,선굵기2);
Plot36(Option36,"252.5",BLUE,def,선굵기2);
}
Else If 252.5-6.25 <= 코스피지수 and 252.5+6.25 >= 코스피지수 Then{
Plot14(Option14,"252.5",RED,def,선굵기0);
Plot36(Option36,"252.5",BLUE,def,선굵기0);
}
If 250.0-1.25 <= 코스피지수 and 250.0+1.25 >= 코스피지수 Then{
Plot15(Option15,"250.0",RED,def,선굵기4);
Plot37(Option37,"250.0",BLUE,def,선굵기4);
}
Else If 250.0-3.75 <= 코스피지수 and 250.0+3.75 >= 코스피지수 Then{
Plot15(Option15,"250.0",RED,def,선굵기2);
Plot37(Option37,"250.0",BLUE,def,선굵기2);
}
Else If 250.0-6.25 <= 코스피지수 and 250.0+6.25 >= 코스피지수 Then{
Plot15(Option15,"250.0",RED,def,선굵기0);
Plot37(Option37,"250.0",BLUE,def,선굵기0);
}
If 247.5-1.25 <= 코스피지수 and 247.5+1.25 >= 코스피지수 Then{
Plot16(Option16,"247.5",RED,def,선굵기4);
Plot38(Option38,"247.5",BLUE,def,선굵기4);
}
Else If 247.5-3.75 <= 코스피지수 and 247.5+3.75 >= 코스피지수 Then{
Plot16(Option16,"247.5",RED,def,선굵기2);
Plot38(Option38,"247.5",BLUE,def,선굵기2);
}
Else If 247.5-6.25 <= 코스피지수 and 247.5+6.25 >= 코스피지수 Then{
Plot16(Option16,"247.5",RED,def,선굵기0);
Plot38(Option38,"247.5",BLUE,def,선굵기0);
}
If 245.0-1.25 <= 코스피지수 and 245.0+1.25 >= 코스피지수 Then{
Plot17(Option17,"245.0",RED,def,선굵기4);
Plot39(Option39,"245.0",BLUE,def,선굵기4);
}
Else If 245.0-3.75 <= 코스피지수 and 245.0+3.75 >= 코스피지수 Then{
Plot17(Option17,"245.0",RED,def,선굵기2);
Plot39(Option39,"245.0",BLUE,def,선굵기2);
}
Else If 245.0-6.25 <= 코스피지수 and 245.0+6.25 >= 코스피지수 Then{
Plot17(Option17,"245.0",RED,def,선굵기0);
Plot39(Option39,"245.0",BLUE,def,선굵기0);
}
If 242.5-1.25 <= 코스피지수 and 242.5+1.25 >= 코스피지수 Then{
Plot18(Option18,"242.5",RED,def,선굵기4);
Plot40(Option40,"242.5",BLUE,def,선굵기4);
}
Else If 242.5-3.75 <= 코스피지수 and 242.5+3.75 >= 코스피지수 Then{
Plot18(Option18,"242.5",RED,def,선굵기2);
Plot40(Option40,"242.5",BLUE,def,선굵기2);
}
Else If 242.5-6.25 <= 코스피지수 and 242.5+6.25 >= 코스피지수 Then{
Plot18(Option18,"242.5",RED,def,선굵기0);
Plot40(Option40,"242.5",BLUE,def,선굵기0);
}
If 240.0-1.25 <= 코스피지수 and 240.0+1.25 >= 코스피지수 Then{
Plot19(Option19,"240.0",RED,def,선굵기4);
Plot41(Option41,"240.0",BLUE,def,선굵기4);
}
Else If 240.0-3.75 <= 코스피지수 and 240.0+3.75 >= 코스피지수 Then{
Plot19(Option19,"240.0",RED,def,선굵기2);
Plot41(Option41,"240.0",BLUE,def,선굵기2);
}
Else If 240.0-6.25 <= 코스피지수 and 240.0+6.25 >= 코스피지수 Then{
Plot19(Option19,"240.0",RED,def,선굵기0);
Plot41(Option41,"240.0",BLUE,def,선굵기0);
}
If 237.5-1.25 <= 코스피지수 and 237.5+1.25 >= 코스피지수 Then{
Plot20(Option20,"237.5",RED,def,선굵기4);
Plot42(Option42,"237.5",BLUE,def,선굵기4);
}
Else If 237.5-3.75 <= 코스피지수 and 237.5+3.75 >= 코스피지수 Then{
Plot20(Option20,"237.5",RED,def,선굵기2);
Plot42(Option42,"237.5",BLUE,def,선굵기2);
}
Else If 237.5-6.25 <= 코스피지수 and 237.5+6.25 >= 코스피지수 Then{
Plot20(Option20,"237.5",RED,def,선굵기0);
Plot42(Option42,"237.5",BLUE,def,선굵기0);
}
If 235.0-1.25 <= 코스피지수 and 235.0+1.25 >= 코스피지수 Then{
Plot21(Option21,"235.0",RED,def,선굵기4);
Plot43(Option43,"235.0",BLUE,def,선굵기4);
}
Else If 235.0-3.75 <= 코스피지수 and 235.0+3.75 >= 코스피지수 Then{
Plot21(Option21,"235.0",RED,def,선굵기2);
Plot43(Option43,"235.0",BLUE,def,선굵기2);
}
Else If 235.0-6.25 <= 코스피지수 and 235.0+6.25 >= 코스피지수 Then{
Plot21(Option21,"235.0",RED,def,선굵기0);
Plot43(Option43,"235.0",BLUE,def,선굵기0);
}
If 232.5-1.25 <= 코스피지수 and 232.5+1.25 >= 코스피지수 Then{
Plot22(Option22,"232.5",RED,def,선굵기4);
Plot44(Option44,"232.5",BLUE,def,선굵기4);
}
Else If 232.5-3.75 <= 코스피지수 and 232.5+3.75 >= 코스피지수 Then{
Plot22(Option22,"232.5",RED,def,선굵기2);
Plot44(Option44,"232.5",BLUE,def,선굵기2);
}
Else If 232.5-6.25 <= 코스피지수 and 232.5+6.25 >= 코스피지수 Then{
Plot22(Option22,"232.5",RED,def,선굵기0);
Plot44(Option44,"232.5",BLUE,def,선굵기0);
}
2013-06-10
252
글번호 64124
답변완료
문의
안녕하세요
기간을 구분한 시스템 적용이 가능한가요?
만기주, 만기전주, 만기후 첫주...
이 기간만을 조건으로 지정하여 1수식을 나머지 기간은 2수식을 작성할 수있는지요?
가능하다면 수식 부탁드립니다.
2013-06-10
190
글번호 64123
답변완료
간단한 질문입니다.
안녕하세요.
질문 좀 드릴게요.
SetStopEndofday(130000);
진입된 상태에서 정해진시간(예 오후 1시)에 손실중이면 위의 식대로 마감하고..
만약 수익중이면 아래식을 적용하고 싶습니다.
SetStopprofittarget(profit,PointStop);
SetStopEndofday(143000);
감사합니다.^^
2013-06-10
174
글번호 64122
엠제이 님에 의해서 삭제되었습니다.
2013-06-10
9
글번호 64121
답변완료
수식 테스트 확인 부탁드립니다.
1. 미완성신호인 매수, 매도 신호는 잘 나오고 있습니다
그러나 완성신호인 매수청산, 매도청산 신호는 챠트에는 수없이 많이 신호가 나왔으나 예스스팟에는 한번도 나오지 않네요..
무엇이 원인인지 테스트 부탁드립니다.
- 아래 _
var cnt;
var BID;
var SID;
var BXID;
var SXID;
function Main_OnStart()
{
Main.MessageLog("시작");
cnt = 0;
}
//봉완성(시가수신) 카운트 0로 초기화
function Chart1_OnBarAppended(nData)
{
if (nData == 1)
cnt = 0;
}
//미완성
function Chart1_OnRiseIncompleteSignal(IncompleteSignal)
{
//차트가 무포지션이거나 매도포지션 상태일 때 Buy미완성신호 발생하면 매수
if (cnt == 0 && IncompleteSignal.signalKind == 1 && Chart1.GetOpenContracts() <= 0)
{
BID = Account1.OrderBuy(Main.GetOrderCode(IncompleteSignal.code),1,MarketData1.Ask(1),0);
//주문수량,주문가격(Ask(1):매도1호가)),가격구분(1:시장가,0:지정가)
cnt = 1;
Main.MessageList("미완성 매수신호 발생");
Main.PlaySound("C:₩예스트레이더₩data₩sound₩alert.wav");
}
if (cnt == 0 && IncompleteSignal.signalKind == 3 && Chart1.GetOpenContracts() <= 0)
{
SID = Account1.OrderSell(Main.GetOrderCode(IncompleteSignal.code), 1, MarketData1.Bid(1), 0);//주문수량,주문가격,가격구분(1:시장가,0:지정가)
cnt = 1;
Main.MessageList("미완성 매도신호 발생");
Main.PlaySound("C:₩예스트레이더₩data₩sound₩alert.wav");
}
}
function Chart1_OnRiseSignal(Signal)
{
if (Signal.signalKind == 2 && Chart1.GetOpenContracts() >= 1)
{
Main.MessageList("완성 매수청산신호 발생");
BXID = Account1.OrderSell(Main.GetOrderCode(Signal.code), 1, MarketData1.Bid(1), 0);
Main.PlaySound("C:₩예스트레이더₩data₩sound₩alert.wav");
}
if (Signal.signalKind == 4 && Chart1.GetOpenContracts() <= -1)
{
Main.MessageList("완성 매도청산신호 발생");
SXID = Account1.OrderBuy(Main.GetOrderCode(Signal.code), 1, MarketData1.Ask(1), 0);
Main.PlaySound("C:₩예스트레이더₩data₩sound₩alert.wav");
}
}
function Main_OnOrderResponse(OrderResponse)
{
if (OrderResponse.orderID == BID )
{
BNUM = OrderResponse.orderNum;
Main.SetTimer(1, 60000);
}
if (OrderResponse.orderID == SID )
{
SNUM = OrderResponse.orderNum;
Main.SetTimer(2, 60000);
}
if (OrderResponse.orderID == BXID )
{
BXNUM = OrderResponse.orderNum;
Main.SetTimer(3, 60000);
}
if (OrderResponse.orderID == SXID )
{
SXNUM = OrderResponse.orderNum;
Main.SetTimer(4, 60000);
}
}
function Main_OnTimer(nEventID)
{
if (nEventID == 1)
{
Main.KillTimer(1);
Account1.SetUnfillOrderNumber(BNUM);
if (Account1.Unfill.count > 0)
{
Account1.OrderCancel(BNUM);
}
}
if (nEventID == 2)
{
Main.KillTimer(2);
Account1.SetUnfillOrderNumber(SNUM);
if (Account1.Unfill.count > 0)
{
Account1.OrderCancel(BNUM);
}
}
if (nEventID == 3)
{
Main.KillTimer(3);
Account1.SetUnfillOrderNumber(BXNUM);
if (Account1.Unfill.count > 0)
{
Account1.OrderCancel(BXNUM);
}
}
if (nEventID == 4)
{
Main.KillTimer(4);
Account1.SetUnfillOrderNumber(SXNUM);
if (Account1.Unfill.count > 0)
{
Account1.OrderCancel(SXNUM);
}
}
}
2013-06-09
260
글번호 64120
파쿠3 님에 의해서 삭제되었습니다.
2013-06-10
43
글번호 64119