커뮤니티

수정 감사합니다. 한가지만 더 추가부탁 드립니다.

프로필 이미지
바나
2019-05-16 16:05:39
200
글번호 128725
답변완료
Input : 투자금액(1000000),Period(20), MultiD(2), N(1),시작일(20190515),시작시간(090000),청산시간(150000); Input : loss(5); var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0); var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false); var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false); Array : VV[5](0),XX[5](0); BBup = BollBandUp(Period,MultiD); BBdn = BollBandDown(Period,MultiD); vv[0] = floor((투자금액*0.2)/NextBarOpen); vv[1] = floor((투자금액*0.3)/NextBarOpen); vv[2] = floor((투자금액*0.5)/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 Tcond == true then { if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then { if MarketPosition == 0 and count >= 1 and count < N and CrossDown(c,bbdn) and C <= DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b1",atmarket,def,vv[MaxEntries]); } if MarketPosition == 0 and NextBarSdate != sdate and NextBarOpen <= C Then { buy("b11",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 C < DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b2",atmarket,def,vv[MaxEntries]); } #세번재매수 if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and C < DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b3",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.03 and HH < EntryPrice*1.05 Then ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1); if Bxcond2 == false and HH >= EntryPrice*1.06 and HH < EntryPrice*1.10 Then ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); if Bxcond3 == false and HH >= EntryPrice*1.12 Then ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1); if (stime >= 청산시간 and stime[1] < 청산시간) and C > AvgEntryPrice*1.02 then { ExitLong("bx"); } if C >= AvgEntryPrice*1.05 Then ExitLong("x"); }} ----------------- 두번째 세번째 매수조건에 최근 앞 5개이내 봉 평균보다 1.5배이상의 거래량일때와 Williams'R -95 이하일때의 조건을 추가 하고 싶습니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-05-17 10:57:32

안녕하세요 예스스탁입니다. Input : 투자금액(1000000),Period(20), MultiD(2), N(1),시작일(20190515),시작시간(090000),청산시간(150000); Input : loss(5),P(5),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[5](0),XX[5](0); BBup = BollBandUp(Period,MultiD); BBdn = BollBandDown(Period,MultiD); WR = WILLR(WRP); Vma = ma(V,P); vv[0] = floor((투자금액*0.2)/NextBarOpen); vv[1] = floor((투자금액*0.3)/NextBarOpen); vv[2] = floor((투자금액*0.5)/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 Tcond == true then { if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then { if MarketPosition == 0 and count >= 1 and count < N and CrossDown(c,bbdn) and C <= DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b1",atmarket,def,vv[MaxEntries]); } if MarketPosition == 0 and NextBarSdate != sdate and NextBarOpen <= C Then { buy("b11",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 C < DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate and V >= Vma[1]*1.5 and WR <= -95 Then { buy("b2",atmarket,def,vv[MaxEntries]); } #세번재매수 if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and C < DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate and V >= Vma[1]*1.5 and WR <= -95 Then { buy("b3",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.03 and HH < EntryPrice*1.05 Then ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1); if Bxcond2 == false and HH >= EntryPrice*1.06 and HH < EntryPrice*1.10 Then ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); if Bxcond3 == false and HH >= EntryPrice*1.12 Then ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1); if (stime >= 청산시간 and stime[1] < 청산시간) and C > AvgEntryPrice*1.02 then { ExitLong("bx"); } if C >= AvgEntryPrice*1.05 Then ExitLong("x"); }} 즐거운 하루되세요 > 바나 님이 쓴 글입니다. > 제목 : 수정 감사합니다. 한가지만 더 추가부탁 드립니다. > Input : 투자금액(1000000),Period(20), MultiD(2), N(1),시작일(20190515),시작시간(090000),청산시간(150000); Input : loss(5); var : e(0),x(0),count(0),Tcond(false),BBup(0),BBdn(0); var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false); var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false); Array : VV[5](0),XX[5](0); BBup = BollBandUp(Period,MultiD); BBdn = BollBandDown(Period,MultiD); vv[0] = floor((투자금액*0.2)/NextBarOpen); vv[1] = floor((투자금액*0.3)/NextBarOpen); vv[2] = floor((투자금액*0.5)/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 Tcond == true then { if (TotalTrades == 0 or MarketPosition == 0 and BarsSinceExit(1) > 2) then { if MarketPosition == 0 and count >= 1 and count < N and CrossDown(c,bbdn) and C <= DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b1",atmarket,def,vv[MaxEntries]); } if MarketPosition == 0 and NextBarSdate != sdate and NextBarOpen <= C Then { buy("b11",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 C < DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b2",atmarket,def,vv[MaxEntries]); } #세번재매수 if MarketPosition == 1 and e == 2 and CrossDown(c,bbdn) and C < DayClose(1) and dayopen <= DayClose(1) and NextBarSdate == sdate Then { buy("b3",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.03 and HH < EntryPrice*1.05 Then ExitLong("Bx1",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(1/5)),1); if Bxcond2 == false and HH >= EntryPrice*1.06 and HH < EntryPrice*1.10 Then ExitLong("Bx2",AtStop,HH-(HH-EntryPrice)*0.1,"",Floor(MaxContracts*(2/5)),1); if Bxcond3 == false and HH >= EntryPrice*1.12 Then ExitLong("Bx3",AtStop,HH-(HH-EntryPrice)*0.1); if (stime >= 청산시간 and stime[1] < 청산시간) and C > AvgEntryPrice*1.02 then { ExitLong("bx"); } if C >= AvgEntryPrice*1.05 Then ExitLong("x"); }} ----------------- 두번째 세번째 매수조건에 최근 앞 5개이내 봉 평균보다 1.5배이상의 거래량일때와 Williams'R -95 이하일때의 조건을 추가 하고 싶습니다.