커뮤니티

수식 수정 부탁드립니다.

프로필 이미지
부자청년28
2018-06-26 19:20:10
169
글번호 120062
답변완료
1차든 2차든 3차든 매수후에 매도가 진행되어 모든 물량이 0 이되면 그날 다시 1차 또는 2차 또는 3차 매수가 아무것도 일어나지 않게 하고 싶습니다. 1차매수후 5% 까지 올랐다가 다시 2%까지 수익이 떨어지면 전량 매도 2차매수 가격에서 5%까지 올랐다가 다시 2%까지 수익이 떨어지면 전량 매도 3차매수 가격에서 5%까지 올랐다가 다시 2%까지 수익이 떨어지면 전량 매도 추가 하고 싶습니다. input : 투자금액(10000000),투자비율1(40),투자비율2(30),투자비율3(30); input : P1(10),P2(14); var : count(0),sumV1(0),sumV2(0); var : mav1(0),mav2(0); var : m1(0),m2(0),m3(0),dd(0); sumV1 = 0; sumV2 = 0; for count = 0 to P2{ if count < P1 Then sumV1 = sumV1+DayClose(count); if count < P2 Then sumV2 = sumV2+DayClose(count); } maV1 = sumV1 / P1; maV2 = sumV2 / P2; m1 = 투자금액*(투자비율1/100); m2 = 투자금액*(투자비율2/100); m3 = 투자금액*(투자비율3/100); if bdate != bdate[1] Then { dd = dd+1; } if MarketPosition == 0 and Condition1 == false and L < mav1 Then { buy("b1",AtLimit,mav1,Floor(m1/mav1)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { Condition1 = false; Condition2 = false; if MaxEntries == 1 Then var1 = dd; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bl1" Then Condition3 = true; if MaxEntries == 1 and L > mav2 Then buy("b2",AtLimit,mav2,Floor(m2/mav2)); if MaxEntries == 2 Then { buy("b3",AtLimit,LatestEntryPrice(0)*0.95,Floor(m3/LatestEntryPrice(0)*0.95)); } if MaxEntries == 3 then { if Condition3 == false then ExitLong("bl1",AtStop,LatestEntryPrice(0)*0.95,"",Floor(MaxContracts*0.5),1); ExitLong("bl2",AtStop,LatestEntryPrice(0)*0.90); } if Condition1 == false then { ExitLong("bp1",atlimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.5),1); } if Condition2 == false then { ExitLong("bp2",atlimit,AvgEntryPrice*1.10,"",Floor(MaxContracts*0.5),1); } ExitLong("bp3",atlimit,AvgEntryPrice*1.15); if NextBarSdate > sdate and dd >= var1+4 Then exitlong("bx",AtMarket); } Else { Condition3 = false; }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-06-26 20:27:08

안녕하세요 예스스탁입니다. input : 투자금액(10000000),투자비율1(40),투자비율2(30),투자비율3(30); input : P1(10),P2(14); var : count(0),sumV1(0),sumV2(0); var : mav1(0),mav2(0); var : m1(0),m2(0),m3(0),dd(0),entry(false); sumV1 = 0; sumV2 = 0; for count = 0 to P2{ if count < P1 Then sumV1 = sumV1+DayClose(count); if count < P2 Then sumV2 = sumV2+DayClose(count); } maV1 = sumV1 / P1; maV2 = sumV2 / P2; m1 = 투자금액*(투자비율1/100); m2 = 투자금액*(투자비율2/100); m3 = 투자금액*(투자비율3/100); if bdate != bdate[1] Then { dd = dd+1; entry = true; } if TotalTrades > TotalTrades[1] and MarketPosition == 0 Then entry = false; if MarketPosition == 0 and Condition1 == false and L < mav1 and entry == true Then { buy("b1",AtLimit,mav1,Floor(m1/mav1)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { Condition1 = false; Condition2 = false; Condition4 = false; if MaxEntries == 1 Then var1 = dd; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bl1" Then Condition3 = true; if MaxEntries == 1 and L > mav2 Then buy("b2",AtLimit,mav2,Floor(m2/mav2)); if MaxEntries == 2 Then { buy("b3",AtLimit,LatestEntryPrice(0)*0.95,Floor(m3/LatestEntryPrice(0)*0.95)); } if MaxEntries == 3 then { if Condition3 == false then ExitLong("bl1",AtStop,LatestEntryPrice(0)*0.95,"",Floor(MaxContracts*0.5),1); ExitLong("bl2",AtStop,LatestEntryPrice(0)*0.90); } if Condition1 == false then { ExitLong("bp1",atlimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.5),1); } if Condition2 == false then { ExitLong("bp2",atlimit,AvgEntryPrice*1.10,"",Floor(MaxContracts*0.5),1); } ExitLong("bp3",atlimit,AvgEntryPrice*1.15); if NextBarSdate > sdate and dd >= var1+4 Then exitlong("bx1",AtMarket); if H >= LatestEntryPrice(0)*1.05 Then Condition4 = true; if Condition4 == true Then ExitLong("bx2",AtStop,LatestEntryPrice(0)*1.02); } Else { Condition3 = false; } 즐거운 하루되세요 > 부자청년28 님이 쓴 글입니다. > 제목 : 수식 수정 부탁드립니다. > 1차든 2차든 3차든 매수후에 매도가 진행되어 모든 물량이 0 이되면 그날 다시 1차 또는 2차 또는 3차 매수가 아무것도 일어나지 않게 하고 싶습니다. 1차매수후 5% 까지 올랐다가 다시 2%까지 수익이 떨어지면 전량 매도 2차매수 가격에서 5%까지 올랐다가 다시 2%까지 수익이 떨어지면 전량 매도 3차매수 가격에서 5%까지 올랐다가 다시 2%까지 수익이 떨어지면 전량 매도 추가 하고 싶습니다. input : 투자금액(10000000),투자비율1(40),투자비율2(30),투자비율3(30); input : P1(10),P2(14); var : count(0),sumV1(0),sumV2(0); var : mav1(0),mav2(0); var : m1(0),m2(0),m3(0),dd(0); sumV1 = 0; sumV2 = 0; for count = 0 to P2{ if count < P1 Then sumV1 = sumV1+DayClose(count); if count < P2 Then sumV2 = sumV2+DayClose(count); } maV1 = sumV1 / P1; maV2 = sumV2 / P2; m1 = 투자금액*(투자비율1/100); m2 = 투자금액*(투자비율2/100); m3 = 투자금액*(투자비율3/100); if bdate != bdate[1] Then { dd = dd+1; } if MarketPosition == 0 and Condition1 == false and L < mav1 Then { buy("b1",AtLimit,mav1,Floor(m1/mav1)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { Condition1 = false; Condition2 = false; if MaxEntries == 1 Then var1 = dd; } if CurrentContracts < CurrentContracts[1] and LatestExitName(0) == "bl1" Then Condition3 = true; if MaxEntries == 1 and L > mav2 Then buy("b2",AtLimit,mav2,Floor(m2/mav2)); if MaxEntries == 2 Then { buy("b3",AtLimit,LatestEntryPrice(0)*0.95,Floor(m3/LatestEntryPrice(0)*0.95)); } if MaxEntries == 3 then { if Condition3 == false then ExitLong("bl1",AtStop,LatestEntryPrice(0)*0.95,"",Floor(MaxContracts*0.5),1); ExitLong("bl2",AtStop,LatestEntryPrice(0)*0.90); } if Condition1 == false then { ExitLong("bp1",atlimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.5),1); } if Condition2 == false then { ExitLong("bp2",atlimit,AvgEntryPrice*1.10,"",Floor(MaxContracts*0.5),1); } ExitLong("bp3",atlimit,AvgEntryPrice*1.15); if NextBarSdate > sdate and dd >= var1+4 Then exitlong("bx",AtMarket); } Else { Condition3 = false; }