커뮤니티

질문답글중에서 67257에 주신 수식을 실현하면 청산이 안되요..

프로필 이미지
이형지
2020-05-04 11:07:29
1012
글번호 138563
답변완료
국내 주식 kodex200 300분봉을 적용하였습니다. 분할매수 수식에서 일괄청산하는 식에 알려주신 4회 분할 청산 수식을 주어서 적용을 해보면 ... 매수만 되고 청산은 안되네요.. 나름대로 원인을 찾아보려고 했지만 잘 모르겠어서 이렇게 도움을 요청합니다. 한번 차트에서 구현해주셔서 문제점을 해결 해주시면 감사하겠습니다. 아래 알려주신 수식 입니다. input : n(200),하락퍼센트(0.95),하락퍼센트률(0.05); input : p(20),MFI값(70), MFI값하락률(5); input : 전일대비하락률(0.5); input : 매매수(300),금액1(10),금액2(20),금액3(30),금액4(100),금액5(200),금액6(200),금액7(300),금액8(300); var1 = highest(H,n); var2 = mfi(P); if stime < 143000 then { if MaxEntries < 매매수 and c < var1*하락퍼센트 and var2 < MFI값 and c < o and c <= c[1]*(100-전일대비하락률)/100 Then buy("b1",OnClose,def,Floor(금액1*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률) and var2 < (MFI값- MFI값하락률) and c < o and c <= c[1]*(99.4-전일대비하락률)/100 Then buy("b2",OnClose,def,Floor(금액2*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*2) and var2 < (MFI값- MFI값하락률*2) and c < o and c <= c[1]*(100-전일대비하락률*2)/100 Then buy("b3",OnClose,def,Floor(금액3*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*3) and var2 < (MFI값- MFI값하락률*3) and c < o and c <= c[1]*( 100-전일대비하락률*3)/100 Then buy("b4",OnClose,def,Floor(금액4*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*4) and var2 < (MFI값- MFI값하락률*4) and c < o and c <= c[1]*( 100-전일대비하락률*4)/100 Then buy("b5",OnClose,def,Floor(금액5*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*5) and var2 < (MFI값- MFI값하락률*5) and c < o and c <= c[1]*( 100-전일대비하락률*5)/100 Then buy("b6",OnClose,def,Floor(금액6*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*6) and var2 < (MFI값- MFI값하락률*6) and c < o and c <= c[1]*( 100-전일대비하락률*6)/100 Then buy("b7",OnClose,def,Floor(금액6*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*7) and var2 < (MFI값- MFI값하락률*7) and c < o and c <= c[1]*( 100-전일대비하락률*7)/100 Then buy("b8",OnClose,def,Floor(금액6*10000/c)); } if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { Condition1 = false; Condition2 = false; Condition3 = false; Condition4 = false; } if CurrentContracts > CurrentContracts[1] Then { if LatestExitName(0) == "bx1" Then Condition1 = true; if LatestExitName(0) == "bx2" Then Condition2 = true; if LatestExitName(0) == "bx3" Then Condition3 = true; if LatestExitName(0) == "bx4" Then Condition4 = true; } if Condition1 == true then ExitLong("bx1",Atlimit,AvgEntryPrice*1.05,"",Floor(CurrentContracts*0.25),1); if Condition2 == true then ExitLong("bx2",Atlimit,AvgEntryPrice*1.10,"",Floor(CurrentContracts*0.50),1); if Condition3 == true then ExitLong("bx3",Atlimit,AvgEntryPrice*1.15,"",Floor(CurrentContracts*0.75),1); if Condition4 == true then ExitLong("bx4",Atlimit,AvgEntryPrice*1.20); } Else { Condition1 = false; Condition2 = false; Condition3 = false; Condition4 = false; }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-05-06 17:21:05

안녕하세요 예스스탁입니다. 변수 지정에 문제가 있었습니다. 수정한 식입니다. input : n(200),하락퍼센트(0.95),하락퍼센트률(0.05); input : p(20),MFI값(70), MFI값하락률(5); input : 전일대비하락률(0.5); input : 매매수(300),금액1(10),금액2(20),금액3(30),금액4(100),금액5(200),금액6(200),금액7(300),금액8(300); var1 = highest(H,n); var2 = mfi(P); if stime < 143000 then { if MaxEntries < 매매수 and c < var1*하락퍼센트 and var2 < MFI값 and c < o and c <= c[1]*(100-전일대비하락률)/100 Then buy("b1",OnClose,def,Floor(금액1*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률) and var2 < (MFI값- MFI값하락률) and c < o and c <= c[1]*(99.4-전일대비하락률)/100 Then buy("b2",OnClose,def,Floor(금액2*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*2) and var2 < (MFI값- MFI값하락률*2) and c < o and c <= c[1]*(100-전일대비하락률*2)/100 Then buy("b3",OnClose,def,Floor(금액3*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*3) and var2 < (MFI값- MFI값하락률*3) and c < o and c <= c[1]*( 100-전일대비하락률*3)/100 Then buy("b4",OnClose,def,Floor(금액4*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*4) and var2 < (MFI값- MFI값하락률*4) and c < o and c <= c[1]*( 100-전일대비하락률*4)/100 Then buy("b5",OnClose,def,Floor(금액5*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*5) and var2 < (MFI값- MFI값하락률*5) and c < o and c <= c[1]*( 100-전일대비하락률*5)/100 Then buy("b6",OnClose,def,Floor(금액6*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*6) and var2 < (MFI값- MFI값하락률*6) and c < o and c <= c[1]*( 100-전일대비하락률*6)/100 Then buy("b7",OnClose,def,Floor(금액6*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*7) and var2 < (MFI값- MFI값하락률*7) and c < o and c <= c[1]*( 100-전일대비하락률*7)/100 Then buy("b8",OnClose,def,Floor(금액6*10000/c)); } if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { Condition1 = false; Condition2 = false; Condition3 = false; Condition4 = false; } if CurrentContracts > CurrentContracts[1] Then { if LatestExitName(0) == "bx1" Then Condition1 = true; if LatestExitName(0) == "bx2" Then Condition2 = true; if LatestExitName(0) == "bx3" Then Condition3 = true; if LatestExitName(0) == "bx4" Then Condition4 = true; } if Condition1 == False then ExitLong("bx1",Atlimit,AvgEntryPrice*1.05,"",Floor(CurrentContracts*0.25),1); if Condition2 == False then ExitLong("bx2",Atlimit,AvgEntryPrice*1.10,"",Floor(CurrentContracts*0.50),1); if Condition3 == False then ExitLong("bx3",Atlimit,AvgEntryPrice*1.15,"",Floor(CurrentContracts*0.75),1); if Condition4 == False then ExitLong("bx4",Atlimit,AvgEntryPrice*1.20); } Else { Condition1 = false; Condition2 = false; Condition3 = false; Condition4 = false; } 즐거운 하루되세요 > 이형지 님이 쓴 글입니다. > 제목 : 질문답글중에서 67257에 주신 수식을 실현하면 청산이 안되요.. > 국내 주식 kodex200 300분봉을 적용하였습니다. 분할매수 수식에서 일괄청산하는 식에 알려주신 4회 분할 청산 수식을 주어서 적용을 해보면 ... 매수만 되고 청산은 안되네요.. 나름대로 원인을 찾아보려고 했지만 잘 모르겠어서 이렇게 도움을 요청합니다. 한번 차트에서 구현해주셔서 문제점을 해결 해주시면 감사하겠습니다. 아래 알려주신 수식 입니다. input : n(200),하락퍼센트(0.95),하락퍼센트률(0.05); input : p(20),MFI값(70), MFI값하락률(5); input : 전일대비하락률(0.5); input : 매매수(300),금액1(10),금액2(20),금액3(30),금액4(100),금액5(200),금액6(200),금액7(300),금액8(300); var1 = highest(H,n); var2 = mfi(P); if stime < 143000 then { if MaxEntries < 매매수 and c < var1*하락퍼센트 and var2 < MFI값 and c < o and c <= c[1]*(100-전일대비하락률)/100 Then buy("b1",OnClose,def,Floor(금액1*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률) and var2 < (MFI값- MFI값하락률) and c < o and c <= c[1]*(99.4-전일대비하락률)/100 Then buy("b2",OnClose,def,Floor(금액2*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*2) and var2 < (MFI값- MFI값하락률*2) and c < o and c <= c[1]*(100-전일대비하락률*2)/100 Then buy("b3",OnClose,def,Floor(금액3*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*3) and var2 < (MFI값- MFI값하락률*3) and c < o and c <= c[1]*( 100-전일대비하락률*3)/100 Then buy("b4",OnClose,def,Floor(금액4*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*4) and var2 < (MFI값- MFI값하락률*4) and c < o and c <= c[1]*( 100-전일대비하락률*4)/100 Then buy("b5",OnClose,def,Floor(금액5*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*5) and var2 < (MFI값- MFI값하락률*5) and c < o and c <= c[1]*( 100-전일대비하락률*5)/100 Then buy("b6",OnClose,def,Floor(금액6*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*6) and var2 < (MFI값- MFI값하락률*6) and c < o and c <= c[1]*( 100-전일대비하락률*6)/100 Then buy("b7",OnClose,def,Floor(금액6*10000/c)); if MaxEntries < 매매수 and c < var1*(하락퍼센트- 하락퍼센트률*7) and var2 < (MFI값- MFI값하락률*7) and c < o and c <= c[1]*( 100-전일대비하락률*7)/100 Then buy("b8",OnClose,def,Floor(금액6*10000/c)); } if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { Condition1 = false; Condition2 = false; Condition3 = false; Condition4 = false; } if CurrentContracts > CurrentContracts[1] Then { if LatestExitName(0) == "bx1" Then Condition1 = true; if LatestExitName(0) == "bx2" Then Condition2 = true; if LatestExitName(0) == "bx3" Then Condition3 = true; if LatestExitName(0) == "bx4" Then Condition4 = true; } if Condition1 == true then ExitLong("bx1",Atlimit,AvgEntryPrice*1.05,"",Floor(CurrentContracts*0.25),1); if Condition2 == true then ExitLong("bx2",Atlimit,AvgEntryPrice*1.10,"",Floor(CurrentContracts*0.50),1); if Condition3 == true then ExitLong("bx3",Atlimit,AvgEntryPrice*1.15,"",Floor(CurrentContracts*0.75),1); if Condition4 == true then ExitLong("bx4",Atlimit,AvgEntryPrice*1.20); } Else { Condition1 = false; Condition2 = false; Condition3 = false; Condition4 = false; }