커뮤니티

수식 점검 좀 해 주세요^^;;

프로필 이미지
비오80
2020-07-27 11:07:54
1978
글번호 225289
답변완료
3.0 근접 옵션 매수식인데.. 예스스팟에서 실행하면 12번째 줄이 ubexpected token;; 이라고 나오네요.. 12번째줄이 요놈... function Main::OnStart() 혹시 수식연습할 수 있는데 예제들이 있나요? ---------------------------------------------------------- var CPrice = new Array(101); var CCode = new Array(101); var PPrice = new Array(101); var PCode = new Array(101); var MaxCall; var MaxCallCode; var MaxPut; var MaxPutCode; function Main::OnStart() { //ATM-50~+50까지 종목중 0~3사이 종목을 제외하고 모두 -1처리 for(var i = -50; i <= 50; i++) { if (Option.GetCurrent(0,i) < 3 && Option.GetCurrent(0,i) > 0) { CPrice[50+i] = Option.GetCurrent(0,i); CCode[50+i] = Option.GetATMCallRecent(i); } else { CPrice[50+i] = -1; CCode[50+i] = -1; } if (Option.GetCurrent(1,i) < 3 && Option.GetCurrent(1,i) > 0) { PPrice[50+i] = Option.GetCurrent(1,i); PCode[50+i] = Option.GetATMPutRecent(i); } else { PPrice[50+i] = -1; PCode[50+i] = -1; } } //저장된 CPrice, PPrice값중 최고값 계산 MaxCall = -1; MaxCallcode = -1; MaxPut = -1; MaxPutcode = -1; for(var A = 0; A <= 100; A++) { if (CPrice[A] > MaxCall) { MaxCall = CPrice[A]; MaxCallcode = CCode[A]; } if (PPrice[A] > MaxPut) { MaxPut = PPrice[A]; MaxPutcode = PCode[A]; } } Main.MessageLog("가격:"+MaxCall+"종목코드:"+MaxCallcode); Main.MessageLog("가격:"+MaxPut+"종목코드:"+MaxPutcode); }
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-08-28 14:12:18

안녕하세요 예스스탁입니다. function Main::OnStart() 이벤트가 잘못 작성되어 있습니다. function Main_OnStart() 로 변경하시면 됩니다. 스크립트 객체화면에서 옵션객체 추가하신후에 속성에서 객체명은 Option으로 지정하시고 코스피200지수로 지정해 주시면 됩니다. 해당 스팟식으로 값이 출력되지 않으시면 프로그램 상단의 관리 --> 환경설정 --> 예스스팟에서 예스스팟 옵션데이타 사용여부에 사용으로 설정하셔야 합니다. var CPrice = new Array(101); var CCode = new Array(101); var PPrice = new Array(101); var PCode = new Array(101); var MaxCall; var MaxCallCode; var MaxPut; var MaxPutCode; function Main_OnStart() { //ATM-50~+50까지 종목중 0~3사이 종목을 제외하고 모두 -1처리 for(var i = -50; i <= 50; i++) { if (Option.GetCurrent(0,i) < 3 && Option.GetCurrent(0,i) > 0) { CPrice[50+i] = Option.GetCurrent(0,i); CCode[50+i] = Option.GetATMCallRecent(i); } else { CPrice[50+i] = -1; CCode[50+i] = -1; } if (Option.GetCurrent(1,i) < 3 && Option.GetCurrent(1,i) > 0) { PPrice[50+i] = Option.GetCurrent(1,i); PCode[50+i] = Option.GetATMPutRecent(i); } else { PPrice[50+i] = -1; PCode[50+i] = -1; } } //저장된 CPrice, PPrice값중 최고값 계산 MaxCall = -1; MaxCallcode = -1; MaxPut = -1; MaxPutcode = -1; for(var A = 0; A <= 100; A++) { if (CPrice[A] > MaxCall) { MaxCall = CPrice[A]; MaxCallcode = CCode[A]; } if (PPrice[A] > MaxPut) { MaxPut = PPrice[A]; MaxPutcode = PCode[A]; } } Main.MessageLog("가격:"+MaxCall+"종목코드:"+MaxCallcode); Main.MessageLog("가격:"+MaxPut+"종목코드:"+MaxPutcode); } 즐거운 하루되세요 > 비오80 님이 쓴 글입니다. > 제목 : 수식 점검 좀 해 주세요^^;; > 3.0 근접 옵션 매수식인데.. 예스스팟에서 실행하면 12번째 줄이 ubexpected token;; 이라고 나오네요.. 12번째줄이 요놈... function Main::OnStart() 혹시 수식연습할 수 있는데 예제들이 있나요? ---------------------------------------------------------- var CPrice = new Array(101); var CCode = new Array(101); var PPrice = new Array(101); var PCode = new Array(101); var MaxCall; var MaxCallCode; var MaxPut; var MaxPutCode; function Main::OnStart() { //ATM-50~+50까지 종목중 0~3사이 종목을 제외하고 모두 -1처리 for(var i = -50; i <= 50; i++) { if (Option.GetCurrent(0,i) < 3 && Option.GetCurrent(0,i) > 0) { CPrice[50+i] = Option.GetCurrent(0,i); CCode[50+i] = Option.GetATMCallRecent(i); } else { CPrice[50+i] = -1; CCode[50+i] = -1; } if (Option.GetCurrent(1,i) < 3 && Option.GetCurrent(1,i) > 0) { PPrice[50+i] = Option.GetCurrent(1,i); PCode[50+i] = Option.GetATMPutRecent(i); } else { PPrice[50+i] = -1; PCode[50+i] = -1; } } //저장된 CPrice, PPrice값중 최고값 계산 MaxCall = -1; MaxCallcode = -1; MaxPut = -1; MaxPutcode = -1; for(var A = 0; A <= 100; A++) { if (CPrice[A] > MaxCall) { MaxCall = CPrice[A]; MaxCallcode = CCode[A]; } if (PPrice[A] > MaxPut) { MaxPut = PPrice[A]; MaxPutcode = PCode[A]; } } Main.MessageLog("가격:"+MaxCall+"종목코드:"+MaxCallcode); Main.MessageLog("가격:"+MaxPut+"종목코드:"+MaxPutcode); }