커뮤니티

수식수정요청2

프로필 이미지
바나
2021-04-10 11:45:02
921
글번호 147874
답변완료
RSI매수매도 식입니다. 매수는 그대로 하되, 매도식을 RSI 55이상이고, 이평선이 정배열일때 (5일>25일>100일), 매도 파라볼릭sar이 생기자 마자 전체 매도 하는식으로 바꾸고 싶습니다. 매도후 다시 처음부터 매수 시작하구요. Input : 투자금액(10000000),Period(14), N(1), LPercent(30), S7Percent(70), S8Percent(80), S9Percent(90),시작일(20210410),시작시간(073000); var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false); 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); value = RSI(Period); vv[0] = floor((투자금액*0.12)/NextBarOpen); vv[1] = floor((투자금액*0.15)/NextBarOpen); vv[2] = floor((투자금액*0.20)/NextBarOpen); vv[3] = floor((투자금액*0.23)/NextBarOpen); vv[4] = floor((투자금액*0.30)/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]); } #세번재매수 If MarketPosition == 1 and e == 2 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b3",atlimit,LatestEntryPrice(0)*0.98,vv[MaxEntries]); } #네번재매수 If MarketPosition == 1 and e == 3 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b4",atlimit,LatestEntryPrice(0)*0.99,vv[MaxEntries]); } #다섯번재매수 If MarketPosition == 1 and e == 4 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b5",atlimit,LatestEntryPrice(0)*0.99,vv[MaxEntries]); } if condition1 == false and crossup(value,S7Percent) then { condition1 = true; exitlong("bx1",onclose,def,"",floor(maxcontracts*0.7),1); } if condition2 == true and crossup(value,S8Percent) then { condition2 = true; exitlong("bx2",onclose,def,"",floor(maxcontracts*0.2),1); } if condition3 == true and crossup(value,S9Percent) then { condition3 = true; exitlong("bx3"); } if crossdown(value,S7Percent) then exitlong("bx"); } else { e = 0; condition1 = false; condition2 = false; condition3 = false; condition4 = false; } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-04-12 10:52:41

안녕하세요 예스스탁입니다. Input : 투자금액(10000000),Period(14), N(1), LPercent(30), S7Percent(70), S8Percent(80), S9Percent(90),시작일(20210410),시작시간(073000); input : p1(5),P2(25),P3(100),af(0.02),maxaf(0.2); var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false); var : HH(0),Bxcond1(false),Bxcond2(false),Bxcond3(false); var : LL(0),Sxcond1(false),Sxcond2(false),Sxcond3(false); var : mav1(0),mav2(0),mav3(0),Sarv(0); Array : VV[5](0),XX[5](0); value = RSI(Period); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); Sarv = Sar(af,maxaf); vv[0] = floor((투자금액*0.12)/NextBarOpen); vv[1] = floor((투자금액*0.15)/NextBarOpen); vv[2] = floor((투자금액*0.20)/NextBarOpen); vv[3] = floor((투자금액*0.23)/NextBarOpen); vv[4] = floor((투자금액*0.30)/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]); } #세번재매수 If MarketPosition == 1 and e == 2 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b3",atlimit,LatestEntryPrice(0)*0.98,vv[MaxEntries]); } #네번재매수 If MarketPosition == 1 and e == 3 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b4",atlimit,LatestEntryPrice(0)*0.99,vv[MaxEntries]); } #다섯번재매수 If MarketPosition == 1 and e == 4 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b5",atlimit,LatestEntryPrice(0)*0.99,vv[MaxEntries]); } if value >= 55 and mav1 > mav2 and mav2 > mav3 and CrossDown(c,Sarv) Then { ExitLong(); } } else { e = 0; condition1 = false; condition2 = false; condition3 = false; condition4 = false; } } 즐거운 하루되세요 > 바나 님이 쓴 글입니다. > 제목 : 수식수정요청2 > RSI매수매도 식입니다. 매수는 그대로 하되, 매도식을 RSI 55이상이고, 이평선이 정배열일때 (5일>25일>100일), 매도 파라볼릭sar이 생기자 마자 전체 매도 하는식으로 바꾸고 싶습니다. 매도후 다시 처음부터 매수 시작하구요. Input : 투자금액(10000000),Period(14), N(1), LPercent(30), S7Percent(70), S8Percent(80), S9Percent(90),시작일(20210410),시작시간(073000); var : value(0), e(0),x(0),count(0),Vma(0), Tcond(false); 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); value = RSI(Period); vv[0] = floor((투자금액*0.12)/NextBarOpen); vv[1] = floor((투자금액*0.15)/NextBarOpen); vv[2] = floor((투자금액*0.20)/NextBarOpen); vv[3] = floor((투자금액*0.23)/NextBarOpen); vv[4] = floor((투자금액*0.30)/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]); } #세번재매수 If MarketPosition == 1 and e == 2 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b3",atlimit,LatestEntryPrice(0)*0.98,vv[MaxEntries]); } #네번재매수 If MarketPosition == 1 and e == 3 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b4",atlimit,LatestEntryPrice(0)*0.99,vv[MaxEntries]); } #다섯번재매수 If MarketPosition == 1 and e == 4 and CrossDown(value, LPercent) and NextBarSdate == sdate Then { buy("b5",atlimit,LatestEntryPrice(0)*0.99,vv[MaxEntries]); } if condition1 == false and crossup(value,S7Percent) then { condition1 = true; exitlong("bx1",onclose,def,"",floor(maxcontracts*0.7),1); } if condition2 == true and crossup(value,S8Percent) then { condition2 = true; exitlong("bx2",onclose,def,"",floor(maxcontracts*0.2),1); } if condition3 == true and crossup(value,S9Percent) then { condition3 = true; exitlong("bx3"); } if crossdown(value,S7Percent) then exitlong("bx"); } else { e = 0; condition1 = false; condition2 = false; condition3 = false; condition4 = false; } }