커뮤니티

수식 변경 부탁드립니다.

프로필 이미지
미완
2019-07-23 23:00:47
144
글번호 130586
답변완료
아래 수식에서 추세변환 후 진입 신호를 함수로 지정하여(예 1번 아니면 2번 등) 진입하고 다음 반대 추세가 나올 때 함수 진입 횟수에 따라 진입하도록 수식 변경 부탁드립니다. input: b_time1(000000),e_time1(240000); Input : P1(30), P2(100); Array:ma14[101](0),추세[101](""); input: stoK_p11(70),stoK_p12(4),stoK_p13(6), ma_period11(23),ma_period12(6),ma_period13(14),ma_period14(100), ma_period15(10),ma_period16(20),ma_period17(15),상단(85),하단(15),익절틱수(50); Var: ma_p11(23),ma_p12(6),ma_p13(14),ma_p14_1(100),ma_p14_2(99),ma_p14_3(98),ma_p14_4(97), ma_p14_5(96),ma_p14_6(95),ma_p14_7(94),ma_p14_8(93),ma_p14_9(92),ma_p14_10(91),ma_p14_11(90),ma_p14_12(89),ma_p14_13(88),ma_p14_14(87), ma_p14_15(86),ma_p14_16(85),ma_p14_17(84),ma_p14_18(83),ma_p14_19(82),ma_p14_20(81), ma_p14_21(80),ma_p14_22(79),ma_p14_23(78),ma_p14_24(77),ma_p14_25(76),ma_p14_26(75),ma_p14_27(74), ma_p14_28(73),ma_p14_29(72),ma_p14_30(71),ma_p14_31(70),ma_p14_32(69),ma_p14_33(68),ma_p14_34(67), ma_p14_35(66),ma_p14_36(65),ma_p14_37(64),ma_p14_38(63),ma_p14_39(62),ma_p14_40(61), ma_p14_41(60),ma_p14_42(59),ma_p14_43(58),ma_p14_44(57),ma_p14_45(56),ma_p14_46(55),ma_p14_47(54), ma_p14_48(53),ma_p14_49(52),ma_p14_50(51),ma_p14_51(50),ma_p14_52(49),ma_p14_53(48),ma_p14_54(47), ma_p14_55(46),ma_p14_56(45),ma_p14_57(44),ma_p14_58(43),ma_p14_59(42),ma_p14_60(41), ma_p14_61(40),ma_p14_62(39),ma_p14_63(38),ma_p14_64(37),ma_p14_65(36),ma_p14_66(35),ma_p14_67(34), ma_p14_68(33),ma_p14_69(32),ma_p14_70(31),ma_p14_71(30),ma_p14_72(29),ma_p14_73(28),ma_p14_74(27), ma_p14_75(26),ma_p14_76(25),ma_p14_77(24),ma_p14_78(23),ma_p14_79(22),ma_p14_80(21), ma_p14_81(20),ma_p14_82(19),ma_p14_83(18),ma_p14_84(17),ma_p14_85(16),ma_p14_86(15),ma_p14_87(14), ma_p14_88(13),ma_p14_89(12),ma_p14_90(11),ma_p14_91(10),ma_p14_92(9),ma_p14_93(8),ma_p14_94(7), ma_p14_95(6),ma_p14_96(5),ma_p14_97(4),ma_p14_98(3),ma_p14_99(2),ma_p14_100(1),ma_p15(10),ma_p16(20),ma_p17(15), j(0),ma11(0),ma12(0),ma13(0),ma15(0),ma16(0),ma17(0),매수강도(0),매도강도(0); Var:mav1(0),mav2(0),stoK(0),stoD(0),T(0); ma11 = ma(C,ma_p11); ma12 = ma(C,ma_p12); ma13 = ma(C,ma_p13); ma15 = ma(C,ma_p15); ma16 = ma(C,ma_p16); ma17 = ma(C,ma_p17); ma14[1] = ma(C,ma_p14_1); ma14[2] = ma(C,ma_p14_2); ma14[3] = ma(C,ma_p14_3); ma14[4] = ma(C,ma_p14_4); ma14[5] = ma(C,ma_p14_5); ma14[6] = ma(C,ma_p14_6); ma14[7] = ma(C,ma_p14_7); ma14[8] = ma(C,ma_p14_8); ma14[9] = ma(C,ma_p14_9); ma14[10] = ma(C,ma_p14_10); ma14[11] = ma(C,ma_p14_11); ma14[12] = ma(C,ma_p14_12); ma14[13] = ma(C,ma_p14_13); ma14[14] = ma(C,ma_p14_14); ma14[15] = ma(C,ma_p14_15); ma14[16] = ma(C,ma_p14_16); ma14[17] = ma(C,ma_p14_17); ma14[18] = ma(C,ma_p14_18); ma14[19] = ma(C,ma_p14_19); ma14[20] = ma(C,ma_p14_20); ma14[21] = ma(C,ma_p14_21); ma14[22] = ma(C,ma_p14_22); ma14[23] = ma(C,ma_p14_23); ma14[24] = ma(C,ma_p14_24); ma14[25] = ma(C,ma_p14_25); ma14[26] = ma(C,ma_p14_26); ma14[27] = ma(C,ma_p14_27); ma14[28] = ma(C,ma_p14_28); ma14[29] = ma(C,ma_p14_29); ma14[30] = ma(C,ma_p14_30); ma14[31] = ma(C,ma_p14_31); ma14[32] = ma(C,ma_p14_32); ma14[33] = ma(C,ma_p14_33); ma14[34] = ma(C,ma_p14_34); ma14[35] = ma(C,ma_p14_35); ma14[36] = ma(C,ma_p14_36); ma14[37] = ma(C,ma_p14_37); ma14[38] = ma(C,ma_p14_38); ma14[39] = ma(C,ma_p14_39); ma14[40] = ma(C,ma_p14_40); ma14[41] = ma(C,ma_p14_41); ma14[42] = ma(C,ma_p14_42); ma14[43] = ma(C,ma_p14_43); ma14[44] = ma(C,ma_p14_44); ma14[45] = ma(C,ma_p14_45); ma14[46] = ma(C,ma_p14_46); ma14[47] = ma(C,ma_p14_47); ma14[48] = ma(C,ma_p14_48); ma14[49] = ma(C,ma_p14_49); ma14[50] = ma(C,ma_p14_50); ma14[51] = ma(C,ma_p14_51); ma14[52] = ma(C,ma_p14_52); ma14[53] = ma(C,ma_p14_53); ma14[54] = ma(C,ma_p14_54); ma14[55] = ma(C,ma_p14_55); ma14[56] = ma(C,ma_p14_56); ma14[57] = ma(C,ma_p14_57); ma14[58] = ma(C,ma_p14_58); ma14[59] = ma(C,ma_p14_59); ma14[60] = ma(C,ma_p14_60); ma14[61] = ma(C,ma_p14_61); ma14[62] = ma(C,ma_p14_62); ma14[63] = ma(C,ma_p14_63); ma14[64] = ma(C,ma_p14_64); ma14[65] = ma(C,ma_p14_65); ma14[66] = ma(C,ma_p14_66); ma14[67] = ma(C,ma_p14_67); ma14[68] = ma(C,ma_p14_68); ma14[69] = ma(C,ma_p14_69); ma14[70] = ma(C,ma_p14_70); ma14[71] = ma(C,ma_p14_71); ma14[72] = ma(C,ma_p14_72); ma14[73] = ma(C,ma_p14_73); ma14[74] = ma(C,ma_p14_74); ma14[75] = ma(C,ma_p14_75); ma14[76] = ma(C,ma_p14_76); ma14[77] = ma(C,ma_p14_77); ma14[78] = ma(C,ma_p14_78); ma14[79] = ma(C,ma_p14_79); ma14[80] = ma(C,ma_p14_80); ma14[81] = ma(C,ma_p14_81); ma14[82] = ma(C,ma_p14_82); ma14[83] = ma(C,ma_p14_83); ma14[84] = ma(C,ma_p14_84); ma14[85] = ma(C,ma_p14_85); ma14[86] = ma(C,ma_p14_86); ma14[87] = ma(C,ma_p14_87); ma14[88] = ma(C,ma_p14_88); ma14[89] = ma(C,ma_p14_89); ma14[90] = ma(C,ma_p14_90); ma14[91] = ma(C,ma_p14_91); ma14[92] = ma(C,ma_p14_92); ma14[93] = ma(C,ma_p14_93); ma14[94] = ma(C,ma_p14_94); ma14[95] = ma(C,ma_p14_95); ma14[96] = ma(C,ma_p14_96); ma14[97] = ma(C,ma_p14_97); ma14[98] = ma(C,ma_p14_98); ma14[99] = ma(C,ma_p14_99); ma14[100] = ma(C,ma_p14_100); 매수강도 = 0; 매도강도 = 0; If b_time1 <= Time and Time <= e_time1 Then { For j = 1 To 100 { If countif(ma11[1] < ma11 ,1) == 1 and (ma12[1] <= ma13[1] and ma12 > ma13) and countif(ma14[j][1] < ma14[j],1) == 1 and countif(ma15[1] < ma15 ,1) == 1 and countif(ma16[1] < ma16 ,1) == 1 and countif(ma17[1] < ma17 ,1) == 1 Then { 추세[j] = "매수추세"; } If countif(ma11[1] > ma11 ,1) == 1 and (ma12[1] >= ma13[1] and ma12 < ma13) and countif(ma14[j][1] > ma14[j],1) == 1 and countif(ma15[1] > ma15 ,1) == 1 and countif(ma16[1] > ma16 ,1) == 1 and countif(ma17[1] > ma17 ,1) == 1 Then { 추세[j] = "매도추세"; } If 추세[j] == "매수추세" Then 매수강도 = 매수강도 + 1; If 추세[j] == "매도추세" Then 매도강도 = 매도강도 + 1; } If 매수강도 == 100 Then 추세[0] = "매수추세"; If 매도강도 == 100 Then 추세[0] = "매도추세"; #Plot1(iff(추세[0]=="매수추세",100,iff(추세[0]=="매도추세",-100,0))); #PlotBaseLine1(0); } mav1 = ma(C,P1); mav2 = ma(C,P2); If b_time1<=Time and Time<= e_time1 Then { stoK = StochasticsK(stoK_p11,stoK_p12); stoD = StochasticsD(stoK_p11,stoK_p12,stoK_p13); If countif(ma(C,ma_Period11)[1] < ma(C,ma_Period11),1) == 1 and (ma(C,ma_Period12)[1] <= ma(C,ma_Period13)[1] and ma(C,ma_Period12) > ma(C,ma_Period13)) and countif(ma(C,ma_Period14)[1] < ma(C,ma_Period14),1) == 1 and countif(ma(C,ma_Period15)[1] < ma(C,ma_Period15),1) == 1 and countif(ma(C,ma_Period16)[1] < ma(C,ma_Period16),1) == 1 and countif(ma(C,ma_Period17)[1] < ma(C,ma_Period17),1) == 1 Then { T = 1; } If countif(ma(C,ma_Period11)[1] > ma(C,ma_Period11),1) == 1 and (ma(C,ma_Period12)[1] >= ma(C,ma_Period13)[1] and ma(C,ma_Period12) < ma(C,ma_Period13)) and countif(ma(C,ma_Period14)[1] > ma(C,ma_Period14),1) == 1 and countif(ma(C,ma_Period15)[1] > ma(C,ma_Period15),1) == 1 and countif(ma(C,ma_Period16)[1] > ma(C,ma_Period16),1) == 1 and countif(ma(C,ma_Period17)[1] > ma(C,ma_Period17),1) == 1 Then { T = -1; } } If b_time1 <= Time and Time <= e_time1 Then { { if MarketPosition == 0 and T == 1 and Crossdown(stok,하단) and MarketPosition <= 0 and mav1 > mav2 Then buy("매수",AtMarket); if MarketPosition == 1 Then { if crossup(stok,상단) and c >= EntryPrice Then Exitlong("매수청산1",AtMarket); if crossup(stok,상단) and c <= EntryPrice Then Exitlong("매수청산2",atlimit,EntryPrice+PriceScale*2); if T == -1 and 추세[0] == "매도추세" Then Exitlong("추세전환(-)",AtMarket); if T == 1 and 추세[0] == "매도추세" Then Exitlong("bx1",Atlimit,EntryPrice+PriceScale*5); if T == -1 and 추세[0] == "매수추세" Then Exitlong("bx2",Atlimit,EntryPrice+PriceScale*5); if CrossDown(mav1,mav2) and c >= EntryPrice Then Exitlong("bx3",Atlimit,EntryPrice+PriceScale*5); } if MarketPosition == 0 and T == -1 and Crossup(stok,상단) and MarketPosition >= 0 and mav1 < mav2 then sell("매도",AtMarket); if MarketPosition == -1 Then { if Crossdown(stok,하단) and C <= EntryPrice Then ExitShort("매도청산1",AtMarket); if Crossdown(stok,하단) and C >= EntryPrice Then ExitShort("매도청산2",Atlimit,EntryPrice-PriceScale*2); if T == 1 and 추세[0] == "매수추세" Then ExitShort("추세전환(+)",AtMarket); if T == -1 and 추세[0] == "매수추세" Then ExitShort("sx1",atlimit,EntryPrice-PriceScale*5); if T == 1 and 추세[0] == "매도추세" Then ExitShort("sx2",atlimit,EntryPrice-PriceScale*5); if CrossUp(mav2,mav1) and C <= EntryPrice Then ExitShort("sx3",atlimit,EntryPrice-PriceScale*5); } } SetStopProfittarget(PriceScale*익절틱수,PointStop); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-07-24 15:52:45

안녕하세요 예스스탁입니다. input: b_time1(000000),e_time1(240000),n(3); Input : P1(30), P2(100); Array:ma14[101](0),추세[101](""); input: stoK_p11(70),stoK_p12(4),stoK_p13(6), ma_period11(23),ma_period12(6),ma_period13(14),ma_period14(100), ma_period15(10),ma_period16(20),ma_period17(15),상단(85),하단(15),익절틱수(50); Var: ma_p11(23),ma_p12(6),ma_p13(14),ma_p14_1(100),ma_p14_2(99),ma_p14_3(98),ma_p14_4(97), ma_p14_5(96),ma_p14_6(95),ma_p14_7(94),ma_p14_8(93),ma_p14_9(92),ma_p14_10(91),ma_p14_11(90),ma_p14_12(89),ma_p14_13(88),ma_p14_14(87), ma_p14_15(86),ma_p14_16(85),ma_p14_17(84),ma_p14_18(83),ma_p14_19(82),ma_p14_20(81), ma_p14_21(80),ma_p14_22(79),ma_p14_23(78),ma_p14_24(77),ma_p14_25(76),ma_p14_26(75),ma_p14_27(74), ma_p14_28(73),ma_p14_29(72),ma_p14_30(71),ma_p14_31(70),ma_p14_32(69),ma_p14_33(68),ma_p14_34(67), ma_p14_35(66),ma_p14_36(65),ma_p14_37(64),ma_p14_38(63),ma_p14_39(62),ma_p14_40(61), ma_p14_41(60),ma_p14_42(59),ma_p14_43(58),ma_p14_44(57),ma_p14_45(56),ma_p14_46(55),ma_p14_47(54), ma_p14_48(53),ma_p14_49(52),ma_p14_50(51),ma_p14_51(50),ma_p14_52(49),ma_p14_53(48),ma_p14_54(47), ma_p14_55(46),ma_p14_56(45),ma_p14_57(44),ma_p14_58(43),ma_p14_59(42),ma_p14_60(41), ma_p14_61(40),ma_p14_62(39),ma_p14_63(38),ma_p14_64(37),ma_p14_65(36),ma_p14_66(35),ma_p14_67(34), ma_p14_68(33),ma_p14_69(32),ma_p14_70(31),ma_p14_71(30),ma_p14_72(29),ma_p14_73(28),ma_p14_74(27), ma_p14_75(26),ma_p14_76(25),ma_p14_77(24),ma_p14_78(23),ma_p14_79(22),ma_p14_80(21), ma_p14_81(20),ma_p14_82(19),ma_p14_83(18),ma_p14_84(17),ma_p14_85(16),ma_p14_86(15),ma_p14_87(14), ma_p14_88(13),ma_p14_89(12),ma_p14_90(11),ma_p14_91(10),ma_p14_92(9),ma_p14_93(8),ma_p14_94(7), ma_p14_95(6),ma_p14_96(5),ma_p14_97(4),ma_p14_98(3),ma_p14_99(2),ma_p14_100(1),ma_p15(10),ma_p16(20),ma_p17(15), j(0),ma11(0),ma12(0),ma13(0),ma15(0),ma16(0),ma17(0),매수강도(0),매도강도(0); Var:mav1(0),mav2(0),stoK(0),stoD(0),T(0),entry(0); ma11 = ma(C,ma_p11); ma12 = ma(C,ma_p12); ma13 = ma(C,ma_p13); ma15 = ma(C,ma_p15); ma16 = ma(C,ma_p16); ma17 = ma(C,ma_p17); ma14[1] = ma(C,ma_p14_1); ma14[2] = ma(C,ma_p14_2); ma14[3] = ma(C,ma_p14_3); ma14[4] = ma(C,ma_p14_4); ma14[5] = ma(C,ma_p14_5); ma14[6] = ma(C,ma_p14_6); ma14[7] = ma(C,ma_p14_7); ma14[8] = ma(C,ma_p14_8); ma14[9] = ma(C,ma_p14_9); ma14[10] = ma(C,ma_p14_10); ma14[11] = ma(C,ma_p14_11); ma14[12] = ma(C,ma_p14_12); ma14[13] = ma(C,ma_p14_13); ma14[14] = ma(C,ma_p14_14); ma14[15] = ma(C,ma_p14_15); ma14[16] = ma(C,ma_p14_16); ma14[17] = ma(C,ma_p14_17); ma14[18] = ma(C,ma_p14_18); ma14[19] = ma(C,ma_p14_19); ma14[20] = ma(C,ma_p14_20); ma14[21] = ma(C,ma_p14_21); ma14[22] = ma(C,ma_p14_22); ma14[23] = ma(C,ma_p14_23); ma14[24] = ma(C,ma_p14_24); ma14[25] = ma(C,ma_p14_25); ma14[26] = ma(C,ma_p14_26); ma14[27] = ma(C,ma_p14_27); ma14[28] = ma(C,ma_p14_28); ma14[29] = ma(C,ma_p14_29); ma14[30] = ma(C,ma_p14_30); ma14[31] = ma(C,ma_p14_31); ma14[32] = ma(C,ma_p14_32); ma14[33] = ma(C,ma_p14_33); ma14[34] = ma(C,ma_p14_34); ma14[35] = ma(C,ma_p14_35); ma14[36] = ma(C,ma_p14_36); ma14[37] = ma(C,ma_p14_37); ma14[38] = ma(C,ma_p14_38); ma14[39] = ma(C,ma_p14_39); ma14[40] = ma(C,ma_p14_40); ma14[41] = ma(C,ma_p14_41); ma14[42] = ma(C,ma_p14_42); ma14[43] = ma(C,ma_p14_43); ma14[44] = ma(C,ma_p14_44); ma14[45] = ma(C,ma_p14_45); ma14[46] = ma(C,ma_p14_46); ma14[47] = ma(C,ma_p14_47); ma14[48] = ma(C,ma_p14_48); ma14[49] = ma(C,ma_p14_49); ma14[50] = ma(C,ma_p14_50); ma14[51] = ma(C,ma_p14_51); ma14[52] = ma(C,ma_p14_52); ma14[53] = ma(C,ma_p14_53); ma14[54] = ma(C,ma_p14_54); ma14[55] = ma(C,ma_p14_55); ma14[56] = ma(C,ma_p14_56); ma14[57] = ma(C,ma_p14_57); ma14[58] = ma(C,ma_p14_58); ma14[59] = ma(C,ma_p14_59); ma14[60] = ma(C,ma_p14_60); ma14[61] = ma(C,ma_p14_61); ma14[62] = ma(C,ma_p14_62); ma14[63] = ma(C,ma_p14_63); ma14[64] = ma(C,ma_p14_64); ma14[65] = ma(C,ma_p14_65); ma14[66] = ma(C,ma_p14_66); ma14[67] = ma(C,ma_p14_67); ma14[68] = ma(C,ma_p14_68); ma14[69] = ma(C,ma_p14_69); ma14[70] = ma(C,ma_p14_70); ma14[71] = ma(C,ma_p14_71); ma14[72] = ma(C,ma_p14_72); ma14[73] = ma(C,ma_p14_73); ma14[74] = ma(C,ma_p14_74); ma14[75] = ma(C,ma_p14_75); ma14[76] = ma(C,ma_p14_76); ma14[77] = ma(C,ma_p14_77); ma14[78] = ma(C,ma_p14_78); ma14[79] = ma(C,ma_p14_79); ma14[80] = ma(C,ma_p14_80); ma14[81] = ma(C,ma_p14_81); ma14[82] = ma(C,ma_p14_82); ma14[83] = ma(C,ma_p14_83); ma14[84] = ma(C,ma_p14_84); ma14[85] = ma(C,ma_p14_85); ma14[86] = ma(C,ma_p14_86); ma14[87] = ma(C,ma_p14_87); ma14[88] = ma(C,ma_p14_88); ma14[89] = ma(C,ma_p14_89); ma14[90] = ma(C,ma_p14_90); ma14[91] = ma(C,ma_p14_91); ma14[92] = ma(C,ma_p14_92); ma14[93] = ma(C,ma_p14_93); ma14[94] = ma(C,ma_p14_94); ma14[95] = ma(C,ma_p14_95); ma14[96] = ma(C,ma_p14_96); ma14[97] = ma(C,ma_p14_97); ma14[98] = ma(C,ma_p14_98); ma14[99] = ma(C,ma_p14_99); ma14[100] = ma(C,ma_p14_100); 매수강도 = 0; 매도강도 = 0; If b_time1 <= Time and Time <= e_time1 Then { entry = 0; For j = 1 To 100 { If countif(ma11[1] < ma11 ,1) == 1 and (ma12[1] <= ma13[1] and ma12 > ma13) and countif(ma14[j][1] < ma14[j],1) == 1 and countif(ma15[1] < ma15 ,1) == 1 and countif(ma16[1] < ma16 ,1) == 1 and countif(ma17[1] < ma17 ,1) == 1 Then { 추세[j] = "매수추세"; } If countif(ma11[1] > ma11 ,1) == 1 and (ma12[1] >= ma13[1] and ma12 < ma13) and countif(ma14[j][1] > ma14[j],1) == 1 and countif(ma15[1] > ma15 ,1) == 1 and countif(ma16[1] > ma16 ,1) == 1 and countif(ma17[1] > ma17 ,1) == 1 Then { 추세[j] = "매도추세"; } If 추세[j] == "매수추세" Then 매수강도 = 매수강도 + 1; If 추세[j] == "매도추세" Then 매도강도 = 매도강도 + 1; } If 매수강도 == 100 Then 추세[0] = "매수추세"; If 매도강도 == 100 Then 추세[0] = "매도추세"; #Plot1(iff(추세[0]=="매수추세",100,iff(추세[0]=="매도추세",-100,0))); #PlotBaseLine1(0); } if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry+1; mav1 = ma(C,P1); mav2 = ma(C,P2); If b_time1<=Time and Time<= e_time1 Then { stoK = StochasticsK(stoK_p11,stoK_p12); stoD = StochasticsD(stoK_p11,stoK_p12,stoK_p13); If countif(ma(C,ma_Period11)[1] < ma(C,ma_Period11),1) == 1 and (ma(C,ma_Period12)[1] <= ma(C,ma_Period13)[1] and ma(C,ma_Period12) > ma(C,ma_Period13)) and countif(ma(C,ma_Period14)[1] < ma(C,ma_Period14),1) == 1 and countif(ma(C,ma_Period15)[1] < ma(C,ma_Period15),1) == 1 and countif(ma(C,ma_Period16)[1] < ma(C,ma_Period16),1) == 1 and countif(ma(C,ma_Period17)[1] < ma(C,ma_Period17),1) == 1 Then { T = 1; } If countif(ma(C,ma_Period11)[1] > ma(C,ma_Period11),1) == 1 and (ma(C,ma_Period12)[1] >= ma(C,ma_Period13)[1] and ma(C,ma_Period12) < ma(C,ma_Period13)) and countif(ma(C,ma_Period14)[1] > ma(C,ma_Period14),1) == 1 and countif(ma(C,ma_Period15)[1] > ma(C,ma_Period15),1) == 1 and countif(ma(C,ma_Period16)[1] > ma(C,ma_Period16),1) == 1 and countif(ma(C,ma_Period17)[1] > ma(C,ma_Period17),1) == 1 Then { T = -1; } } If b_time1 <= Time and Time <= e_time1 Then { { if entry < n and MarketPosition == 0 and T == 1 and Crossdown(stok,하단) and MarketPosition <= 0 and mav1 > mav2 Then buy("매수",AtMarket); if MarketPosition == 1 Then { if crossup(stok,상단) and c >= EntryPrice Then Exitlong("매수청산1",AtMarket); if crossup(stok,상단) and c <= EntryPrice Then Exitlong("매수청산2",atlimit,EntryPrice+PriceScale*2); if T == -1 and 추세[0] == "매도추세" Then Exitlong("추세전환(-)",AtMarket); if T == 1 and 추세[0] == "매도추세" Then Exitlong("bx1",Atlimit,EntryPrice+PriceScale*5); if T == -1 and 추세[0] == "매수추세" Then Exitlong("bx2",Atlimit,EntryPrice+PriceScale*5); if CrossDown(mav1,mav2) and c >= EntryPrice Then Exitlong("bx3",Atlimit,EntryPrice+PriceScale*5); } if entry < n and MarketPosition == 0 and T == -1 and Crossup(stok,상단) and MarketPosition >= 0 and mav1 < mav2 then sell("매도",AtMarket); if MarketPosition == -1 Then { if Crossdown(stok,하단) and C <= EntryPrice Then ExitShort("매도청산1",AtMarket); if Crossdown(stok,하단) and C >= EntryPrice Then ExitShort("매도청산2",Atlimit,EntryPrice-PriceScale*2); if T == 1 and 추세[0] == "매수추세" Then ExitShort("추세전환(+)",AtMarket); if T == -1 and 추세[0] == "매수추세" Then ExitShort("sx1",atlimit,EntryPrice-PriceScale*5); if T == 1 and 추세[0] == "매도추세" Then ExitShort("sx2",atlimit,EntryPrice-PriceScale*5); if CrossUp(mav2,mav1) and C <= EntryPrice Then ExitShort("sx3",atlimit,EntryPrice-PriceScale*5); } } SetStopProfittarget(PriceScale*익절틱수,PointStop); } 즐거운 하루되세요 > 미완 님이 쓴 글입니다. > 제목 : 수식 변경 부탁드립니다. > 아래 수식에서 추세변환 후 진입 신호를 함수로 지정하여(예 1번 아니면 2번 등) 진입하고 다음 반대 추세가 나올 때 함수 진입 횟수에 따라 진입하도록 수식 변경 부탁드립니다. input: b_time1(000000),e_time1(240000); Input : P1(30), P2(100); Array:ma14[101](0),추세[101](""); input: stoK_p11(70),stoK_p12(4),stoK_p13(6), ma_period11(23),ma_period12(6),ma_period13(14),ma_period14(100), ma_period15(10),ma_period16(20),ma_period17(15),상단(85),하단(15),익절틱수(50); Var: ma_p11(23),ma_p12(6),ma_p13(14),ma_p14_1(100),ma_p14_2(99),ma_p14_3(98),ma_p14_4(97), ma_p14_5(96),ma_p14_6(95),ma_p14_7(94),ma_p14_8(93),ma_p14_9(92),ma_p14_10(91),ma_p14_11(90),ma_p14_12(89),ma_p14_13(88),ma_p14_14(87), ma_p14_15(86),ma_p14_16(85),ma_p14_17(84),ma_p14_18(83),ma_p14_19(82),ma_p14_20(81), ma_p14_21(80),ma_p14_22(79),ma_p14_23(78),ma_p14_24(77),ma_p14_25(76),ma_p14_26(75),ma_p14_27(74), ma_p14_28(73),ma_p14_29(72),ma_p14_30(71),ma_p14_31(70),ma_p14_32(69),ma_p14_33(68),ma_p14_34(67), ma_p14_35(66),ma_p14_36(65),ma_p14_37(64),ma_p14_38(63),ma_p14_39(62),ma_p14_40(61), ma_p14_41(60),ma_p14_42(59),ma_p14_43(58),ma_p14_44(57),ma_p14_45(56),ma_p14_46(55),ma_p14_47(54), ma_p14_48(53),ma_p14_49(52),ma_p14_50(51),ma_p14_51(50),ma_p14_52(49),ma_p14_53(48),ma_p14_54(47), ma_p14_55(46),ma_p14_56(45),ma_p14_57(44),ma_p14_58(43),ma_p14_59(42),ma_p14_60(41), ma_p14_61(40),ma_p14_62(39),ma_p14_63(38),ma_p14_64(37),ma_p14_65(36),ma_p14_66(35),ma_p14_67(34), ma_p14_68(33),ma_p14_69(32),ma_p14_70(31),ma_p14_71(30),ma_p14_72(29),ma_p14_73(28),ma_p14_74(27), ma_p14_75(26),ma_p14_76(25),ma_p14_77(24),ma_p14_78(23),ma_p14_79(22),ma_p14_80(21), ma_p14_81(20),ma_p14_82(19),ma_p14_83(18),ma_p14_84(17),ma_p14_85(16),ma_p14_86(15),ma_p14_87(14), ma_p14_88(13),ma_p14_89(12),ma_p14_90(11),ma_p14_91(10),ma_p14_92(9),ma_p14_93(8),ma_p14_94(7), ma_p14_95(6),ma_p14_96(5),ma_p14_97(4),ma_p14_98(3),ma_p14_99(2),ma_p14_100(1),ma_p15(10),ma_p16(20),ma_p17(15), j(0),ma11(0),ma12(0),ma13(0),ma15(0),ma16(0),ma17(0),매수강도(0),매도강도(0); Var:mav1(0),mav2(0),stoK(0),stoD(0),T(0); ma11 = ma(C,ma_p11); ma12 = ma(C,ma_p12); ma13 = ma(C,ma_p13); ma15 = ma(C,ma_p15); ma16 = ma(C,ma_p16); ma17 = ma(C,ma_p17); ma14[1] = ma(C,ma_p14_1); ma14[2] = ma(C,ma_p14_2); ma14[3] = ma(C,ma_p14_3); ma14[4] = ma(C,ma_p14_4); ma14[5] = ma(C,ma_p14_5); ma14[6] = ma(C,ma_p14_6); ma14[7] = ma(C,ma_p14_7); ma14[8] = ma(C,ma_p14_8); ma14[9] = ma(C,ma_p14_9); ma14[10] = ma(C,ma_p14_10); ma14[11] = ma(C,ma_p14_11); ma14[12] = ma(C,ma_p14_12); ma14[13] = ma(C,ma_p14_13); ma14[14] = ma(C,ma_p14_14); ma14[15] = ma(C,ma_p14_15); ma14[16] = ma(C,ma_p14_16); ma14[17] = ma(C,ma_p14_17); ma14[18] = ma(C,ma_p14_18); ma14[19] = ma(C,ma_p14_19); ma14[20] = ma(C,ma_p14_20); ma14[21] = ma(C,ma_p14_21); ma14[22] = ma(C,ma_p14_22); ma14[23] = ma(C,ma_p14_23); ma14[24] = ma(C,ma_p14_24); ma14[25] = ma(C,ma_p14_25); ma14[26] = ma(C,ma_p14_26); ma14[27] = ma(C,ma_p14_27); ma14[28] = ma(C,ma_p14_28); ma14[29] = ma(C,ma_p14_29); ma14[30] = ma(C,ma_p14_30); ma14[31] = ma(C,ma_p14_31); ma14[32] = ma(C,ma_p14_32); ma14[33] = ma(C,ma_p14_33); ma14[34] = ma(C,ma_p14_34); ma14[35] = ma(C,ma_p14_35); ma14[36] = ma(C,ma_p14_36); ma14[37] = ma(C,ma_p14_37); ma14[38] = ma(C,ma_p14_38); ma14[39] = ma(C,ma_p14_39); ma14[40] = ma(C,ma_p14_40); ma14[41] = ma(C,ma_p14_41); ma14[42] = ma(C,ma_p14_42); ma14[43] = ma(C,ma_p14_43); ma14[44] = ma(C,ma_p14_44); ma14[45] = ma(C,ma_p14_45); ma14[46] = ma(C,ma_p14_46); ma14[47] = ma(C,ma_p14_47); ma14[48] = ma(C,ma_p14_48); ma14[49] = ma(C,ma_p14_49); ma14[50] = ma(C,ma_p14_50); ma14[51] = ma(C,ma_p14_51); ma14[52] = ma(C,ma_p14_52); ma14[53] = ma(C,ma_p14_53); ma14[54] = ma(C,ma_p14_54); ma14[55] = ma(C,ma_p14_55); ma14[56] = ma(C,ma_p14_56); ma14[57] = ma(C,ma_p14_57); ma14[58] = ma(C,ma_p14_58); ma14[59] = ma(C,ma_p14_59); ma14[60] = ma(C,ma_p14_60); ma14[61] = ma(C,ma_p14_61); ma14[62] = ma(C,ma_p14_62); ma14[63] = ma(C,ma_p14_63); ma14[64] = ma(C,ma_p14_64); ma14[65] = ma(C,ma_p14_65); ma14[66] = ma(C,ma_p14_66); ma14[67] = ma(C,ma_p14_67); ma14[68] = ma(C,ma_p14_68); ma14[69] = ma(C,ma_p14_69); ma14[70] = ma(C,ma_p14_70); ma14[71] = ma(C,ma_p14_71); ma14[72] = ma(C,ma_p14_72); ma14[73] = ma(C,ma_p14_73); ma14[74] = ma(C,ma_p14_74); ma14[75] = ma(C,ma_p14_75); ma14[76] = ma(C,ma_p14_76); ma14[77] = ma(C,ma_p14_77); ma14[78] = ma(C,ma_p14_78); ma14[79] = ma(C,ma_p14_79); ma14[80] = ma(C,ma_p14_80); ma14[81] = ma(C,ma_p14_81); ma14[82] = ma(C,ma_p14_82); ma14[83] = ma(C,ma_p14_83); ma14[84] = ma(C,ma_p14_84); ma14[85] = ma(C,ma_p14_85); ma14[86] = ma(C,ma_p14_86); ma14[87] = ma(C,ma_p14_87); ma14[88] = ma(C,ma_p14_88); ma14[89] = ma(C,ma_p14_89); ma14[90] = ma(C,ma_p14_90); ma14[91] = ma(C,ma_p14_91); ma14[92] = ma(C,ma_p14_92); ma14[93] = ma(C,ma_p14_93); ma14[94] = ma(C,ma_p14_94); ma14[95] = ma(C,ma_p14_95); ma14[96] = ma(C,ma_p14_96); ma14[97] = ma(C,ma_p14_97); ma14[98] = ma(C,ma_p14_98); ma14[99] = ma(C,ma_p14_99); ma14[100] = ma(C,ma_p14_100); 매수강도 = 0; 매도강도 = 0; If b_time1 <= Time and Time <= e_time1 Then { For j = 1 To 100 { If countif(ma11[1] < ma11 ,1) == 1 and (ma12[1] <= ma13[1] and ma12 > ma13) and countif(ma14[j][1] < ma14[j],1) == 1 and countif(ma15[1] < ma15 ,1) == 1 and countif(ma16[1] < ma16 ,1) == 1 and countif(ma17[1] < ma17 ,1) == 1 Then { 추세[j] = "매수추세"; } If countif(ma11[1] > ma11 ,1) == 1 and (ma12[1] >= ma13[1] and ma12 < ma13) and countif(ma14[j][1] > ma14[j],1) == 1 and countif(ma15[1] > ma15 ,1) == 1 and countif(ma16[1] > ma16 ,1) == 1 and countif(ma17[1] > ma17 ,1) == 1 Then { 추세[j] = "매도추세"; } If 추세[j] == "매수추세" Then 매수강도 = 매수강도 + 1; If 추세[j] == "매도추세" Then 매도강도 = 매도강도 + 1; } If 매수강도 == 100 Then 추세[0] = "매수추세"; If 매도강도 == 100 Then 추세[0] = "매도추세"; #Plot1(iff(추세[0]=="매수추세",100,iff(추세[0]=="매도추세",-100,0))); #PlotBaseLine1(0); } mav1 = ma(C,P1); mav2 = ma(C,P2); If b_time1<=Time and Time<= e_time1 Then { stoK = StochasticsK(stoK_p11,stoK_p12); stoD = StochasticsD(stoK_p11,stoK_p12,stoK_p13); If countif(ma(C,ma_Period11)[1] < ma(C,ma_Period11),1) == 1 and (ma(C,ma_Period12)[1] <= ma(C,ma_Period13)[1] and ma(C,ma_Period12) > ma(C,ma_Period13)) and countif(ma(C,ma_Period14)[1] < ma(C,ma_Period14),1) == 1 and countif(ma(C,ma_Period15)[1] < ma(C,ma_Period15),1) == 1 and countif(ma(C,ma_Period16)[1] < ma(C,ma_Period16),1) == 1 and countif(ma(C,ma_Period17)[1] < ma(C,ma_Period17),1) == 1 Then { T = 1; } If countif(ma(C,ma_Period11)[1] > ma(C,ma_Period11),1) == 1 and (ma(C,ma_Period12)[1] >= ma(C,ma_Period13)[1] and ma(C,ma_Period12) < ma(C,ma_Period13)) and countif(ma(C,ma_Period14)[1] > ma(C,ma_Period14),1) == 1 and countif(ma(C,ma_Period15)[1] > ma(C,ma_Period15),1) == 1 and countif(ma(C,ma_Period16)[1] > ma(C,ma_Period16),1) == 1 and countif(ma(C,ma_Period17)[1] > ma(C,ma_Period17),1) == 1 Then { T = -1; } } If b_time1 <= Time and Time <= e_time1 Then { { if MarketPosition == 0 and T == 1 and Crossdown(stok,하단) and MarketPosition <= 0 and mav1 > mav2 Then buy("매수",AtMarket); if MarketPosition == 1 Then { if crossup(stok,상단) and c >= EntryPrice Then Exitlong("매수청산1",AtMarket); if crossup(stok,상단) and c <= EntryPrice Then Exitlong("매수청산2",atlimit,EntryPrice+PriceScale*2); if T == -1 and 추세[0] == "매도추세" Then Exitlong("추세전환(-)",AtMarket); if T == 1 and 추세[0] == "매도추세" Then Exitlong("bx1",Atlimit,EntryPrice+PriceScale*5); if T == -1 and 추세[0] == "매수추세" Then Exitlong("bx2",Atlimit,EntryPrice+PriceScale*5); if CrossDown(mav1,mav2) and c >= EntryPrice Then Exitlong("bx3",Atlimit,EntryPrice+PriceScale*5); } if MarketPosition == 0 and T == -1 and Crossup(stok,상단) and MarketPosition >= 0 and mav1 < mav2 then sell("매도",AtMarket); if MarketPosition == -1 Then { if Crossdown(stok,하단) and C <= EntryPrice Then ExitShort("매도청산1",AtMarket); if Crossdown(stok,하단) and C >= EntryPrice Then ExitShort("매도청산2",Atlimit,EntryPrice-PriceScale*2); if T == 1 and 추세[0] == "매수추세" Then ExitShort("추세전환(+)",AtMarket); if T == -1 and 추세[0] == "매수추세" Then ExitShort("sx1",atlimit,EntryPrice-PriceScale*5); if T == 1 and 추세[0] == "매도추세" Then ExitShort("sx2",atlimit,EntryPrice-PriceScale*5); if CrossUp(mav2,mav1) and C <= EntryPrice Then ExitShort("sx3",atlimit,EntryPrice-PriceScale*5); } } SetStopProfittarget(PriceScale*익절틱수,PointStop); }