커뮤니티

문의드립니다.

프로필 이미지
라떼처럼
2018-10-05 13:38:30
157
글번호 122468
답변완료
도움 감사드립니다. 아래는 안되는 부분입니다.수정부탁드립니다. 1. 당일 누적수익이 70틱 이상이면 당일 거래 종료 - 동작안함 2. 거래종료 청산 시간을 16:30으로 했는데 17:00 이후에 청산이 됩니다. 차트의 시간은 현지(미국) 시간을 사용중입니다. input : 목표청산1(0.4), 손절(40); ########### input : 시작시간(181000),종료시간(163000); Input : 당일누적수익(70),당일누적손실(70); var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false); ########### input: b_time1(000001),e_time1(030000), stoK_p11(50), stoK_p12(50), stoK_p13(10), ma_p11(10),ma_p12(5),ma_p13(15),ma_p14(250), b_time2(030001),e_time2(180000), stoK_p21(50),stoK_p22(50),stoK_p23(10), ma_p21(25),ma_p22(5),ma_p23(15),ma_p24(127), b_time3(180001),e_time3(240000), stoK_p31(50),stoK_p32(50),stoK_p33(10), ma_p31(25),ma_p32(5),ma_p33(15),ma_p34(102), var : BH(0),SL(0),para(0),HE(0),LE(0); Var:stoK(0),stoD(0),TRIXv(0),TRIXsig(0); var : StochasticsKS1(0),StochasticsDS1(0),HV1(0),Lv1(0),FK1(0); var : StochasticsKS2(0),StochasticsDS2(0),HV2(0),Lv2(0),FK2(0); var : StochasticsKS3(0),StochasticsDS3(0),HV3(0),Lv3(0),FK3(0); LV1 = Lowest(L, stoK_p11); HV1 = Highest(H, stoK_p11); FK1 = (Close - LV1) / (HV1 - LV1) * 100; StochasticsKS1 = ma(FK1,stoK_p12); StochasticsDS1 = ma(StochasticsKS1,stoK_p13); LV2 = Lowest(L, stoK_p21); HV2 = Highest(H, stoK_p21); FK2 = (Close - LV2) / (HV2 - LV2) * 100; StochasticsKS2 = ma(FK2,stoK_p22); StochasticsDS2 = ma(StochasticsKS2,stoK_p23); LV3 = Lowest(L, stoK_p31); HV3 = Highest(H, stoK_p31); FK3 = (Close - LV3) / (HV3 - LV3) * 100; StochasticsKS3 = ma(FK3,stoK_p32); StochasticsDS3 = ma(StochasticsKS3,stoK_p33); ############## if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Xcond = false; N1 = NetProfit; } 당일수익 = PriceScale*당일누적수익; 당일손실 = PriceScale*당일누적손실; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; ################ If b_time1 <= Time and Time <= e_time1 and Xcond == false Then { stoK = StochasticsKS1; stoD = StochasticsDS1; If countif(ma(C,ma_p11)[1] < ma(C,ma_p11),1) == 1 and ma(C,ma_p12) > ma(C,ma_p13) and countif(ma(C,ma_p14)[1] < ma(C,ma_p14),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수1",AtMarket); } If countif(ma(C,ma_p11)[1] > ma(C,ma_p11),1) == 1 and ma(C,ma_p12) < ma(C,ma_p13) and countif(ma(C,ma_p14)[1] > ma(C,ma_p14),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도1",AtMarket); } } If b_time2 <= Time and Time <= e_time2 and Xcond == false Then { stoK = StochasticsKS2; stoD = StochasticsDS2; If countif(ma(C,ma_p21)[1] < ma(C,ma_p21),1) == 1 and ma(C,ma_p22) > ma(C,ma_p23) and countif(ma(C,ma_p24)[1] < ma(C,ma_p24),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수2",AtMarket); } If countif(ma(C,ma_p21)[1] > ma(C,ma_p21),1) == 1 and ma(C,ma_p22) < ma(C,ma_p23) and countif(ma(C,ma_p24)[1] > ma(C,ma_p24),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도2",AtMarket); } } If b_time3 <= Time and Time <= e_time3 and Xcond == false Then { stoK = StochasticsKS3; stoD = StochasticsDS3; If countif(ma(C,ma_p31)[1] < ma(C,ma_p31),1) == 1 and ma(C,ma_p32) > ma(C,ma_p33) and countif(ma(C,ma_p34)[1] < ma(C,ma_p34),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수3",AtMarket); } If countif(ma(C,ma_p31)[1] > ma(C,ma_p31),1) == 1 and ma(C,ma_p32) < ma(C,ma_p33) and countif(ma(C,ma_p34)[1] > ma(C,ma_p34),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도3",AtMarket); } } if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); SetStopProfittarget(목표청산1); ExitLong("B손절",AtStop,HE-PriceScale*손절); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); SetStopProfittarget(목표청산1); ExitShort("S손절",AtStop,LE+PriceScale*손절); } 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)); } if 종료시간 <= sTime and sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-10-08 09:54:32

