커뮤니티

문의

프로필 이미지
육각수
2020-02-22 18:37:43
385
글번호 136238
답변완료
안녕하세요. 늘 수고가 많으세요. 아래 수식은 특정가격 돌파 붕괴신호인데요 여기서 각 가격에 n틱의 오차범위내에서 n회 이상 돌파 붕괴일때만 신호가 발생되게 하고 싶습니다. 감사합니다. input:Price1(2.06),Price2(2.60),Price3(2.60),Price4(2.60),Price5(2.60),Price6(2.60); if CrossDown(c,Price1) or CrossDown(c,Price2) or CrossDown(c,Price3) or CrossDown(c,Price4) or CrossDown(c,Price5) or CrossDown(c,Price6) Then sell(); if CrossUp(c,Price1) or CrossUp(c,Price2) or CrossUp(c,Price3) or CrossUp(c,Price4) or CrossUp(c,Price5) or CrossUp(c,Price6) Then buy();
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-02-24 11:36:41

안녕하세요 예스스탁입니다. 지정한 폭 안에서 n회이상 돌파나 이탈발생이후에만 신호가 발생합니다. 지정한 폭을 벗어나면 횟수는 초기화됩니다. input : Price1(2.06),Price2(2.60),Price3(2.60),Price4(2.60),Price5(2.60),Price6(2.60); input : ntick(5),n(3); var : up1(0),dn1(0); var : up2(0),dn2(0); var : up3(0),dn3(0); var : up4(0),dn4(0); var : up5(0),dn5(0); var : up6(0),dn6(0); Condition1 = abs(C-Price1) <= PriceScale*ntick; Condition2 = abs(C-Price2) <= PriceScale*ntick; Condition3 = abs(C-Price3) <= PriceScale*ntick; Condition4 = abs(C-Price4) <= PriceScale*ntick; Condition5 = abs(C-Price5) <= PriceScale*ntick; Condition6 = abs(C-Price6) <= PriceScale*ntick; if Condition1 == true and Condition1 == false Then { up1 = 0; dn1 = 0; } if Condition1 == true then { if crossup(c,Price1) then { up1 = up1+1; if up1 >= n Then buy("b1"); } if CrossDown(c,Price1) then { dn1 = dn1+1; if dn1 >= n Then sell("s1"); } } if Condition2 == true and Condition2 == false Then { up2 = 0; dn2 = 0; } if Condition2 == true then { if crossup(c,Price2) then { up2 = up2+1; if up2 >= n Then buy("b2"); } if CrossDown(c,Price2) then { dn2 = dn2+1; if dn2 >= n Then sell("s2"); } } if Condition3 == true and Condition3 == false Then { up3 = 0; dn3 = 0; } if Condition3 == true then { if crossup(c,Price3) then { up3 = up3+1; if up3 >= n Then buy("b3"); } if CrossDown(c,Price3) then { dn3 = dn3+1; if dn3 >= n Then sell("s3"); } } if Condition4 == true and Condition4 == false Then { up4 = 0; dn4 = 0; } if Condition4 == true then { if crossup(c,Price4) then { up4 = up4+1; if up4 >= n Then buy("b4"); } if CrossDown(c,Price4) then { dn4 = dn4+1; if dn4 >= n Then sell("s4"); } } if Condition5 == true and Condition5 == false Then { up5 = 0; dn5 = 0; } if Condition5 == true then { if crossup(c,Price5) then { up5 = up5+1; if up5 >= n Then buy("b5"); } if CrossDown(c,Price5) then { dn5 = dn5+1; if dn5 >= n Then sell("s5"); } } if Condition6 == true and Condition6 == false Then { up6 = 0; dn6 = 0; } if Condition6 == true then { if crossup(c,Price6) then { up6 = up6+1; if up6 >= n Then buy("b6"); } if CrossDown(c,Price6) then { dn6 = dn6+1; if dn6 >= n Then sell("s6"); } } 즐거운 하루되세요 > 육각수 님이 쓴 글입니다. > 제목 : 문의 > 안녕하세요. 늘 수고가 많으세요. 아래 수식은 특정가격 돌파 붕괴신호인데요 여기서 각 가격에 n틱의 오차범위내에서 n회 이상 돌파 붕괴일때만 신호가 발생되게 하고 싶습니다. 감사합니다. input:Price1(2.06),Price2(2.60),Price3(2.60),Price4(2.60),Price5(2.60),Price6(2.60); if CrossDown(c,Price1) or CrossDown(c,Price2) or CrossDown(c,Price3) or CrossDown(c,Price4) or CrossDown(c,Price5) or CrossDown(c,Price6) Then sell(); if CrossUp(c,Price1) or CrossUp(c,Price2) or CrossUp(c,Price3) or CrossUp(c,Price4) or CrossUp(c,Price5) or CrossUp(c,Price6) Then buy();