커뮤니티

문의드립니다.

프로필 이미지
고박사122
2018-10-28 22:44:53
237
글번호 123126
답변완료

첨부 이미지

안녕하세요. 문의드&#47559; 사항은 각각의 시스템은 정상적으로 되나 2가지 시스템을 합성할 경우 문제가 발생합니다. 검토 부탁드립니다. 문제점 1 : 이익 청산 시 2개 물량이 먼저 동시 청산됩니다. 문제점 2 : System I: input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (15); Input : 전환선기간 (5), 기준선기간1(26), 기준선기간2(1), 선행스팬2기간(52), short(12), long(26), sig(9),BBP(120), 당일누적손실틱수 (100); Var : MACDv(0), MACDsig(0),macdosc(0), Condition3(false); var : 전환선 (0), 기준선1(0), 기준선2(0), 후행스팬(0), 선행스팬1(0), 선행스팬2(0), Xcond(false),N1(0),daypl(0),당일누적손실 (0); var1 = MACD(short, long); var2 = ema(MACDv,sig); var3 = ma(C,BBP); 전환선 = (Highest(High, 전환선기간 ) + Lowest(Low, 전환선기간 )) / 2; 기준선1 = (Highest(High, 기준선기간1 ) + Lowest(Low, 기준선기간1 )) / 2; 기준선2 = (Highest(High, 기준선기간2 ) + Lowest(Low, 기준선기간2 )) / 2; 선행스팬1 = (전환선 [25] + 기준선2 [25]) / 2 ; 선행스팬2 = (Highest(High, 선행스팬2기간 )[25] + Lowest(Low, 선행스팬2기간 )[25]) / 2; if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; if 거래시간 == 1 or 거래시간 == 2 then { if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Xcond = false; N1 = NetProfit; } } else { if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } } 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then Xcond = true; # 매수/매도청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and var3 > var3[1] and var1 > var2 and 전환선 > 기준선1 and crossup(C,전환선 ) and C > O Then { Buy("b",OnClose,def,3); ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1); ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1); ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3); } # 매도/매수청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and var3 < var3[1] and var1 < var2 and 전환선 < 기준선1 and CrossDown(C,전환선 ) and C < O Then { Sell("s",OnClose,def,3); ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1); ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1); ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3); } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3); } if MarketPosition == -1 Then{ if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3); } SetStopLoss(PriceScale*손절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if MarketPosition == 1 then { ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts)); } System 2: input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (10); Input : shortPeriod(12), longPeriod(26), 당일누적손실틱수 (100); Var : value(0), Condition3(false); var : Xcond(false),N1(0),daypl(0),당일누적손실 (0); value = MACD(shortPeriod, longPeriod); if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; if 거래시간 == 1 or 거래시간 == 2 then { if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Xcond = false; N1 = NetProfit; } } else { if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } } 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then Xcond = true; # 매수/매도청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and CrossUP(value, 0) Then { Buy("b",OnClose,def,3); ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1); ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1); ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3); } # 매도/매수청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and CrossDown(value, 0) Then { Sell("s",OnClose,def,3); ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1); ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1); ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3); } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3); } if MarketPosition == -1 Then{ if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3); } SetStopLoss(PriceScale*손절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if MarketPosition == 1 then { ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts)); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-10-29 15:11:40

