커뮤니티

같은 봉에서 매도 신호와 매수신호가 동시에 나갈때 매도우선으로 수정요망 합니다.

프로필 이미지
유경완
2022-03-31 08:20:43
464
글번호 157610
답변완료

첨부 이미지

제목 에서와 같이 아래의 수식을 사용하여 하락시 분할매수와 상승시 분할매수를 동시에 하여 수식 조건에 맞으면 상승시 매수분 따로 전량 매도하고, 하락시 매수분 전량매도 하도록 되어 있는데, 가끔씩 매도 분봉이나 일봉에서 매수와 매도 신호가 동시에 나가는 경우가 있어서 이것을 동시 신호일때 매도 우선으로 수정하고 싶습니다. 고견을 부탁 드립니다. input : 금액(10000000); var : Bcond(False),Scond(False); var1 = Highest(c,15); Var2 = Lowest(c,30); var3 = Highest(c,20); Var4 = Lowest(c,20); var5 = Highest(c,20); Var6 = Lowest(c,20); var7 = Highest(c,20); Var8 = Lowest(c,20); var9 = Highest(c,20); Var10 = Lowest(c,20); Bcond = False; if Bcond == False and CrossUp(c,var1[1]) and Condition1 == False Then { Bcond = true; Buy("a1",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var3[1]) and Condition3 == False Then { Bcond = true; Buy("a3",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var5[1]) and Condition5 == False Then { Bcond = true; Buy("a5",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var7[1]) and Condition7 == False Then { Bcond = true; Buy("a7",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var9[1]) and Condition9 == False Then { Bcond = true; Buy("a9",OnClose,DEf,((금액*(10/100))/C)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { if LatestEntryName(0) == "a1" Then Condition1 = true; if LatestEntryName(0) == "a3" Then Condition3 = true; if LatestEntryName(0) == "a5" Then Condition5 = true; if LatestEntryName(0) == "a7" Then Condition7 = true; if LatestEntryName(0) == "a9" Then Condition9 = true; } Scond = False; if Scond == False and CrossDown(c,var2[1]) and Condition1 == true Then { Condition1 = False; ExitLong("ax2",OnClose,DEf,"a1"); } if Scond == False and CrossDown(c,var2[1]) and Condition3 == true Then { Condition3 = False; ExitLong("ax4",OnClose,DEf,"a3"); } if Scond == False and CrossDown(c,var2[1]) and Condition5 == true Then { Condition5 = False; ExitLong("ax6",OnClose,DEf,"a5"); } if Scond == False and CrossDown(c,var2[1]) and Condition7 == true Then { Condition7 = False; ExitLong("ax8",OnClose,DEf,"a7"); } if Scond == False and CrossDown(c,var2[1]) and Condition9 == true Then { Condition9 = False; ExitLong("ax10",OnClose,DEf,"a9"); } } Else { Condition1 = False; Condition3 = False; Condition5 = False; Condition7 = False; Condition9 = False; } Var11 = Lowest(c,20); var12 = Highest(c,200); Var13 = Lowest(c,40); var14 = Highest(c,40); Var15 = Lowest(c,55); var16 = Highest(c,55); Var17 = Lowest(c,60); var18 = Highest(c,60); Var19 = Lowest(c,80); var20 = Highest(c,80); Bcond = False; if Bcond == False and CrossDown(c,var11[1]) and Condition11 == False Then { Bcond = true; Buy("b1",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var13[1]) and Condition13 == False Then { Bcond = true; Buy("b3",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var15[1]) and Condition15 == False Then { Bcond = true; Buy("b5",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var17[1]) and Condition17 == False Then { Bcond = true; Buy("b7",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var19[1]) and Condition19 == False Then { Bcond = true; Buy("b9",OnClose,DEf,((금액*(10/100))/C)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { if LatestEntryName(0) == "b1" Then Condition11 = true; if LatestEntryName(0) == "b3" Then Condition13 = true; if LatestEntryName(0) == "b5" Then Condition15 = true; if LatestEntryName(0) == "b7" Then Condition17 = true; if LatestEntryName(0) == "b9" Then Condition19 = true; } Scond = False; if Scond == False and CrossUp(c,var12[1]) and Condition11 == true Then { Condition11 = False; ExitLong("bx2",OnClose,DEf,"b1"); } if Scond == False and CrossUp(c,var12[1]) and Condition13 == true Then { Condition13 = False; ExitLong("bx4",OnClose,DEf,"b3"); } if Scond == False and CrossUp(c,var12[1]) and Condition15 == true Then { Condition15 = False; ExitLong("bx6",OnClose,DEf,"b5"); } if Scond == False and CrossUp(c,var12[1]) and Condition17 == true Then { Condition17 = False; ExitLong("bx8",OnClose,DEf,"b7"); } if Scond == False and CrossUp(c,var12[1]) and Condition19 == true Then { Condition19 = False; ExitLong("bx10",OnClose,DEf,"b9"); } } Else { Condition11 = False; Condition13 = False; Condition15 = False; Condition17 = False; Condition19 = False; }
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2022-03-31 16:15:13

안녕하세요 예스스탁입니다. 수식은 위에서 아래로 읽어 들어가게 됩니다. 매도조건이 만족한것을 파악하려면 매도식이 매수식보다 위에 있어야 합니다. 매도조건이 만족하면 x에 true가 저장되고 아니면 false가 저장딥니다. 매수조건에 x == false조건을 추가하시면 됩니다. 기존식에 scond는 항상 false값으로 별도의 기능이 없어없어 삭제 했습니다. 수정한 식입니다. input : 금액(10000000); var : Bcond(False),x(False); var1 = Highest(c,15); Var2 = Lowest(c,30); var3 = Highest(c,20); Var4 = Lowest(c,20); var5 = Highest(c,20); Var6 = Lowest(c,20); var7 = Highest(c,20); Var8 = Lowest(c,20); var9 = Highest(c,20); Var10 = Lowest(c,20); Var11 = Lowest(c,20); var12 = Highest(c,200); Var13 = Lowest(c,40); var14 = Highest(c,40); Var15 = Lowest(c,55); var16 = Highest(c,55); Var17 = Lowest(c,60); var18 = Highest(c,60); Var19 = Lowest(c,80); var20 = Highest(c,80); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { if LatestEntryName(0) == "a1" Then Condition1 = true; if LatestEntryName(0) == "a3" Then Condition3 = true; if LatestEntryName(0) == "a5" Then Condition5 = true; if LatestEntryName(0) == "a7" Then Condition7 = true; if LatestEntryName(0) == "a9" Then Condition9 = true; if LatestEntryName(0) == "b1" Then Condition11 = true; if LatestEntryName(0) == "b3" Then Condition13 = true; if LatestEntryName(0) == "b5" Then Condition15 = true; if LatestEntryName(0) == "b7" Then Condition17 = true; if LatestEntryName(0) == "b9" Then Condition19 = true; } x = False; if CrossDown(c,var2[1]) and Condition1 == true Then { x = true; Condition1 = False; ExitLong("ax2",OnClose,DEf,"a1"); } if CrossDown(c,var2[1]) and Condition3 == true Then { x = true; Condition3 = False; ExitLong("ax4",OnClose,DEf,"a3"); } if CrossDown(c,var2[1]) and Condition5 == true Then { x = true; Condition5 = False; ExitLong("ax6",OnClose,DEf,"a5"); } if CrossDown(c,var2[1]) and Condition7 == true Then { x = true; Condition7 = False; ExitLong("ax8",OnClose,DEf,"a7"); } if CrossDown(c,var2[1]) and Condition9 == true Then { x = true; Condition9 = False; ExitLong("ax10",OnClose,DEf,"a9"); } if CrossUp(c,var12[1]) and Condition11 == true Then { x = true; Condition11 = False; ExitLong("bx2",OnClose,DEf,"b1"); } if CrossUp(c,var12[1]) and Condition13 == true Then { x = true; Condition13 = False; ExitLong("bx4",OnClose,DEf,"b3"); } if CrossUp(c,var12[1]) and Condition15 == true Then { x = true; Condition15 = False; ExitLong("bx6",OnClose,DEf,"b5"); } if CrossUp(c,var12[1]) and Condition17 == true Then { x = true; Condition17 = False; ExitLong("bx8",OnClose,DEf,"b7"); } if CrossUp(c,var12[1]) and Condition19 == true Then { x = true; Condition19 = False; ExitLong("bx10",OnClose,DEf,"b9"); } } Else { x = False; Condition1 = False; Condition3 = False; Condition5 = False; Condition7 = False; Condition9 = False; Condition11 = False; Condition13 = False; Condition15 = False; Condition17 = False; Condition19 = False; } Bcond = False; if Bcond == False and x == False and CrossUp(c,var1[1]) and Condition1 == False Then { Bcond = true; Buy("a1",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossUp(c,var3[1]) and Condition3 == False Then { Bcond = true; Buy("a3",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossUp(c,var5[1]) and Condition5 == False Then { Bcond = true; Buy("a5",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossUp(c,var7[1]) and Condition7 == False Then { Bcond = true; Buy("a7",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossUp(c,var9[1]) and Condition9 == False Then { Bcond = true; Buy("a9",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossDown(c,var11[1]) and Condition11 == False Then { Bcond = true; Buy("b1",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossDown(c,var13[1]) and Condition13 == False Then { Bcond = true; Buy("b3",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossDown(c,var15[1]) and Condition15 == False Then { Bcond = true; Buy("b5",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossDown(c,var17[1]) and Condition17 == False Then { Bcond = true; Buy("b7",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and X == false and CrossDown(c,var19[1]) and Condition19 == False Then { Bcond = true; Buy("b9",OnClose,DEf,((금액*(10/100))/C)); } 즐거운 하루되세요 > 유경완 님이 쓴 글입니다. > 제목 : 같은 봉에서 매도 신호와 매수신호가 동시에 나갈때 매도우선으로 수정요망 합니다. > 제목 에서와 같이 아래의 수식을 사용하여 하락시 분할매수와 상승시 분할매수를 동시에 하여 수식 조건에 맞으면 상승시 매수분 따로 전량 매도하고, 하락시 매수분 전량매도 하도록 되어 있는데, 가끔씩 매도 분봉이나 일봉에서 매수와 매도 신호가 동시에 나가는 경우가 있어서 이것을 동시 신호일때 매도 우선으로 수정하고 싶습니다. 고견을 부탁 드립니다. input : 금액(10000000); var : Bcond(False),Scond(False); var1 = Highest(c,15); Var2 = Lowest(c,30); var3 = Highest(c,20); Var4 = Lowest(c,20); var5 = Highest(c,20); Var6 = Lowest(c,20); var7 = Highest(c,20); Var8 = Lowest(c,20); var9 = Highest(c,20); Var10 = Lowest(c,20); Bcond = False; if Bcond == False and CrossUp(c,var1[1]) and Condition1 == False Then { Bcond = true; Buy("a1",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var3[1]) and Condition3 == False Then { Bcond = true; Buy("a3",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var5[1]) and Condition5 == False Then { Bcond = true; Buy("a5",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var7[1]) and Condition7 == False Then { Bcond = true; Buy("a7",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossUp(c,var9[1]) and Condition9 == False Then { Bcond = true; Buy("a9",OnClose,DEf,((금액*(10/100))/C)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { if LatestEntryName(0) == "a1" Then Condition1 = true; if LatestEntryName(0) == "a3" Then Condition3 = true; if LatestEntryName(0) == "a5" Then Condition5 = true; if LatestEntryName(0) == "a7" Then Condition7 = true; if LatestEntryName(0) == "a9" Then Condition9 = true; } Scond = False; if Scond == False and CrossDown(c,var2[1]) and Condition1 == true Then { Condition1 = False; ExitLong("ax2",OnClose,DEf,"a1"); } if Scond == False and CrossDown(c,var2[1]) and Condition3 == true Then { Condition3 = False; ExitLong("ax4",OnClose,DEf,"a3"); } if Scond == False and CrossDown(c,var2[1]) and Condition5 == true Then { Condition5 = False; ExitLong("ax6",OnClose,DEf,"a5"); } if Scond == False and CrossDown(c,var2[1]) and Condition7 == true Then { Condition7 = False; ExitLong("ax8",OnClose,DEf,"a7"); } if Scond == False and CrossDown(c,var2[1]) and Condition9 == true Then { Condition9 = False; ExitLong("ax10",OnClose,DEf,"a9"); } } Else { Condition1 = False; Condition3 = False; Condition5 = False; Condition7 = False; Condition9 = False; } Var11 = Lowest(c,20); var12 = Highest(c,200); Var13 = Lowest(c,40); var14 = Highest(c,40); Var15 = Lowest(c,55); var16 = Highest(c,55); Var17 = Lowest(c,60); var18 = Highest(c,60); Var19 = Lowest(c,80); var20 = Highest(c,80); Bcond = False; if Bcond == False and CrossDown(c,var11[1]) and Condition11 == False Then { Bcond = true; Buy("b1",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var13[1]) and Condition13 == False Then { Bcond = true; Buy("b3",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var15[1]) and Condition15 == False Then { Bcond = true; Buy("b5",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var17[1]) and Condition17 == False Then { Bcond = true; Buy("b7",OnClose,DEf,((금액*(10/100))/C)); } if Bcond == False and CrossDown(c,var19[1]) and Condition19 == False Then { Bcond = true; Buy("b9",OnClose,DEf,((금액*(10/100))/C)); } if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts[1] Then { if LatestEntryName(0) == "b1" Then Condition11 = true; if LatestEntryName(0) == "b3" Then Condition13 = true; if LatestEntryName(0) == "b5" Then Condition15 = true; if LatestEntryName(0) == "b7" Then Condition17 = true; if LatestEntryName(0) == "b9" Then Condition19 = true; } Scond = False; if Scond == False and CrossUp(c,var12[1]) and Condition11 == true Then { Condition11 = False; ExitLong("bx2",OnClose,DEf,"b1"); } if Scond == False and CrossUp(c,var12[1]) and Condition13 == true Then { Condition13 = False; ExitLong("bx4",OnClose,DEf,"b3"); } if Scond == False and CrossUp(c,var12[1]) and Condition15 == true Then { Condition15 = False; ExitLong("bx6",OnClose,DEf,"b5"); } if Scond == False and CrossUp(c,var12[1]) and Condition17 == true Then { Condition17 = False; ExitLong("bx8",OnClose,DEf,"b7"); } if Scond == False and CrossUp(c,var12[1]) and Condition19 == true Then { Condition19 = False; ExitLong("bx10",OnClose,DEf,"b9"); } } Else { Condition11 = False; Condition13 = False; Condition15 = False; Condition17 = False; Condition19 = False; }
프로필 이미지

유경완

2022-03-31 23:04:16

항상 감사합니다. 앞으로 잘 사용 하겠습니다.