커뮤니티
문의합니다
2019-02-27 08:54:45
157
글번호 126498
input : 시작시간(090000),종료시간(0);
input : Period15(15),Period20(20),Period30(30),Period120(120),Period180(180),Period240(240),Period480(480),Period960(960),Period60(60),Period3(3),Period10(10),Period2(2),Period7(7),Period144(144),Period100(100),익절틱수(150),손절틱수(150);
var : mav15(0),mav20(0),mav30(0),mav120(0),mav180(0),mav240(0),mav480(0),mav960(0),mav60(0),mav1(0),mav3(0),mav10(0),mav2(0),mav7(0),mav144(0),mav100(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
var : T(0);
input : ntime1(4),P(50);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),sum1(0),tmav1(0),tmav11(0),tmav12(0),tmav13(0);
Array : C1[50](0);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime1;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
for cnt = 1 to 49
{
C1[cnt] = C1[cnt-1][1];
}
tmav11 = tmav1[1];
tmav12 = tmav11[1];
tmav13 = tmav12[1];
}
C1[0] = C;
if C1[P] > 0 then{
sum1 = 0;
for cnt = 0 to P-1{
sum1 = sum1+C1[cnt];
}
tmav1 = sum1/P;
}
}
mav15 = ma(c, Period15);
mav20 = ma(c, Period20);
mav30 = ma(c, Period30);
mav120 = ma(c, Period120);
mav180 = ma(c, Period180);
mav240 = ma(c, Period240);
mav480 = ma(c, Period480);
mav960 = ma(c, Period960);
mav60 = ma(c, Period60);
mav3 = ma(c, Period3);
mav10 = ma(c, Period10);
mav2 = ma(c, Period2);
mav7 = ma(c, Period7);
mav144 = ma(c, Period144);
mav100 = ma(c, Period100);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then
{
BXcond = false;
SXcond = false;
if (IsExitName("bl",0) == true or IsExitName("bp",0) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl1",0) == true or IsExitName("sp1",0) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then{
if MarketPosition <= 0 and Bxcond == false and
tmav13 < tmav12 and tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0 Then{
buy("매수",OnClose,def,1);
}
if MarketPosition == 1 Then{
if crossup(mav20, mav30) and CurrentContracts < 5 Then
buy("매수1",OnClose,def,1);
}
if MarketPosition == 1 Then{
if (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산",OnClose,def,"매수");
if (CrossDown(mav20, mav30)) or (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산1",OnClose,def,"매수1");
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
tmav13 > tmav12 and tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0 Then{
sell("매도",OnClose,def,1);
}
if MarketPosition == -1 then{
if CrossDown(mav20, mav30) and CurrentContracts < 5 Then
sell("매도1",OnClose,def,1);
}
if MarketPosition == -1 then{
if (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산",OnClose,def,"매도");
if (crossup(mav20, mav30)) or (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산1",OnClose,def,"매도1");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
}
수식를 수정하여 주시면 고맙겠습니다
1번 위 수식에서 매수진입 후 추가진입 안되고 있고
매도진입 후 추가진입 안되고 있습니다
진입이 없는 이유가 어떤 이유인가요
if MarketPosition == 1 Then{
if crossup(mav20, mav30) and CurrentContracts < 5 Then
buy("매수1",OnClose,def,1);
}
if MarketPosition == -1 then{
if CrossDown(mav20, mav30) and CurrentContracts < 5 Then
sell("매도1",OnClose,def,1);
}
2번 시스템 성능 보고서에서 기 기재한 진입명과 청산명이 나오게 해 주세요
감사합니다
답변 1
예스스탁 예스스탁 답변
2019-02-25 14:42:51
안녕하세요
예스스탁입니다.
1
해당 수식 추가진입이 되는 수식입니다.
시스템을 적용시에 시스템 트레이딩 설정창의 피라미딩탭에서
피라미딩을 모든진입신호 허용으로 설정하고 적용하시면 됩니다.
추가진입을 하는 수식은 항상 적용시에 피라미딩을 직접 설정하셔야 합니다.
2
신호가 발생하면 자동으로 시스템 성능보고서의
거래내역에는 함수에 적은 이름으로 표시가 됩니다.
지정한 이름이 아닌 신호는 스위칭될때 청산명입니다.
진입상태에서 반대 진입으로 청산된 경우에는 별도로 이름을 지정할수 없으므로
Exitlong_#1과 같이 함수명으로 적혀지게 됩니다.
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 문의합니다
> input : 시작시간(090000),종료시간(0);
input : Period15(15),Period20(20),Period30(30),Period120(120),Period180(180),Period240(240),Period480(480),Period960(960),Period60(60),Period3(3),Period10(10),Period2(2),Period7(7),Period144(144),Period100(100),익절틱수(150),손절틱수(150);
var : mav15(0),mav20(0),mav30(0),mav120(0),mav180(0),mav240(0),mav480(0),mav960(0),mav60(0),mav1(0),mav3(0),mav10(0),mav2(0),mav7(0),mav144(0),mav100(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
var : T(0);
input : ntime1(4),P(50);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),sum1(0),tmav1(0),tmav11(0),tmav12(0),tmav13(0);
Array : C1[50](0);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime1;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
for cnt = 1 to 49
{
C1[cnt] = C1[cnt-1][1];
}
tmav11 = tmav1[1];
tmav12 = tmav11[1];
tmav13 = tmav12[1];
}
C1[0] = C;
if C1[P] > 0 then{
sum1 = 0;
for cnt = 0 to P-1{
sum1 = sum1+C1[cnt];
}
tmav1 = sum1/P;
}
}
mav15 = ma(c, Period15);
mav20 = ma(c, Period20);
mav30 = ma(c, Period30);
mav120 = ma(c, Period120);
mav180 = ma(c, Period180);
mav240 = ma(c, Period240);
mav480 = ma(c, Period480);
mav960 = ma(c, Period960);
mav60 = ma(c, Period60);
mav3 = ma(c, Period3);
mav10 = ma(c, Period10);
mav2 = ma(c, Period2);
mav7 = ma(c, Period7);
mav144 = ma(c, Period144);
mav100 = ma(c, Period100);
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then
{
BXcond = false;
SXcond = false;
if (IsExitName("bl",0) == true or IsExitName("bp",0) == true or IsExitName("bx",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl1",0) == true or IsExitName("sp1",0) == true or IsExitName("sx",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if Tcond == true then{
if MarketPosition <= 0 and Bxcond == false and
tmav13 >= tmav12 and tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0 Then{
buy("매수",OnClose,def,1);
}
if MarketPosition == 1 Then{
if crossup(mav20, mav30) and CurrentContracts < 5 Then
buy("매수1",OnClose,def,1);
}
if MarketPosition == 1 Then{
if (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산",OnClose,def,"매수");
if (CrossDown(mav20, mav30)) or (tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0) Then
exitlong("수청산1",OnClose,def,"매수1");
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
tmav13 <= tmav12 and tmav12 > tmav11 and tmav11 > tmav1 and tmav12 > 0 Then{
sell("매도",OnClose,def,1);
}
if MarketPosition == -1 then{
if CrossDown(mav20, mav30) and CurrentContracts < 5 Then
sell("매도1",OnClose,def,1);
}
if MarketPosition == -1 then{
if (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산",OnClose,def,"매도");
if (crossup(mav20, mav30)) or (tmav12 < tmav11 and tmav11 < tmav1 and tmav12 > 0) Then
ExitShort("도청산1",OnClose,def,"매도1");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
}
수식를 수정하여 주시면 고맙겠습니다
1번 위 수식에서 매수진입 후 추가진입 안되고 있고
매도진입 후 추가진입 안되고 있습니다
진입이 없는 이유가 어떤 이유인가요
if MarketPosition == 1 Then{
if crossup(mav20, mav30) and CurrentContracts < 5 Then
buy("매수1",OnClose,def,1);
}
if MarketPosition == -1 then{
if CrossDown(mav20, mav30) and CurrentContracts < 5 Then
sell("매도1",OnClose,def,1);
}
2번 시스템 성능 보고서에서 기 기재한 진입명과 청산명이 나오게 해 주세요
감사합니다