커뮤니티
[글번호 46491] 재문의 드립니다.
2016-02-18 16:59:41
120
글번호 95520
제 실력으로는 해결이 잘 안되네요.
소스보시고 수정 부탁드립니다.
연결선물 15분봉
기본 로직은 매도 진입조건이 4가지가 있습니다.
총 3계약까지 진입을 하려 합니다.
먼저 조건이 만족하는 순서대로 진입합니다.
if MP == 0 Then {
sCond1 = 0;
sCond2 = 0;
sCond3 = 0;
sCond4 = 0;
}
sCnt = 0;
#조건1
if (CurrentContracts + sCnt) < 3 and sCond1 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 외인선물 < -1000 Then {
sCond1 = 1;
sCnt = sCnt + 1;
}
#조건2
if (CurrentContracts + sCnt) < 3 and sCond2 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 개인풋 < -10 Then {
sCond2 = 1;
sCnt = sCnt + 1;
}
#조건3
if (CurrentContracts + sCnt) < 3 and sCond3 == 0 and CrossDown(C,BBMid2) and 외인선물 < -1000 and 개인풋 < -10 Then {
sCond3 = 1;
sCnt = sCnt + 1;
}
#조건4
if (CurrentContracts + sCnt) < 3 and sCond4 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 외인선물 < -1000 and 개인풋 < -10 Then {
sCond4 = 1;
sCnt = sCnt + 1;
}
#####################################################################################*/
#이미 진입한 계약수가 없으면
if CurrentContracts == 0 and sCnt > 0 Then {
Sell("S1", OnClose, DEF, sCnt);
}
else if CurrentContracts > 0 and sCnt > 0 Then {
Sell("S2", OnClose, DEF, sCnt);
}
### ==> 이 부분 로그에서 9시자료가 2번찍히는 바람에 원치하는 위치에서 신호가 발생함 <===
MessageLog("S1 %.2f, S2 %.2f, S3 %.2f, S4 %.2f, sCnt %.2f, 수량 %.2f, 외인 %.2f, 개인풋 %.2f", sCond1, sCond2, sCond3, sCond4, sCnt, CurrentContracts, foFut, p_Put);
#*## 매도 추적스탑 포인트
If MarketPosition == -1 then {
exitshort("xSSS",atstop, lowest(L,BarsSinceEntry+1)+TrailStopPnt);
}
#손절청산
SetStoploss(StopPnt, PointStop);
#####################################################################################*/
답변 1
예스스탁 예스스탁 답변
2016-02-19 09:27:10
안녕하세요
예스스탁입니다.
9시봉에 로그가 여러번찍히는 것은
단지 주종목의 전일마지막봉이후에
참조데이터의 봉이 여러개 더 있으므로
해당 봉에서도 계산을 해주어야 하므로 출력되는 것일뿐입니다.
올려주신식은 값계산과 변수선언문제인것 같습니다.
참조데이터가 있는 경우 수식에서 모든 계산식은
데이터번호로 묶어 주셔야 하며
변수선언시에도 어떤 데이터의 주기로 이전값을 참조할것인지
선언시에 같이 지정해 주셔야 합니다.
랭귀지 도움말의 예스랭귀지 활용에서
참조데이터 사용할때 수식처리법 참고하시기 바랍니다.
https://www.yesstock.com/YesTrader/YesLanguage/YesLanguage_help/4_4_2.htm
현재 수식에서 BBmid2나 BBot1이
어떻게 처리되었는지 정확히 알수가 없습니다.
수식내용으로 보아 BBmid2와 BBbot1등은 주종목의 볼밴값인것 같습니다.
외인선물이 data2, 개인풋이 data3이라면
아래와 같이 변수선언을 하고 사용하시면 됩니다.
아래내용 참고하시기 바랍니다.
input : TrailStopPnt(1),StopPnt(1);
#아래 변수는 data1주기로 값을 저장
var : MP(0,data1),scond1(0,data1),scond2(0,data1),scond3(0,data1),scond4(0,data1),sCnt(0,data1);
var : BBtop1(0,data1),Bbmid1(0,data1),BBbot1(0,data1);
var : BBtop2(0,data1),Bbmid2(0,data1),BBbot2(0,data1);
#아래 변수는 data2주기로 값을 저장
var : 외인선물(0,data2);
#아래변수는 data3주기로 값을 저장
var : 개인풋(0,data3);
BBtop1 = data1(BollBandUp(20,2));
BBmid1 = data1(BollBandUp(20,2));
BBbot1 = data1(BollBandUp(20,2));
BBtop2 = data1(BollBandUp(40,2));
BBmid2 = data1(BollBandUp(40,2));
BBbot2 = data1(BollBandUp(40,2));
if MP == 0 Then {
sCond1 = 0;
sCond2 = 0;
sCond3 = 0;
sCond4 = 0;
}
sCnt = 0;
#조건1
if (CurrentContracts + sCnt) < 3 and sCond1 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 외인선물 < -1000 Then {
sCond1 = 1;
sCnt = sCnt + 1;
}
#조건2
if (CurrentContracts + sCnt) < 3 and sCond2 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 개인풋 < -10 Then {
sCond2 = 1;
sCnt = sCnt + 1;
}
#조건3
if (CurrentContracts + sCnt) < 3 and sCond3 == 0 and CrossDown(C,BBMid2) and 외인선물 < -1000 and 개인풋 < -10 Then {
sCond3 = 1;
sCnt = sCnt + 1;
}
#조건4
if (CurrentContracts + sCnt) < 3 and sCond4 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 외인선물 < -1000 and 개인풋 < -10 Then {
sCond4 = 1;
sCnt = sCnt + 1;
}
#####################################################################################*/
#이미 진입한 계약수가 없으면
if CurrentContracts == 0 and sCnt > 0 Then {
Sell("S1", OnClose, DEF, sCnt);
}
else if CurrentContracts > 0 and sCnt > 0 Then {
Sell("S2", OnClose, DEF, sCnt);
}
### ==> 이 부분 로그에서 9시자료가 2번찍히는 바람에 원치하는 위치에서 신호가 발생함 <===
MessageLog("S1 %.2f, S2 %.2f, S3 %.2f, S4 %.2f, sCnt %.2f, 수량 %.2f, 외인 %.2f, 개인풋 %.2f", sCond1, sCond2, sCond3, sCond4, sCnt, CurrentContracts, foFut, p_Put);
#*## 매도 추적스탑 포인트
If MarketPosition == -1 then {
exitshort("xSSS",atstop, lowest(L,BarsSinceEntry+1)+TrailStopPnt);
}
#손절청산
SetStoploss(StopPnt, PointStop);
즐거운 하루되세요
> billyfo 님이 쓴 글입니다.
> 제목 : [글번호 46491] 재문의 드립니다.
> 제 실력으로는 해결이 잘 안되네요.
소스보시고 수정 부탁드립니다.
연결선물 15분봉
기본 로직은 매도 진입조건이 4가지가 있습니다.
총 3계약까지 진입을 하려 합니다.
먼저 조건이 만족하는 순서대로 진입합니다.
if MP == 0 Then {
sCond1 = 0;
sCond2 = 0;
sCond3 = 0;
sCond4 = 0;
}
sCnt = 0;
#조건1
if (CurrentContracts + sCnt) < 3 and sCond1 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 외인선물 < -1000 Then {
sCond1 = 1;
sCnt = sCnt + 1;
}
#조건2
if (CurrentContracts + sCnt) < 3 and sCond2 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 개인풋 < -10 Then {
sCond2 = 1;
sCnt = sCnt + 1;
}
#조건3
if (CurrentContracts + sCnt) < 3 and sCond3 == 0 and CrossDown(C,BBMid2) and 외인선물 < -1000 and 개인풋 < -10 Then {
sCond3 = 1;
sCnt = sCnt + 1;
}
#조건4
if (CurrentContracts + sCnt) < 3 and sCond4 == 0 and CrossDown(C,BBMid2) and C < BBBot1 and 외인선물 < -1000 and 개인풋 < -10 Then {
sCond4 = 1;
sCnt = sCnt + 1;
}
#####################################################################################*/
#이미 진입한 계약수가 없으면
if CurrentContracts == 0 and sCnt > 0 Then {
Sell("S1", OnClose, DEF, sCnt);
}
else if CurrentContracts > 0 and sCnt > 0 Then {
Sell("S2", OnClose, DEF, sCnt);
}
### ==> 이 부분 로그에서 9시자료가 2번찍히는 바람에 원치하는 위치에서 신호가 발생함 <===
MessageLog("S1 %.2f, S2 %.2f, S3 %.2f, S4 %.2f, sCnt %.2f, 수량 %.2f, 외인 %.2f, 개인풋 %.2f", sCond1, sCond2, sCond3, sCond4, sCnt, CurrentContracts, foFut, p_Put);
#*## 매도 추적스탑 포인트
If MarketPosition == -1 then {
exitshort("xSSS",atstop, lowest(L,BarsSinceEntry+1)+TrailStopPnt);
}
#손절청산
SetStoploss(StopPnt, PointStop);
#####################################################################################*/
이전글