커뮤니티

문의드립니다

프로필 이미지
남산
2017-02-02 15:05:41
113
글번호 106480
답변완료
input : ntime(50),sig(10),Period1(5),익절틱수(8),손절틱수(8); var : mav1(0),Bxcond(false),Sxcond(false); var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+ pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1)); var2 = ma(var1,sig); mav1 = ma(c, Period1); Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true); Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true); if MarketPosition <= 0 and Bxcond == false and (crossup(var1,var2) or (var1 > var2 and mav1 > mav1[1])) Then buy("b",OnClose,def,1); if MarketPosition == 1 Then{ if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then buy("bb",OnClose,def,1); if CrossDown(var1,var2) then{ ExitLong("bx"); } ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and (CrossDown(var1,var2) or (var1 < var2 and mav1 < mav1[1])) Then sell("s",OnClose,def,1); if MarketPosition == -1 then{ if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then sell("ss",OnClose,def,1); if crossup(var1,var2) Then ExitShort("sx"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } 위 수식의 매매방식을 유지하면서 큰선인 ntime1(400),sig1(200)를 추가하고자 합니다 예) ntime1(400),sig1(200),ntime2(50),sig2(10),Period1(5),익절틱수(8),손절틱수(8); 으로 수식을 만들고자 합니다 다시 말씀드리면 큰선 ntime1(400),sig1(200)이 상승일때만 (ntime2(50),sig2(10),Period1(5),익절틱수(8),손절틱수(8);)이것이 상승만 진행하고 하락은 진행하지 않음 반대로 큰선 ntime1(400),sig1(200)이 하락일때만 (ntime2(50),sig2(10),Period1(5),익절틱수(8),손절틱수(8);)이것이 하락만 진행하고 상승은 진행하지 않음 결론 큰선 ntime1(400),sig1(200)이 상승일 때 상승만 진행하고 큰선 ntime1(400),sig1(200)이 하락일 때 하락만 진행하도록 수식 부탁합니다 감사합니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-02-02 19:32:14

안녕하세요 예스스탁입니다. input : ntime1(400),sig1(200),Period1(50),익절틱수(8),손절틱수(8); input : ntime2(50),sig2(10),Period2(5); var : mav1(0),mav2(0),Bxcond(false),Sxcond(false); var3 = Accum(iff(ma(c-c[1],ntime1) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime1)+1),0.5)+ pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1)); var4 = ma(var3,sig1); mav2 = ma(c, Period1); var1 = Accum(iff(ma(c-c[1],ntime2) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime2)+1),0.5)+ pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1)); var2 = ma(var1,sig2); mav1 = ma(c, Period2); Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true); Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true); if MarketPosition <= 0 and Bxcond == false and var4 > var4[1] and (crossup(var1,var2) or (var1 > var2 and mav1 > mav1[1])) Then buy("b",OnClose,def,1); if MarketPosition == 1 Then{ if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then buy("bb",OnClose,def,1); if CrossDown(var1,var2) then{ ExitLong("bx"); } ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and var4 < var4[1] and (CrossDown(var1,var2) or (var1 < var2 and mav1 < mav1[1])) Then sell("s",OnClose,def,1); if MarketPosition == -1 then{ if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then sell("ss",OnClose,def,1); if crossup(var1,var2) Then ExitShort("sx"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } 즐거운 하루되세요 > 남산 님이 쓴 글입니다. > 제목 : 문의드립니다 > input : ntime(50),sig(10),Period1(5),익절틱수(8),손절틱수(8); var : mav1(0),Bxcond(false),Sxcond(false); var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+ pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1)); var2 = ma(var1,sig); mav1 = ma(c, Period1); Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true); Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true); if MarketPosition <= 0 and Bxcond == false and (crossup(var1,var2) or (var1 > var2 and mav1 > mav1[1])) Then buy("b",OnClose,def,1); if MarketPosition == 1 Then{ if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then buy("bb",OnClose,def,1); if CrossDown(var1,var2) then{ ExitLong("bx"); } ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } if MarketPosition >= 0 and Sxcond == false and (CrossDown(var1,var2) or (var1 < var2 and mav1 < mav1[1])) Then sell("s",OnClose,def,1); if MarketPosition == -1 then{ if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then sell("ss",OnClose,def,1); if crossup(var1,var2) Then ExitShort("sx"); ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수); } 위 수식의 매매방식을 유지하면서 큰선인 ntime1(400),sig1(200)를 추가하고자 합니다 예) ntime1(400),sig1(200),ntime2(50),sig2(10),Period1(5),익절틱수(8),손절틱수(8); 으로 수식을 만들고자 합니다 다시 말씀드리면 큰선 ntime1(400),sig1(200)이 상승일때만 (ntime2(50),sig2(10),Period1(5),익절틱수(8),손절틱수(8);)이것이 상승만 진행하고 하락은 진행하지 않음 반대로 큰선 ntime1(400),sig1(200)이 하락일때만 (ntime2(50),sig2(10),Period1(5),익절틱수(8),손절틱수(8);)이것이 하락만 진행하고 상승은 진행하지 않음 결론 큰선 ntime1(400),sig1(200)이 상승일 때 상승만 진행하고 큰선 ntime1(400),sig1(200)이 하락일 때 하락만 진행하도록 수식 부탁합니다 감사합니다