커뮤니티

장종료 직전 매수실패

프로필 이미지
바나
2020-09-21 13:04:51
592
글번호 142547
답변완료

첨부 이미지

5분봉으로 매수진행하는데 3시30분 장막판에 매수신호가 오고 실제 매수는 이루어지지 않는 문제가 발생합니다. 이 문제좀 해결해 주세요..ㅠ 매수신호가 뜨지 않게 3시20분까지만 매수하는걸로 해주시거나, 매수가 이루어질수있게 부탁드릴께요. 물론 다음날은 이어서 정상작동 되도록이요. Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000); Input : loss(5),P(3),WRP(10); var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0); var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false); var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false); Array : VV[6](0),XX[5](0); BBup = BollBandUp(Period,MultiD); BBdn = BollBandDown(Period,MultiD); WR = WILLR(WRP); Vma = ma(V,P); vv[0] = floor((투자금액*0.1)/NextBarOpen); vv[1] = floor((투자금액*0.1)/NextBarOpen); vv[2] = floor((투자금액*0.1)/NextBarOpen); vv[3] = floor((투자금액*0.2)/NextBarOpen); vv[4] = floor((투자금액*0.2)/NextBarOpen); vv[5] = floor((투자금액*0.3)/NextBarOpen); if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then Tcond = true; if bdate != bdate[1] Then count = 0; if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then count = count+1; if sdate >= 시작일 and stime >= 시작시간 Then Tcond = true; if Tcond == true then{ if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{ if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and V >= Vma[1]*2.0 Then { buy("b1",atmarket,def,vv[MaxEntries]); } if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] Then{ e = e +1; if e == 1 then XX[e] = CurrentContracts; Else XX[e] = CurrentContracts-CurrentContracts[1]; } #두번째 매수 if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b2",atmarket,def,vv[MaxEntries]); } #세번재매수 if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b3",atmarket,def,vv[MaxEntries]); } #네번재매수 if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b4",atmarket,def,vv[MaxEntries]); } #다섯번재매수 if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b5",atmarket,def,vv[MaxEntries]); } #여섯번재매수 if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*3.0 Then { buy("b6",atmarket,def,vv[MaxEntries]); } HH = highest(H,BarsSinceEntry); if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then Bxcond1 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then Bxcond2 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then Bxcond3 = true; if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1); if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); }}}
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-09-23 18:47:50

안녕하세요 예스스탁입니다. 시스템은 정규장안에서 신호가 집행되도록 하셔야 합니다. 정규장 마지막봉에는 신호가 발생해서 주문이 집행되어야 하므로 if문은 그전봉까지는 만족해야 합니다. 사용하시는 주기가 5분봉이면 정규장 마지막봉의 stime은 151500이므로 if조건은 151000까지만 만족되어야 합니다. Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000); Input : loss(5),P(3),WRP(10); var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0); var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false); var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false); Array : VV[6](0),XX[5](0); BBup = BollBandUp(Period,MultiD); BBdn = BollBandDown(Period,MultiD); WR = WILLR(WRP); Vma = ma(V,P); vv[0] = floor((투자금액*0.1)/NextBarOpen); vv[1] = floor((투자금액*0.1)/NextBarOpen); vv[2] = floor((투자금액*0.1)/NextBarOpen); vv[3] = floor((투자금액*0.2)/NextBarOpen); vv[4] = floor((투자금액*0.2)/NextBarOpen); vv[5] = floor((투자금액*0.3)/NextBarOpen); if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then Tcond = true; if bdate != bdate[1] Then count = 0; if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then count = count+1; if sdate >= 시작일 and stime >= 시작시간 Then Tcond = true; if Tcond == true and NextBarStime <= 151000 then{ if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{ if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and V >= Vma[1]*2.0 Then { buy("b1",atmarket,def,vv[MaxEntries]); } if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] Then{ e = e +1; if e == 1 then XX[e] = CurrentContracts; Else XX[e] = CurrentContracts-CurrentContracts[1]; } #두번째 매수 if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b2",atmarket,def,vv[MaxEntries]); } #세번재매수 if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b3",atmarket,def,vv[MaxEntries]); } #네번재매수 if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b4",atmarket,def,vv[MaxEntries]); } #다섯번재매수 if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b5",atmarket,def,vv[MaxEntries]); } #여섯번재매수 if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*3.0 Then { buy("b6",atmarket,def,vv[MaxEntries]); } HH = highest(H,BarsSinceEntry); if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then Bxcond1 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then Bxcond2 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then Bxcond3 = true; if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1); if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); }}} 즐거운 하루되세요 > 바나 님이 쓴 글입니다. > 제목 : 장종료 직전 매수실패 > 5분봉으로 매수진행하는데 3시30분 장막판에 매수신호가 오고 실제 매수는 이루어지지 않는 문제가 발생합니다. 이 문제좀 해결해 주세요..ㅠ 매수신호가 뜨지 않게 3시20분까지만 매수하는걸로 해주시거나, 매수가 이루어질수있게 부탁드릴께요. 물론 다음날은 이어서 정상작동 되도록이요. Input : 투자금액(10000000),Period(20), MultiD(2), N(1),시작일(20200921),시작시간(090000),청산시간(153000); Input : loss(5),P(3),WRP(10); var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0),WR(0),Vma(0); var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false); var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false); Array : VV[6](0),XX[5](0); BBup = BollBandUp(Period,MultiD); BBdn = BollBandDown(Period,MultiD); WR = WILLR(WRP); Vma = ma(V,P); vv[0] = floor((투자금액*0.1)/NextBarOpen); vv[1] = floor((투자금액*0.1)/NextBarOpen); vv[2] = floor((투자금액*0.1)/NextBarOpen); vv[3] = floor((투자금액*0.2)/NextBarOpen); vv[4] = floor((투자금액*0.2)/NextBarOpen); vv[5] = floor((투자금액*0.3)/NextBarOpen); if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then Tcond = true; if bdate != bdate[1] Then count = 0; if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then count = count+1; if sdate >= 시작일 and stime >= 시작시간 Then Tcond = true; if Tcond == true then{ if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then{ if MarketPosition == 0 and count < N and CrossDown(c,bbdn) and V >= Vma[1]*2.0 Then { buy("b1",atmarket,def,vv[MaxEntries]); } if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] Then{ e = e +1; if e == 1 then XX[e] = CurrentContracts; Else XX[e] = CurrentContracts-CurrentContracts[1]; } #두번째 매수 if MarketPosition == 1 and e == 1 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b2",atmarket,def,vv[MaxEntries]); } #세번재매수 if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b3",atmarket,def,vv[MaxEntries]); } #네번재매수 if MarketPosition == 1 and e == 3 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b4",atmarket,def,vv[MaxEntries]); } #다섯번재매수 if MarketPosition == 1 and e == 4 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*2.0 Then { buy("b5",atmarket,def,vv[MaxEntries]); } #여섯번재매수 if MarketPosition == 1 and e == 5 and CrossDown(c,bbdn) and NextBarSdate == sdate and V >= Vma[1]*3.0 Then { buy("b6",atmarket,def,vv[MaxEntries]); } HH = highest(H,BarsSinceEntry); if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx1" Then Bxcond1 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx2" Then Bxcond2 = true; if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "Bx3" Then Bxcond3 = true; if Bxcond1 == false and HH >= EntryPrice*1.10 and HH < EntryPrice*1.15 Then ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1); if Bxcond2 == false and HH >= EntryPrice*1.15 and HH < EntryPrice*1.20 Then ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); if Bxcond3 == false and HH >= EntryPrice*1.20 and HH < EntryPrice*1.30 Then ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); }}}