안녕하세요 예스스탁입니다. input : 목표청산1(0.4), 손절(40); ########### input : 시작시간(181000),종료시간(163000); Input : 당일누적수익틱수(70),당일누적손실틱수(70); var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false); ########### input: b_time1(000001),e_time1(030000), stoK_p11(50), stoK_p12(50), stoK_p13(10), ma_p11(10),ma_p12(5),ma_p13(15),ma_p14(250), b_time2(030001),e_time2(180000), stoK_p21(50),stoK_p22(50),stoK_p23(10), ma_p21(25),ma_p22(5),ma_p23(15),ma_p24(127), b_time3(180001),e_time3(240000), stoK_p31(50),stoK_p32(50),stoK_p33(10), ma_p31(25),ma_p32(5),ma_p33(15),ma_p34(102); var : BH(0),SL(0),para(0),HE(0),LE(0); Var:stoK(0),stoD(0),TRIXv(0),TRIXsig(0); var : StochasticsKS1(0),StochasticsDS1(0),HV1(0),Lv1(0),FK1(0); var : StochasticsKS2(0),StochasticsDS2(0),HV2(0),Lv2(0),FK2(0); var : StochasticsKS3(0),StochasticsDS3(0),HV3(0),Lv3(0),FK3(0); LV1 = Lowest(L, stoK_p11); HV1 = Highest(H, stoK_p11); FK1 = (Close - LV1) / (HV1 - LV1) * 100; StochasticsKS1 = ma(FK1,stoK_p12); StochasticsDS1 = ma(StochasticsKS1,stoK_p13); LV2 = Lowest(L, stoK_p21); HV2 = Highest(H, stoK_p21); FK2 = (Close - LV2) / (HV2 - LV2) * 100; StochasticsKS2 = ma(FK2,stoK_p22); StochasticsDS2 = ma(StochasticsKS2,stoK_p23); LV3 = Lowest(L, stoK_p31); HV3 = Highest(H, stoK_p31); FK3 = (Close - LV3) / (HV3 - LV3) * 100; StochasticsKS3 = ma(FK3,stoK_p32); StochasticsDS3 = ma(StochasticsKS3,stoK_p33); ############## if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Xcond = false; N1 = NetProfit; } 당일수익 = PriceScale*당일누적수익틱수; 당일손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; ################ If b_time1 <= sTime and sTime <= e_time1 and Xcond == false Then { stoK = StochasticsKS1; stoD = StochasticsDS1; If countif(ma(C,ma_p11)[1] < ma(C,ma_p11),1) == 1 and ma(C,ma_p12) > ma(C,ma_p13) and countif(ma(C,ma_p14)[1] < ma(C,ma_p14),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수1",AtMarket); } If countif(ma(C,ma_p11)[1] > ma(C,ma_p11),1) == 1 and ma(C,ma_p12) < ma(C,ma_p13) and countif(ma(C,ma_p14)[1] > ma(C,ma_p14),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도1",AtMarket); } } If b_time2 <= sTime and sTime <= e_time2 and Xcond == false Then { stoK = StochasticsKS2; stoD = StochasticsDS2; If countif(ma(C,ma_p21)[1] < ma(C,ma_p21),1) == 1 and ma(C,ma_p22) > ma(C,ma_p23) and countif(ma(C,ma_p24)[1] < ma(C,ma_p24),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수2",AtMarket); } If countif(ma(C,ma_p21)[1] > ma(C,ma_p21),1) == 1 and ma(C,ma_p22) < ma(C,ma_p23) and countif(ma(C,ma_p24)[1] > ma(C,ma_p24),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도2",AtMarket); } } If b_time3 <= sTime and sTime <= e_time3 and Xcond == false Then { stoK = StochasticsKS3; stoD = StochasticsDS3; If countif(ma(C,ma_p31)[1] < ma(C,ma_p31),1) == 1 and ma(C,ma_p32) > ma(C,ma_p33) and countif(ma(C,ma_p34)[1] < ma(C,ma_p34),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수3",AtMarket); } If countif(ma(C,ma_p31)[1] > ma(C,ma_p31),1) == 1 and ma(C,ma_p32) < ma(C,ma_p33) and countif(ma(C,ma_p34)[1] > ma(C,ma_p34),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도3",AtMarket); } } if MarketPosition == 1 Then { BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); SetStopProfittarget(목표청산1); ExitLong("B손절",AtStop,HE-PriceScale*손절); } if MarketPosition == -1 Then { SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); SetStopProfittarget(목표청산1); ExitShort("S손절",AtStop,LE+PriceScale*손절); } 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)); } if (date != date[1] and 종료시간 <= sTime) or (date == date[1] and 종료시간 <= sTime and sTime[1] < 종료시간) then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } } 즐거운 하루되세요 > 라떼처럼 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움 감사드립니다. 아래는 안되는 부분입니다.수정부탁드립니다. 1. 당일 누적수익이 70틱 이상이면 당일 거래 종료 - 동작안함 2. 거래종료 청산 시간을 16:30으로 했는데 17:00 이후에 청산이 됩니다. 차트의 시간은 현지(미국) 시간을 사용중입니다. input : 목표청산1(0.4), 손절(40); ########### input : 시작시간(181000),종료시간(163000); Input : 당일누적수익(70),당일누적손실(70); var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false); ########### input: b_time1(000001),e_time1(030000), stoK_p11(50), stoK_p12(50), stoK_p13(10), ma_p11(10),ma_p12(5),ma_p13(15),ma_p14(250), b_time2(030001),e_time2(180000), stoK_p21(50),stoK_p22(50),stoK_p23(10), ma_p21(25),ma_p22(5),ma_p23(15),ma_p24(127), b_time3(180001),e_time3(240000), stoK_p31(50),stoK_p32(50),stoK_p33(10), ma_p31(25),ma_p32(5),ma_p33(15),ma_p34(102), var : BH(0),SL(0),para(0),HE(0),LE(0); Var:stoK(0),stoD(0),TRIXv(0),TRIXsig(0); var : StochasticsKS1(0),StochasticsDS1(0),HV1(0),Lv1(0),FK1(0); var : StochasticsKS2(0),StochasticsDS2(0),HV2(0),Lv2(0),FK2(0); var : StochasticsKS3(0),StochasticsDS3(0),HV3(0),Lv3(0),FK3(0); LV1 = Lowest(L, stoK_p11); HV1 = Highest(H, stoK_p11); FK1 = (Close - LV1) / (HV1 - LV1) * 100; StochasticsKS1 = ma(FK1,stoK_p12); StochasticsDS1 = ma(StochasticsKS1,stoK_p13); LV2 = Lowest(L, stoK_p21); HV2 = Highest(H, stoK_p21); FK2 = (Close - LV2) / (HV2 - LV2) * 100; StochasticsKS2 = ma(FK2,stoK_p22); StochasticsDS2 = ma(StochasticsKS2,stoK_p23); LV3 = Lowest(L, stoK_p31); HV3 = Highest(H, stoK_p31); FK3 = (Close - LV3) / (HV3 - LV3) * 100; StochasticsKS3 = ma(FK3,stoK_p32); StochasticsDS3 = ma(StochasticsKS3,stoK_p33); ############## if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Xcond = false; N1 = NetProfit; } 당일수익 = PriceScale*당일누적수익; 당일손실 = PriceScale*당일누적손실; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; ################ If b_time1 <= Time and Time <= e_time1 and Xcond == false Then { stoK = StochasticsKS1; stoD = StochasticsDS1; If countif(ma(C,ma_p11)[1] < ma(C,ma_p11),1) == 1 and ma(C,ma_p12) > ma(C,ma_p13) and countif(ma(C,ma_p14)[1] < ma(C,ma_p14),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수1",AtMarket); } If countif(ma(C,ma_p11)[1] > ma(C,ma_p11),1) == 1 and ma(C,ma_p12) < ma(C,ma_p13) and countif(ma(C,ma_p14)[1] > ma(C,ma_p14),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도1",AtMarket); } } If b_time2 <= Time and Time <= e_time2 and Xcond == false Then { stoK = StochasticsKS2; stoD = StochasticsDS2; If countif(ma(C,ma_p21)[1] < ma(C,ma_p21),1) == 1 and ma(C,ma_p22) > ma(C,ma_p23) and countif(ma(C,ma_p24)[1] < ma(C,ma_p24),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수2",AtMarket); } If countif(ma(C,ma_p21)[1] > ma(C,ma_p21),1) == 1 and ma(C,ma_p22) < ma(C,ma_p23) and countif(ma(C,ma_p24)[1] > ma(C,ma_p24),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도2",AtMarket); } } If b_time3 <= Time and Time <= e_time3 and Xcond == false Then { stoK = StochasticsKS3; stoD = StochasticsDS3; If countif(ma(C,ma_p31)[1] < ma(C,ma_p31),1) == 1 and ma(C,ma_p32) > ma(C,ma_p33) and countif(ma(C,ma_p34)[1] < ma(C,ma_p34),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매수1" or EntryName(1) == "매수2" or EntryName(1) == "매수3") and MarketPosition == 0) Then Buy("매수3",AtMarket); } If countif(ma(C,ma_p31)[1] > ma(C,ma_p31),1) == 1 and ma(C,ma_p32) < ma(C,ma_p33) and countif(ma(C,ma_p34)[1] > ma(C,ma_p34),1) == 1 Then { If !((ExitName(1) == "StopProfitTarget" ) and (EntryName(1) == "매도1" or EntryName(1) == "매도2" or EntryName(1) == "매도3") and MarketPosition == 0) Then Sell("매도3",AtMarket); } } if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); SetStopProfittarget(목표청산1); ExitLong("B손절",AtStop,HE-PriceScale*손절); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); SetStopProfittarget(목표청산1); ExitShort("S손절",AtStop,LE+PriceScale*손절); } 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)); } if 종료시간 <= sTime and sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } }