답변완료
문의합니다.
주간만 사용할 경우 진입명에 따라 청산명이 나오나 복합으로 하면 진입명에 따라 청산명이 exitlongno로 나오며, 청산 위치가 아닌 곳에서 청산이 됩니다.차트를 복합으로 변경할 경우 정상적으로 운영하도록 변경 부탁합니다.감사드립니다. input : 시작시간(090000),종료시간(0); input : Period1(1),Period2(2),Period3(3),Period4(4),Period5(5),Period6(6),Period7(7),Period8(8),Period9(9),Period10(10),Period11(11),Period12(12),Period15(15),Period20(20),Period25(25),Period30(30),Period35(35),Period40(40),Period52(52),Period70(70),Period80(80),Period105(105),Period140(140),Period150(150),Period220(220),Period280(280),Period284(284),Period300(240), Period30201(1200),Period30202(1200),Period30301(800),Period30302(1200),Period30401(900),Period30402(3200),Period30501(790),Period30502(1800),Period30601(910),Period30602(2110),Period30701(3400),Period30702(4700), Period450(450),Period480(480),Period520(520),Period560(560),Period600(480),Period700(700),Period800(800),Period900(900),Period1120(1120),Period1200(960),Period1800(1800),Period2400(1920),Period2800(2800),Period3360(3360),Period3600(3600),Period4800(3840),Period7200(7680), Period58(58),Period60(60),Period62(62),Period82(82),Period84(84),Period28(70),Period31(11),Period32(24),Period33(5), Period41(35),Period42(35),Period43(35),Period48(15),Period1001(850),Period1002(520),Period1003(480),Period1008(36),aa1(0.1),aa2(0.2),aa3(0.3),aa4(0.4),aa5(0.5),aa6(0.6), bb3(1600),bb31(140),bb32(910),bb4(1007),bb5(700),bb6(150),bb61(262),bb7(170),bb71(280),bb8(88),bb81(25),bb9(88),bb91(25),bb10(30),bb101(126),bb11(100),bb12(188),bb13(80),bb14(1500),bb141(350),bb15(64),bb16(100),z1(1140), 익절틱수b9(1980),손절틱수b9(600),익절틱수b91(300),손절틱수b91(300),익절틱수b92(300),손절틱수b92(300),익절틱수b93(300),손절틱수b93(300),익절틱수b94(300),손절틱수b94(300), 익절틱수b10(538),손절틱수b10(282),익절틱수b11(196),손절틱수b11(196),익절틱수b12(214),손절틱수b12(118),익절틱수b13(418),손절틱수b13(200),익절틱수b14(194),손절틱수b14(220),익절틱수b15(234),손절틱수b15(170),익절틱수b16(470),손절틱수b16(170), 익절틱수s1(2000),손절틱수s1(224),익절틱수s2(73),손절틱수s2(91),익절틱수s3(63),손절틱수s3(91),익절틱수s4(104),손절틱수s4(91),익절틱수s5(88),손절틱수s5(91),익절틱수s6(57),손절틱수s6(91),익절틱수s7(86),손절틱수s7(91); var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0),mav6(0),mav7(0),mav8(0),mav9(0),mav10(0),mav11(0),mav12(0),mav15(0),mav20(0),mav25(0),mav30(0),mav35(0),mav40(0),mav52(0),mav70(0),mav80(0),mav105(0),mav140(0),mav150(0),mav220(0),mav280(0),mav284(0),mav300(0), mav30201(0),mav30202(0),mav30301(0),mav30302(0),mav30401(0),mav30402(0),mav30501(0),mav30502(0),mav30601(0),mav30602(0),mav30701(0),mav30702(0), mav450(0),mav480(0),mav520(0),mav560(0),mav600(0),mav700(0),mav800(0),mav900(0),mav1120(0),mav1200(0),mav1800(0),mav2400(0),mav2800(0),mav3360(0),mav3600(0),mav4800(0),mav7200(0), mav58(0),mav60(0),mav62(0),mav82(0),mav84(0),mav28(0),mav31(0),mav32(0),mav33(0), mav41(0),mav42(0),mav43(0),mav48(0),mav1001(0),mav1002(0),mav1003(0),mav1008(0),Bxcond(false),Sxcond(false); var : var5(0),var10(0),var20(0),var40(0),var80(0),var150(0),var300(0),var450(0),var600(0),var900(0),var1200(0),var1800(0),var2400(0),var3600(0),var4800(0),var1224(0),var2448(0); var : Tcond(false); var : T(0); var : ii3(0),ii31(0),ii32(0),ii4(0),ii5(0),ii6(0),ii61(0),ii7(0),ii71(0),ii8(0),ii81(0),ii9(0),ii91(0),ii10(0),ii101(0),ii11(0),ii12(0),ii13(0),ii14(0),ii141(0),ii15(0),ii16(0); var : BE1(0),BE2(0),BE3(0),BE4(0),BE5(0); var : SE1(0),SE2(0),SE3(0),SE4(0),SE5(0); mav1 = ma(c, Period1); mav2 = ma(c, Period2); mav3 = ma(c, Period3); mav4 = ma(c, Period4); mav5 = ma(c, Period5); mav6 = ma(c, Period6); mav7 = ma(c, Period7); mav8 = ma(c, Period8); mav9 = ma(c, Period9); mav10 = ma(c, Period10); mav11 = ma(c, Period11); mav12 = ma(c, Period12); mav15 = ma(c, Period15); mav20 = ma(c, Period20); mav25 = ma(c, Period25); mav30 = ma(c, Period30); mav35 = ma(c, Period35); mav40 = ma(c, Period40); mav52 = ma(c, Period52); mav70 = ma(c, Period70); mav80 = ma(c, Period80); mav105 = ma(c, Period105); mav140 = ma(c, Period140); mav150 = ma(c, Period150); mav220 = ma(c, Period220); mav280 = ma(c, Period280); mav284 = ma(c, Period284); mav300 = ma(c, Period300); mav30201 = ma(c, Period30201); mav30202 = ma(c, Period30202); mav30301 = ma(c, Period30301); mav30302 = ma(c, Period30302); mav30401 = ma(c, Period30401); mav30402 = ma(c, Period30402); mav30501 = ma(c, Period30501); mav30502 = ma(c, Period30502); mav30601 = ma(c, Period30601); mav30602 = ma(c, Period30602); mav30701 = ma(c, Period30701); mav30702 = ma(c, Period30702); mav450 = ma(c, Period450); mav480 = ma(c, Period480); mav520 = ma(c, Period520); mav560 = ma(c, Period560); mav600 = ma(c, Period600); mav700 = ma(c, Period700); mav800 = ma(c, Period800); mav900 = ma(c, Period900); mav1120 = ma(c, Period1120); mav1200 = ma(c, Period1200); mav1800 = ma(c, Period1800); mav2400 = ma(c, Period2400); mav2800 = ma(c, Period2800); mav3360 = ma(c, Period3360); mav3600 = ma(c, Period3600); mav4800 = ma(c, Period4800); mav7200 = ma(c, Period7200); mav58 = ma(c, Period58); mav60 = ma(c, Period60); mav62 = ma(c, Period62); mav82 = ma(c, Period82); mav84 = ma(c, Period84); mav28 = ma(c, Period28); mav31 = ma(c, Period31); mav32 = ma(c, Period32); mav33 = ma(c, Period33); mav41 = ma(c, Period41); mav42 = ma(c, Period42); mav43 = ma(c, Period43); mav48 = ma(c, Period48); mav1001 = ma(c, Period1001); mav1002 = ma(c, Period1002); mav1003 = ma(c, Period1003); mav1008 = ma(c, Period1008); var5 = abs(mav5-mav10); var10 = abs(mav10-mav20); var20 = abs(mav20-mav40); var40 = abs(mav40-mav80); var80 = abs(mav80-mav150); var150 = abs(mav150-mav300); var300 = abs(mav300-mav450); var450 = abs(mav450-mav600); var600 = abs(mav600-mav900); var900 = abs(mav900-mav1200); var1200 = abs(mav1200-mav1800); var1800 = abs(mav1800-mav2400); var2400 = abs(mav2400-mav3600); var3600 = abs(mav3600-mav4800); var4800 = abs(mav4800-mav7200); var1224 = abs(mav1200-mav2400); var2448 = abs(mav2400-mav4800); input : Atime(30),P1(2),P2(5),P3(10),P4(20),P5(40),P6(80); var : TF(0),cnt(0),sum1(0),bmav2(0),sum2(0),bmav5(0),sum3(0),bmav10(0),sum4(0),bmav20(0),sum5(0),bmav40(0),sum6(0),bmav80(0); Array : CC[500](0); TF = TimeToMinutes(stime)%Atime;if dayindex() == 0 or (TF < TF[1] and stime > stime[1]) Then{ for cnt = 1 to 499 { CC[cnt] = CC[cnt-1][1]; }} CC[0] = C; if CC[P6-1] > 0 then { sum1 = 0; sum2 = 0; sum3 = 0; sum4 = 0; sum5 = 0; sum6 = 0; for cnt = 0 to P6 { if cnt < P1 Then sum1 = sum1+CC[cnt]; if cnt < P2 Then sum2 = sum2+CC[cnt]; if cnt < P3 Then sum3 = sum3+CC[cnt]; if cnt < P4 Then sum4 = sum4+CC[cnt]; if cnt < P5 Then sum5 = sum5+CC[cnt]; if cnt < P6 Then sum6 = sum6+CC[cnt]; } Bmav2 = sum1/P1; Bmav5 = sum2/P2; Bmav10 = sum3/P3; Bmav20 = sum4/P4; Bmav40 = sum5/P5; Bmav80 = sum6/P6; } 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",0) == true or IsExitName("bx",0) == true) Then BXcond = true; if (IsExitName("sl",0) == true or IsExitName("sp",0) == true or IsExitName("sl4",0) == true or IsExitName("sp4",0) == true) Then SXcond = true; } if Tcond == true then { if MarketPosition <= 0 Then {#b9 if mav7200 > mav4800 and mav4800 < mav2400 Then { if CurrentContracts < 1 Then buy("b9",OnClose,def,1); } } if MarketPosition == 1 Then { if IsEntryName("b9") == true Then {#b91 if mav600 > mav300 and mav300 > mav150 and mav150 > mav80 and mav150 > c and crossuP(mav40,mav80) Then { if CurrentContracts < 20 Then buy("b91",OnClose,def,0); }#b9 if mav7200 < mav4800 and crossDown(mav1200,mav2400) Then { exitlong("b9-1",OnClose,def,"b9"); } Else if mav7200 > mav4800 and crossDown(mav600,mav1200) Then { exitlong("b9-2",OnClose,def,"b9"); } Else if mav7200 < mav4800 and mav2400 > mav1200 Then { exitlong("b9-3",OnClose,def,"b9"); }#b91 if mav7200 < mav4800 and mav4800 < mav3600 and mav3600 < mav2400 and mav2400 < mav1800 and mav1800 < mav1200 and mav1200 < mav900 and mav900 < mav800 and mav800 < mav700 and mav700 < mav600 and mav600 < mav450 and mav450 < mav300 and crossDown(mav900,mav1200) Then { exitlong("b91-1",OnClose,def,"b91"); } Else if mav4800[1] > mav4800 and mav4800 < mav40 and crossDown(mav20,mav40) Then { exitlong("b91-2",OnClose,def,"b91"); } Else if mav4800[1] > mav4800 and mav1800 < mav900 and crossDown(mav600,mav1200) Then { exitlong("b91-3",OnClose,def,"b91"); } Else if mav7200 > mav4800 and mav600 < mav300 and mav7200[1] > mav7200 and mav4800[1] > mav4800 and mav600[1] > mav600 and crossDown(mav150,mav300) Then { exitlong("b91-4",OnClose,def,"b91"); } Else if mav7200 > mav4800 and mav4800 > mav3600 and mav3600 > mav2400 and mav2400 > mav1200 and mav600 < mav300 and crossDown(mav150,mav300) Then { exitlong("b91-5",OnClose,def,"b91"); } ExitLong("bp9",atlimit,AvgEntryPrice+PriceScale*익절틱수b9,"b9"); ExitLong("bl9",AtStop,AvgEntryPrice-PriceScale*손절틱수b9,"b9"); ExitLong("bp91",atlimit,AvgEntryPrice+PriceScale*익절틱수b91,"b91"); ExitLong("bl91",AtStop,AvgEntryPrice-PriceScale*손절틱수b91,"b91"); } } if MarketPosition >= 0 Then { if crossuP(mav300,mav600) Then { ii11=Index; } if ii11 > 0 and Index >= ii11+z1 and mav2400 > mav1200 and mav1200 > mav600 and mav600 > mav300 and mav2400[1] < mav2400 and mav1800[1] < mav1800 and mav1200[1] < mav1200 and mav150[1] > mav150 and crossDown(mav150,mav300) Then { if CurrentContracts < 1 Then sell("s1",OnClose,def,1); } } if MarketPosition == -1 then { #매도 s1 if mav600 > c and mav1200 > mav600 and mav600 > mav300 and crossuP(mav80,mav150) Then { ExitShort("s1-1",OnClose,def,"s1"); } Else if mav600 > c and mav1200 > mav600 and mav600 > mav300 and crossuP(mav150,mav300) Then { ExitShort("s1-2",OnClose,def,"s1"); } Else { if mav600[1] < mav600 and crossuP(mav150,mav300) and mav7200 < mav4800 and mav4800 < mav3600 and mav3600 < mav2400 and mav2400 < mav1800 and mav1800 < mav1200 and mav1200 < mav600 Then ExitShort("s1-5",OnClose,def,"s1"); } ExitShort("sp1",atlimit,AvgEntryPrice-PriceScale*익절틱수s1,"s1"); ExitShort("sl1",AtStop,AvgEntryPrice+PriceScale*손절틱수s1,"s1"); } }