커뮤니티

문의드립니다.

프로필 이미지
종호
2023-02-09 15:35:29
826
글번호 166135
답변완료
아래수식을 보아도 코딩 지식이 없어서 어떻게 매수 매도 되는 원리인지 해석을 할 수가 없네요. 식들이 어떤 의미로 매수가 되고 청산되며 다시 매도되고 청산되는 지를 알고 싶습니다. 그리고 제가 원하는 수식은 특정 날자와 시간과 특정 가격을 input 으로 하고요. 어떤 특정 가격 A 를 input 으로 임의로 정해주고 특정 날자와 시간 이후에 기다리고 있다가 아래나 위에 있던 현재가 상승 또는 하락하여 A 가격에 도달하면 비로서 매수 매도가 활성화 되어서 그 가격 A + PriceScale*5 을 현재가가 한번 위로 터치하면 매수하고 계속 위로 올라가면 놓아두고 다시 아래로 떨어져서 A - PriceScale*5 를 터치하면 매수청산과 더불어서 히방으로 1계약 매도합니다. 이런 식으로 계속 반복합니다. 현재가가 A + PriceScale*5 위로 도달시 매수 1게약 현재가가 A - PriceScale*5 아래로 도달시 매도 1게약 을 반복하는 것입니다. 아래 수식처럼 비슷하게 하면 ATSTOP 함수를 써서 가능할 것 같은데요. 아래 수식에서 ExitLong("bx",AtMarket); 이 왜 수식으로 게속 와야 하는 지 등를 모르겠어요. 제가 원하는 수식도 마저 부탁드립니다. 늘 수고하심에 감사드립니다. if NextBarSdate != sDate Then { if NextBarOpen != C Then { Buy("b",AtStop,NextBarOpen+PriceScale*5); } } ExitLong("bx",AtMarket); if NextBarOpen != C Then { Buy("b1",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx1",AtMarket); if NextBarOpen != C Then { Buy("b2",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx2",AtMarket); if NextBarOpen != C Then { Buy("b3",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx3",AtMarket); if NextBarOpen != C Then { Buy("b4",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx4",AtMarket); if NextBarOpen != C Then { Buy("b5",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx5",AtMarket); if NextBarOpen == C Then { Buy("b6",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx6",AtMarket); if NextBarOpen == C Then { Buy("b7",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx7",AtMarket); if NextBarOpen == C Then { Buy("b8",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx8",AtMarket); if NextBarOpen == C Then { Buy("b9",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx9",AtMarket); if NextBarOpen == C Then { Buy("b10",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx10",AtMarket); if NextBarOpen == C Then { Buy("b11",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx11",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Sell("s",AtStop,NextBarOpen-PriceScale*5); } } ExitShort("sx",AtMarket); if NextBarOpen != C Then { Sell("s1",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx1",AtMarket); if NextBarOpen != C Then { Sell("s2",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx2",AtMarket); if NextBarOpen != C Then { Sell("s3",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx3",AtMarket); if NextBarOpen != C Then { Sell("s4",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx4",AtMarket); if NextBarOpen != C Then { Sell("s5",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx5",AtMarket); if NextBarOpen == C Then { Sell("s6",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx6",AtMarket); if NextBarOpen == C Then { Sell("s7",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx7",AtMarket); if NextBarOpen == C Then { Sell("s8",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx8",AtMarket); if NextBarOpen == C Then { Sell("s9",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx9",AtMarket); if NextBarOpen == C Then { Sell("s10",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx10",AtMarket); if NextBarOpen == C Then { Sell("s11",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx11",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Buy("b12",AtStop,NextBarOpen+PriceScale*5); } } ExitLong("bx12",AtMarket); if NextBarOpen != C Then { Buy("b13",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx13",AtMarket); if NextBarOpen != C Then { Buy("b14",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx14",AtMarket); if NextBarOpen != C Then { Buy("b15",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx15",AtMarket); if NextBarOpen != C Then { Buy("b16",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx16",AtMarket); if NextBarOpen != C Then { Buy("b17",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx17",AtMarket); if NextBarOpen == C Then { Buy("b18",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx18",AtMarket); if NextBarOpen == C Then { Buy("b19",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx19",AtMarket); if NextBarOpen == C Then { Buy("b20",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx20",AtMarket); if NextBarOpen == C Then { Buy("b21",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx21",AtMarket); if NextBarOpen == C Then { Buy("b22",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx22",AtMarket); if NextBarOpen == C Then { Buy("b23",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx23",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Sell("s12",AtStop,NextBarOpen-PriceScale*5); } } ExitShort("sx12",AtMarket); if NextBarOpen != C Then { Sell("s13",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx13",AtMarket); if NextBarOpen != C Then { Sell("s14",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx14",AtMarket); if NextBarOpen != C Then { Sell("s15",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx15",AtMarket); if NextBarOpen != C Then { Sell("s16",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx16",AtMarket); if NextBarOpen != C Then { Sell("s17",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx17",AtMarket); if NextBarOpen == C Then { Sell("s18",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx18",AtMarket); if NextBarOpen == C Then { Sell("s19",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx19",AtMarket); if NextBarOpen == C Then { Sell("s20",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx20",AtMarket); if NextBarOpen == C Then { Sell("s21",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx21",AtMarket); if NextBarOpen == C Then { Sell("s22",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx22",AtMarket); if NextBarOpen == C Then { Sell("s23",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx23",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Buy("b24",AtStop,NextBarOpen+PriceScale*5); } } ExitLong("bx24",AtMarket); if NextBarOpen != C Then { Buy("b25",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx25",AtMarket); if NextBarOpen != C Then { Buy("b26",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx26",AtMarket); if NextBarOpen != C Then { Buy("b27",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx27",AtMarket); if NextBarOpen != C Then { Buy("b28",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx28",AtMarket); if NextBarOpen != C Then { Buy("b29",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx29",AtMarket); if NextBarOpen == C Then { Buy("b30",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx30",AtMarket); if NextBarOpen == C Then { Buy("b31",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx31",AtMarket); if NextBarOpen == C Then { Buy("b32",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx32",AtMarket); if NextBarOpen == C Then { Buy("b33",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx33",AtMarket); if NextBarOpen == C Then { Buy("b34",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx34",AtMarket); if NextBarOpen == C Then { Buy("b35",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx35",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Sell("s24",AtStop,NextBarOpen-PriceScale*5); } } ExitShort("sx24",AtMarket); if NextBarOpen != C Then { Sell("s25",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx25",AtMarket); if NextBarOpen != C Then { Sell("s26",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx26",AtMarket); if NextBarOpen != C Then { Sell("s27",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx27",AtMarket); if NextBarOpen != C Then { Sell("s28",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx28",AtMarket); if NextBarOpen != C Then { Sell("s29",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx29",AtMarket); if NextBarOpen == C Then { Sell("s30",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx30",AtMarket); if NextBarOpen == C Then { Sell("s31",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx31",AtMarket); if NextBarOpen == C Then { Sell("s32",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx32",AtMarket); if NextBarOpen == C Then { Sell("s33",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx33",AtMarket); if NextBarOpen == C Then { Sell("s34",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx34",AtMarket); if NextBarOpen == C Then { Sell("s35",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx35",AtMarket);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-02-09 16:47:17

안녕하세요 예스스탁입니다. 1 올리신 식은 시가에서 5틱 상승하면 매수 시가에서 5틱 하락하면 매도 봉완성시 다음봉 시가 청산입니다. 동일 내용이 반복해서 쓰여진 이유는 수식에서 하나의 Buy나 sell은 한봉에 한번만 동작합니다. 한봉에서 여러번 시가+5틱과 시가-5틱을 왔다 갓다 반복할때 여러번 진입하기 위해 동일내용을 여러번 작성해 나열한 것입니다. 2 input : ndate(20220209),ntime(90000); input : Price(324.00),ntick(5);; var1 = Price + PriceScale*ntick; var2 = Price - PriceScale*ntick; if sDate >= ndate and sTime > ntime Then Condition1 = true; if Condition1 == true Then { if H < var1 Then Buy("b",AtStop,var1); if L > var2 Then Sell("s",AtStop,var2); } 즐거운 하루되세요 > 종호 님이 쓴 글입니다. > 제목 : 문의드립니다. > 아래수식을 보아도 코딩 지식이 없어서 어떻게 매수 매도 되는 원리인지 해석을 할 수가 없네요. 식들이 어떤 의미로 매수가 되고 청산되며 다시 매도되고 청산되는 지를 알고 싶습니다. 그리고 제가 원하는 수식은 특정 날자와 시간과 특정 가격을 input 으로 하고요. 어떤 특정 가격 A 를 input 으로 임의로 정해주고 특정 날자와 시간 이후에 기다리고 있다가 아래나 위에 있던 현재가 상승 또는 하락하여 A 가격에 도달하면 비로서 매수 매도가 활성화 되어서 그 가격 A + PriceScale*5 을 현재가가 한번 위로 터치하면 매수하고 계속 위로 올라가면 놓아두고 다시 아래로 떨어져서 A - PriceScale*5 를 터치하면 매수청산과 더불어서 히방으로 1계약 매도합니다. 이런 식으로 계속 반복합니다. 현재가가 A + PriceScale*5 위로 도달시 매수 1게약 현재가가 A - PriceScale*5 아래로 도달시 매도 1게약 을 반복하는 것입니다. 아래 수식처럼 비슷하게 하면 ATSTOP 함수를 써서 가능할 것 같은데요. 아래 수식에서 ExitLong("bx",AtMarket); 이 왜 수식으로 게속 와야 하는 지 등를 모르겠어요. 제가 원하는 수식도 마저 부탁드립니다. 늘 수고하심에 감사드립니다. if NextBarSdate != sDate Then { if NextBarOpen != C Then { Buy("b",AtStop,NextBarOpen+PriceScale*5); } } ExitLong("bx",AtMarket); if NextBarOpen != C Then { Buy("b1",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx1",AtMarket); if NextBarOpen != C Then { Buy("b2",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx2",AtMarket); if NextBarOpen != C Then { Buy("b3",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx3",AtMarket); if NextBarOpen != C Then { Buy("b4",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx4",AtMarket); if NextBarOpen != C Then { Buy("b5",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx5",AtMarket); if NextBarOpen == C Then { Buy("b6",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx6",AtMarket); if NextBarOpen == C Then { Buy("b7",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx7",AtMarket); if NextBarOpen == C Then { Buy("b8",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx8",AtMarket); if NextBarOpen == C Then { Buy("b9",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx9",AtMarket); if NextBarOpen == C Then { Buy("b10",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx10",AtMarket); if NextBarOpen == C Then { Buy("b11",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx11",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Sell("s",AtStop,NextBarOpen-PriceScale*5); } } ExitShort("sx",AtMarket); if NextBarOpen != C Then { Sell("s1",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx1",AtMarket); if NextBarOpen != C Then { Sell("s2",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx2",AtMarket); if NextBarOpen != C Then { Sell("s3",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx3",AtMarket); if NextBarOpen != C Then { Sell("s4",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx4",AtMarket); if NextBarOpen != C Then { Sell("s5",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx5",AtMarket); if NextBarOpen == C Then { Sell("s6",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx6",AtMarket); if NextBarOpen == C Then { Sell("s7",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx7",AtMarket); if NextBarOpen == C Then { Sell("s8",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx8",AtMarket); if NextBarOpen == C Then { Sell("s9",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx9",AtMarket); if NextBarOpen == C Then { Sell("s10",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx10",AtMarket); if NextBarOpen == C Then { Sell("s11",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx11",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Buy("b12",AtStop,NextBarOpen+PriceScale*5); } } ExitLong("bx12",AtMarket); if NextBarOpen != C Then { Buy("b13",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx13",AtMarket); if NextBarOpen != C Then { Buy("b14",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx14",AtMarket); if NextBarOpen != C Then { Buy("b15",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx15",AtMarket); if NextBarOpen != C Then { Buy("b16",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx16",AtMarket); if NextBarOpen != C Then { Buy("b17",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx17",AtMarket); if NextBarOpen == C Then { Buy("b18",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx18",AtMarket); if NextBarOpen == C Then { Buy("b19",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx19",AtMarket); if NextBarOpen == C Then { Buy("b20",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx20",AtMarket); if NextBarOpen == C Then { Buy("b21",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx21",AtMarket); if NextBarOpen == C Then { Buy("b22",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx22",AtMarket); if NextBarOpen == C Then { Buy("b23",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx23",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Sell("s12",AtStop,NextBarOpen-PriceScale*5); } } ExitShort("sx12",AtMarket); if NextBarOpen != C Then { Sell("s13",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx13",AtMarket); if NextBarOpen != C Then { Sell("s14",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx14",AtMarket); if NextBarOpen != C Then { Sell("s15",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx15",AtMarket); if NextBarOpen != C Then { Sell("s16",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx16",AtMarket); if NextBarOpen != C Then { Sell("s17",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx17",AtMarket); if NextBarOpen == C Then { Sell("s18",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx18",AtMarket); if NextBarOpen == C Then { Sell("s19",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx19",AtMarket); if NextBarOpen == C Then { Sell("s20",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx20",AtMarket); if NextBarOpen == C Then { Sell("s21",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx21",AtMarket); if NextBarOpen == C Then { Sell("s22",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx22",AtMarket); if NextBarOpen == C Then { Sell("s23",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx23",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Buy("b24",AtStop,NextBarOpen+PriceScale*5); } } ExitLong("bx24",AtMarket); if NextBarOpen != C Then { Buy("b25",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx25",AtMarket); if NextBarOpen != C Then { Buy("b26",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx26",AtMarket); if NextBarOpen != C Then { Buy("b27",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx27",AtMarket); if NextBarOpen != C Then { Buy("b28",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx28",AtMarket); if NextBarOpen != C Then { Buy("b29",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx29",AtMarket); if NextBarOpen == C Then { Buy("b30",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx30",AtMarket); if NextBarOpen == C Then { Buy("b31",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx31",AtMarket); if NextBarOpen == C Then { Buy("b32",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx32",AtMarket); if NextBarOpen == C Then { Buy("b33",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx33",AtMarket); if NextBarOpen == C Then { Buy("b34",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx34",AtMarket); if NextBarOpen == C Then { Buy("b35",AtStop,NextBarOpen+PriceScale*5); } ExitLong("bx35",AtMarket); if NextBarSdate != sDate Then { if NextBarOpen != C Then { Sell("s24",AtStop,NextBarOpen-PriceScale*5); } } ExitShort("sx24",AtMarket); if NextBarOpen != C Then { Sell("s25",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx25",AtMarket); if NextBarOpen != C Then { Sell("s26",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx26",AtMarket); if NextBarOpen != C Then { Sell("s27",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx27",AtMarket); if NextBarOpen != C Then { Sell("s28",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx28",AtMarket); if NextBarOpen != C Then { Sell("s29",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx29",AtMarket); if NextBarOpen == C Then { Sell("s30",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx30",AtMarket); if NextBarOpen == C Then { Sell("s31",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx31",AtMarket); if NextBarOpen == C Then { Sell("s32",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx32",AtMarket); if NextBarOpen == C Then { Sell("s33",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx33",AtMarket); if NextBarOpen == C Then { Sell("s34",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx34",AtMarket); if NextBarOpen == C Then { Sell("s35",AtStop,NextBarOpen-PriceScale*5); } ExitShort("sx35",AtMarket);