커뮤니티

수식질문 드립니다.

프로필 이미지
바나
2021-03-28 18:27:17
773
글번호 147453
답변완료
현재 매수 수식부분은 아래와 같습니다. 기본세팅은 RSI매수이고, 두번째 매수부터 LatestEntryPrice(0)*0.98 와 같이 2프로 이상 하락일시 추가매수 하게 되어있는데, OR 수식을 써서 2프로 이상 하락일시 추가매수 하되 일정시간(예.60분) 이 지나면 2프로이상 하락이 아니라도 추가매수를 진행 하도록 설정해보고 싶은데 어떻게 하면 되는지 알고싶습니다. Input : 투자금액(1000000),Period(14), N(1), LPercent(30),시작일(20210325),시작시간(160000); var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false); Array : VV[5](0),XX[5](0); value = RSI(Period); 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 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) then { if MarketPosition <= 0 and CrossDown(value, LPercent) Then { buy("b1",onclose,def,vv[MaxEntries]); } } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { e = e +1; if e == 0 then XX[e] = CurrentContracts; Else XX[e] = CurrentContracts-CurrentContracts[1]; } #두번째 매수 If MarketPosition == 1 and e == 1 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b2",atlimit,LatestEntryPrice(0)*0.98,vv[MaxEntries]); }}}
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-03-29 15:26:26

안녕하세요 예스스탁입니다. Input : 투자금액(1000000),Period(14), N(1), LPercent(30),시작일(20210325),시작시간(160000); var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false),S1(0),D1(0),TM(0),ET(0); Array : VV[5](0),XX[5](0); value = RSI(Period); 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 MarketPosition != 0 and MarketPosition != MarketPosition[1] Then count = count+1; if sdate >= 시작일 and stime >= 시작시간 Then Tcond = true; if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; } if Tcond == true then { #첫번째 매수 if (TotalTrades == 0 or MarketPosition == 0) then { if MarketPosition <= 0 and CrossDown(value, LPercent) Then { buy("b1",onclose,def,vv[MaxEntries]); } } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { ET = TM; e = e +1; if e == 0 then XX[e] = CurrentContracts; Else XX[e] = CurrentContracts-CurrentContracts[1]; } #두번째 매수 1 If MarketPosition == 1 and e == 1 and CrossDown(value, LPercent) and NextBarSdate == sdate and TM < ET+60 Then { buy("b21",atlimit,LatestEntryPrice(0)*0.98,vv[MaxEntries]); } #두번째 매수 2 If MarketPosition == 1 and e == 1 and CrossDown(value, LPercent) and NextBarSdate == sdate and TM >= ET+60 Then { buy("b22"); } } } 즐거운 하루되세요 > 바나 님이 쓴 글입니다. > 제목 : 수식질문 드립니다. > 현재 매수 수식부분은 아래와 같습니다. 기본세팅은 RSI매수이고, 두번째 매수부터 LatestEntryPrice(0)*0.98 와 같이 2프로 이상 하락일시 추가매수 하게 되어있는데, OR 수식을 써서 2프로 이상 하락일시 추가매수 하되 일정시간(예.60분) 이 지나면 2프로이상 하락이 아니라도 추가매수를 진행 하도록 설정해보고 싶은데 어떻게 하면 되는지 알고싶습니다. Input : 투자금액(1000000),Period(14), N(1), LPercent(30),시작일(20210325),시작시간(160000); var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false); Array : VV[5](0),XX[5](0); value = RSI(Period); 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 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) then { if MarketPosition <= 0 and CrossDown(value, LPercent) Then { buy("b1",onclose,def,vv[MaxEntries]); } } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { e = e +1; if e == 0 then XX[e] = CurrentContracts; Else XX[e] = CurrentContracts-CurrentContracts[1]; } #두번째 매수 If MarketPosition == 1 and e == 1 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b2",atlimit,LatestEntryPrice(0)*0.98,vv[MaxEntries]); }}}