커뮤니티

문의드립니다.

프로필 이미지
버드나무
2019-08-05 22:22:03
176
글번호 130931
답변완료
안녕하세요. 수식문의드립니다. *이평선 골든 데드크로스로 진입 *거래시간은 해외선물 cme 거래기준 (써머타임과 비써머타임 고려) 으로 *당일수익금액합이 100틱이 되면 거래마감 / 당일손실금액합이 100틱이 되면 거래마감하고 *진입시 계약수는 5계약 *외부변수에 익절 1차 10틱 / 2차 30틱 / 3차 50틱 / 4차 70틱 / 5차 90틱 *외부변수에 손절 1차 20틱 / 2차 40틱 / 3차 60틱 / 4차 80틱 / 5차 100틱 *트레일링스탑은 50틱 수익 이후 30틱 하락하면 청산
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-08-06 14:35:14

안녕하세요 예스스탁입니다. input : P1(5),P2(20); Input : 당일수익틱수(100),당일손실틱수(100); var : Summer(False),Year(0); var : v1(0),v2(0),v3(0),v4(0),mav1(0),mav2(0); Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false); 당일수익 = PriceScale*당일수익틱수; 당일손실 = PriceScale*당일손실틱수; #영업일 변경 if bdate != bdate[1] Then { SetStopEndofday(0); Xcond = false; N1 = NetProfit; //썸머타임체크 Year = Floor(bdate/10000); V1 = (10000 * Year) + (100 * 3) + 1; V2 = 15 - dayofweek(v1); // 3월 두번째 일요일 날짜 v3 = (10000 * Year) + (100 * 11) + 1; v4 = 8 - dayofweek(v3); // 11월 첫번째 일요일 날짜 Summer = bdate > (10000 * Year) + (100 * 3) + v2 And bdate < (10000 * Year) + (100 * 11) + v4; } if sdate != sdate[1] Then { #썸머타임이면 당일청산 새벽 5시 50분 if summer == true Then SetStopEndofday(055000); Else #아니면 6시 50분 SetStopEndofday(065000); } mav1 = ma(C,P1); mav2 = ma(C,P2); daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 or daypl <= -당일손실 Then Xcond = true; if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; } if Xcond == false and crossup(mav1,mav2) Then buy("b",OnClose,def,5); if Xcond == false and CrossDown(mav1,mav2) Then sell("s",OnClose,def,5); if MarketPosition == 1 then { ExitLong("bp1",atlimit,EntryPrice+PriceScale*10,"",1,1); ExitLong("bp2",atlimit,EntryPrice+PriceScale*30,"",1,1); ExitLong("bp3",atlimit,EntryPrice+PriceScale*50,"",1,1); ExitLong("bp4",atlimit,EntryPrice+PriceScale*70,"",1,1); ExitLong("bp5",atlimit,EntryPrice+PriceScale*90,"",1,1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*20,"",1,1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*40,"",1,1); ExitLong("bl3",AtStop,EntryPrice-PriceScale*60,"",1,1); ExitLong("bl4",AtStop,EntryPrice-PriceScale*70,"",1,1); ExitLong("bl5",AtStop,EntryPrice-PriceScale*100,"",1,1); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*30); } if MarketPosition == -1 then { ExitShort("sp1",atlimit,EntryPrice-PriceScale*10,"",1,1); ExitShort("sp2",atlimit,EntryPrice-PriceScale*30,"",1,1); ExitShort("sp3",atlimit,EntryPrice-PriceScale*50,"",1,1); ExitShort("sp4",atlimit,EntryPrice-PriceScale*70,"",1,1); ExitShort("sp5",atlimit,EntryPrice-PriceScale*90,"",1,1); ExitShort("sl1",AtStop,EntryPrice+PriceScale*20,"",1,1); ExitShort("sl2",AtStop,EntryPrice+PriceScale*40,"",1,1); ExitShort("sl3",AtStop,EntryPrice+PriceScale*60,"",1,1); ExitShort("sl4",AtStop,EntryPrice+PriceScale*70,"",1,1); ExitShort("sl5",AtStop,EntryPrice+PriceScale*100,"",1,1); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*50 Then ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*30); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts)); } 즐거운 하루되세요 > 버드나무 님이 쓴 글입니다. > 제목 : 문의드립니다. > 안녕하세요. 수식문의드립니다. *이평선 골든 데드크로스로 진입 *거래시간은 해외선물 cme 거래기준 (써머타임과 비써머타임 고려) 으로 *당일수익금액합이 100틱이 되면 거래마감 / 당일손실금액합이 100틱이 되면 거래마감하고 *진입시 계약수는 5계약 *외부변수에 익절 1차 10틱 / 2차 30틱 / 3차 50틱 / 4차 70틱 / 5차 90틱 *외부변수에 손절 1차 20틱 / 2차 40틱 / 3차 60틱 / 4차 80틱 / 5차 100틱 *트레일링스탑은 50틱 수익 이후 30틱 하락하면 청산