커뮤니티

문의드립니다

프로필 이미지
씸풀
2019-06-20 07:43:47
294
글번호 129599
답변완료

첨부 이미지

수고하십니다. 매수든지 매도든지 하루에 한 번 만 진입하려고 하는데, 매수 매도가 각 한 번씩 나와서 코드를 수정하여 주시기 바랍니다. 감사합니다. 목표: 1. 매수, 매도 가격 중 먼저 도달하는 쪽에 진입 (매수든 매도든 하루에 한 번만 진입) 2. 만약 매수 진입된 후 매도 가격에 이르면 단순히 청산, 반대로 매도 진입된 후에 매수 가격에 이르면 단순히 청산 (손절) 3. 매수나 매도 진입 후 중간에 청산되지 않으면 장마감(153000)에 청산 첨부: 오류 진입된 사례 캡쳐 사진 코드: input : refPrice(270),width(10); var : buyPrice(0),sellPrice(0),entry(0); buyPrice=refPrice+width*priceScale; sellPrice=refPrice-width*priceScale; /// count number of entries per day entry=0; for value1= 0 to 9 { if entryDate(value1)==sDate then entry=entry+1; } /// conditional entry if entry<1 then buy("B1",atLimit,buyPrice); if entry<1 then sell("S1",atLimit,sellPrice); /// if marketPosition==1 then exitLong("EL1",atLimit,sellPrice); if marketPosition==-1 then exitShort("ES1",atLimit,buyPrice); /// setStopEndofDay(153000);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-06-20 10:17:45

안녕하세요 예스스탁입니다. 1 해당 수식은 진입횟수를 카운트 하는 내용이 있습니다. 다만 사용하시는 전략이 하나의 봉의 동일시점에 동시에 매수와 매도신호가 발생할수 있는 내용으로 구성이 되어 있습니다. buyPrice는 지정한가격+10틱 SellPrice는 지정한가격-10틱인데 매수진입은 buyPrice이하의 가격 매도진입은 sellPrice이하의 가격 으로 진입조건이 되어 있어 가격이 buyprice와 sellprice의 사이에 있으면 동시에 발생하게 됩니다. 진입횟수는 봉완성시에 체크하는 부분인데 양방향 신호가 동시충족되어 신호가 발생하는 부분이라 해당 내용은 진입횟수를 제어할 수 없습니다. 해당 부분은 사용자분이 한시점에 양방향 진입이 동시에 발생하지 않도록 조건을 추가해 보셔야 합니다. 저희가 해당 부분은 별도로 처리해 드릴수 없습니다. 2 올려주신 수식에서 사용하는 당일진입횟수 카운트는 0시 기준으로 체크합니다. 각 종목의 영업일 변경시간을 기준으로 하면 아래와 같이 변경하시면 됩니다. input : refPrice(270),width(10); var : buyPrice(0),sellPrice(0),entry(0); buyPrice=refPrice+width*priceScale; sellPrice=refPrice-width*priceScale; if bdate != bdate[1] Then entry = 0; if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry+1; if entry<1 and L > BuyPrice then buy("B1",atLimit,buyPrice); if entry<1 and H < sellprice then sell("S1",atLimit,sellPrice); /// if marketPosition==1 then exitLong("EL1",atLimit,sellPrice); if marketPosition==-1 then exitShort("ES1",atLimit,buyPrice); /// setStopEndofDay(153000); 즐거운 하루되세요 > 씸풀 님이 쓴 글입니다. > 제목 : 문의드립니다 > 수고하십니다. 매수든지 매도든지 하루에 한 번 만 진입하려고 하는데, 매수 매도가 각 한 번씩 나와서 코드를 수정하여 주시기 바랍니다. 감사합니다. 목표: 1. 매수, 매도 가격 중 먼저 도달하는 쪽에 진입 (매수든 매도든 하루에 한 번만 진입) 2. 만약 매수 진입된 후 매도 가격에 이르면 단순히 청산, 반대로 매도 진입된 후에 매수 가격에 이르면 단순히 청산 (손절) 3. 매수나 매도 진입 후 중간에 청산되지 않으면 장마감(153000)에 청산 첨부: 오류 진입된 사례 캡쳐 사진 코드: input : refPrice(270),width(10); var : buyPrice(0),sellPrice(0),entry(0); buyPrice=refPrice+width*priceScale; sellPrice=refPrice-width*priceScale; /// count number of entries per day entry=0; for value1= 0 to 9 { if entryDate(value1)==sDate then entry=entry+1; } /// conditional entry if entry<1 then buy("B1",atLimit,buyPrice); if entry<1 then sell("S1",atLimit,sellPrice); /// if marketPosition==1 then exitLong("EL1",atLimit,sellPrice); if marketPosition==-1 then exitShort("ES1",atLimit,buyPrice); /// setStopEndofDay(153000);