안녕하세요 예스스탁입니다. 시스템은 어떤 방식으로 합성을 원하시는지 불명확합니다. 만약 기존에 시스템 합성관리자를 통해 합성하셨다면 시스템 합성관리자는 단순히 or로 합쳐지므로 청산도 동일내용이 2개가 되어 동일조건이면 2번 동작하게 됩니다. 청산내용이 동일하므로 진입식만 추가하셔서 새로운 식을 만드셔야 합니다. input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (15); Input : 전환선기간 (5), 기준선기간1(26), 기준선기간2(1), 선행스팬2기간(52), short(12), long(26), sig(9),BBP(120), 당일누적손실틱수 (100); Var : MACDv(0), MACDsig(0),macdosc(0), Condition3(false); var : 전환선 (0), 기준선1(0), 기준선2(0), 후행스팬(0), 선행스팬1(0), 선행스팬2(0), Xcond(false),N1(0),daypl(0),당일누적손실 (0); var1 = MACD(short, long); var2 = ema(MACDv,sig); var3 = ma(C,BBP); 전환선 = (Highest(High, 전환선기간 ) + Lowest(Low, 전환선기간 )) / 2; 기준선1 = (Highest(High, 기준선기간1 ) + Lowest(Low, 기준선기간1 )) / 2; 기준선2 = (Highest(High, 기준선기간2 ) + Lowest(Low, 기준선기간2 )) / 2; 선행스팬1 = (전환선 [25] + 기준선2 [25]) / 2 ; 선행스팬2 = (Highest(High, 선행스팬2기간 )[25] + Lowest(Low, 선행스팬2기간 )[25]) / 2; if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; if 거래시간 == 1 or 거래시간 == 2 then { if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Xcond = false; N1 = NetProfit; } } else { if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } } 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then Xcond = true; if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and var3 > var3[1] and var1 > var2 and 전환선 > 기준선1 and crossup(C,전환선 ) and C > O Then { Buy("b1",OnClose,def,3); ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1); ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1); ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3); } if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and CrossUP(var1, 0) Then { Buy("b2",OnClose,def,3); ExitLong("bp1..",atlimit,C+PriceScale*익절틱수1,"",1,1); ExitLong("bp2..",atlimit,C+PriceScale*익절틱수2,"",1,1); ExitLong("bp3..",atlimit,C+PriceScale*익절틱수3); } # 매도/매수청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and var3 < var3[1] and var1 < var2 and 전환선 < 기준선1 and CrossDown(C,전환선 ) and C < O Then { Sell("s1",OnClose,def,3); ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1); ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1); ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3); } if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and CrossDown(var1, 0) Then { Sell("s2",OnClose,def,3); ExitShort("sp1..",atlimit,C-PriceScale*익절틱수1,"",1,1); ExitShort("sp2..",atlimit,C-PriceScale*익절틱수2,"",1,1); ExitShort("sp3..",atlimit,C-PriceScale*익절틱수3); } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3); } if MarketPosition == -1 Then{ if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3); } SetStopLoss(PriceScale*손절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if MarketPosition == 1 then { ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts)); } 즐거운 하루되세요 > 고박사122 님이 쓴 글입니다. > 제목 : 문의드립니다. > 안녕하세요. 문의드맇 사항은 각각의 시스템은 정상적으로 되나 2가지 시스템을 합성할 경우 문제가 발생합니다. 검토 부탁드립니다. 문제점 1 : 이익 청산 시 2개 물량이 먼저 동시 청산됩니다. 문제점 2 : System I: input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (15); Input : 전환선기간 (5), 기준선기간1(26), 기준선기간2(1), 선행스팬2기간(52), short(12), long(26), sig(9),BBP(120), 당일누적손실틱수 (100); Var : MACDv(0), MACDsig(0),macdosc(0), Condition3(false); var : 전환선 (0), 기준선1(0), 기준선2(0), 후행스팬(0), 선행스팬1(0), 선행스팬2(0), Xcond(false),N1(0),daypl(0),당일누적손실 (0); var1 = MACD(short, long); var2 = ema(MACDv,sig); var3 = ma(C,BBP); 전환선 = (Highest(High, 전환선기간 ) + Lowest(Low, 전환선기간 )) / 2; 기준선1 = (Highest(High, 기준선기간1 ) + Lowest(Low, 기준선기간1 )) / 2; 기준선2 = (Highest(High, 기준선기간2 ) + Lowest(Low, 기준선기간2 )) / 2; 선행스팬1 = (전환선 [25] + 기준선2 [25]) / 2 ; 선행스팬2 = (Highest(High, 선행스팬2기간 )[25] + Lowest(Low, 선행스팬2기간 )[25]) / 2; if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; if 거래시간 == 1 or 거래시간 == 2 then { if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Xcond = false; N1 = NetProfit; } } else { if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } } 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then Xcond = true; # 매수/매도청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and var3 > var3[1] and var1 > var2 and 전환선 > 기준선1 and crossup(C,전환선 ) and C > O Then { Buy("b",OnClose,def,3); ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1); ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1); ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3); } # 매도/매수청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and var3 < var3[1] and var1 < var2 and 전환선 < 기준선1 and CrossDown(C,전환선 ) and C < O Then { Sell("s",OnClose,def,3); ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1); ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1); ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3); } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3); } if MarketPosition == -1 Then{ if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3); } SetStopLoss(PriceScale*손절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if MarketPosition == 1 then { ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts)); } System 2: input : 거래시간 (1), 시작시간 (220000), 끝시간 (045000),익절틱수1(10),익절틱수2(15),익절틱수3(20),손절틱수 (10); Input : shortPeriod(12), longPeriod(26), 당일누적손실틱수 (100); Var : value(0), Condition3(false); var : Xcond(false),N1(0),daypl(0),당일누적손실 (0); value = MACD(shortPeriod, longPeriod); if 거래시간 == 1 then condition3 = (stime>=시작시간 or stime<=끝시간); Else if 거래시간 == 2 then condition3 = (stime>=시작시간 and stime<=끝시간); Else condition3 = true; if 거래시간 == 1 or 거래시간 == 2 then { if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Xcond = false; N1 = NetProfit; } } else { if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } } 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbl",1) == true or IsExitName("dsl",1) == true) then Xcond = true; # 매수/매도청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and CrossUP(value, 0) Then { Buy("b",OnClose,def,3); ExitLong("bp1.",atlimit,C+PriceScale*익절틱수1,"",1,1); ExitLong("bp2.",atlimit,C+PriceScale*익절틱수2,"",1,1); ExitLong("bp3.",atlimit,C+PriceScale*익절틱수3); } # 매도/매수청산 if MarketPosition == 0 and TotalTrades == TotalTrades[3] and Xcond == false and Condition3 == true and CrossDown(value, 0) Then { Sell("s",OnClose,def,3); ExitShort("sp1.",atlimit,C-PriceScale*익절틱수1,"",1,1); ExitShort("sp2.",atlimit,C-PriceScale*익절틱수2,"",1,1); ExitShort("sp3.",atlimit,C-PriceScale*익절틱수3); } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수1 then ExitLong("bp1",atlimit,EntryPrice+PriceScale*익절틱수1,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수2 then ExitLong("bp2",atlimit,EntryPrice+PriceScale*익절틱수2,"",1,1); if highest(H,BarsSinceEntry) < EntryPrice+PriceScale*익절틱수3 then ExitLong("bp3",atlimit,EntryPrice+PriceScale*익절틱수3); } if MarketPosition == -1 Then{ if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수1 Then ExitShort("sp1",atlimit,EntryPrice-PriceScale*익절틱수1,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수2 Then ExitShort("sp2",atlimit,EntryPrice-PriceScale*익절틱수2,"",1,1); if lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*익절틱수3 Then ExitShort("sp3",atlimit,EntryPrice-PriceScale*익절틱수3); } SetStopLoss(PriceScale*손절틱수,PointStop); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간 ) Then{ if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if MarketPosition == 1 then { ExitLong("dbl",AtStop,EntryPrice-((당일누적손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsl",AtStop,EntryPrice+((당일누적손실+daypl)/CurrentContracts)); }