커뮤니티

재질문입니다.ㅍ.ㅍ

프로필 이미지
말라
2020-08-20 15:15:18
908
글번호 141564
답변완료

첨부 이미지

여러번 질문드려서 이제죄송하기까지한데여 자꾸 값이 이상하게 나와서요 68799번글에 대한 답변을 받고 대입시켜봤습니다. 오류?같은데 아무튼 사진과 설명 다시 드려보겠습니다 3번에 대한 답변을 듣고 똑같이 복사하여 대입해봤습니다 var : A1Price(0),A1high(0); var : A2Price(0),A2high(0); if MarketPosition == 1 Then { #A1진입 발생 #보유수량이 증가하고 최근 발생한 진입명이 A1이면 if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A1" Then { #진입가 저장 A1Price = LatestEntryPrice(0); #진입이후 최고가의 초기값으로 현재봉 고가저장 A1high = H; } #새로운 고가가 발생하면 변수의 값을 새로운 고가를 변경 if A1high > 0 and H > A1high Then A1high = H; #12% 수익이면 청산 ExitLong("C1",AtLimit,A1Price*1.12,"A1"); #2% 이상 수익이후에 7% 하락하면 청산 if A1high >= A1Price*1.02 Then ExitLong("C2",AtStop,A1high*0.93,"A1"); #7% 손실시 청산 ExitLong("C3",AtStop,A1Price*0.93,"A1"); #A2진입 if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A2" Then { A2Price = LatestEntryPrice(0); A2high = H; } if A2high > 0 and H > A2high Then A2high = H; ExitLong("D1",AtLimit,A2Price*1.12,"A2"); if A2high >= A2Price*1.02 Then ExitLong("D2",AtStop,A2high*0.93,"A2"); ExitLong("D3",AtStop,A2Price*0.93,"A2"); } Else { A1Price = 0; A1high = 0; A2Price = 0; A2high = 0; } 이 식을 대입해 봤는데요 파일과 같이 매도 신호가 잡힙니다. 왜이러죠 진입신호 A2대비 청산 될만한게 아무것도 없는데요 참고로 "D1"표시된 봉은 저가고가폭이 7프로가 채 안됩니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-08-20 16:07:25

안녕하세요 예스스탁입니다. 죄송합니다.if문이 빠진 부분이 있었습니다. 각 진입의 진입가에 값이 저장된 이후에 동작하게 if문으로 지정해 주시면 됩니다. 신호는 발생했는데 값이 모두 봉완성시에 적혀지게 되어 있어 시차로 인해 var : A1Price(0),A1high(0); var : A2Price(0),A2high(0); if MarketPosition == 1 Then { #A1진입 발생 #보유수량이 증가하고 최근 발생한 진입명이 A1이면 if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A1" Then { #진입가 저장 A1Price = LatestEntryPrice(0); #진입이후 최고가의 초기값으로 현재봉 고가저장 A1high = H; } #새로운 고가가 발생하면 변수의 값을 새로운 고가를 변경 if A1high > 0 and H > A1high Then A1high = H; if A1Price > 0 Then #추가된 if문 { #12% 수익이면 청산 ExitLong("C1",AtLimit,A1Price*1.12,"A1"); #2% 이상 수익이후에 7% 하락하면 청산 if A1high >= A1Price*1.02 Then ExitLong("C2",AtStop,A1high*0.93,"A1"); #7% 손실시 청산 ExitLong("C3",AtStop,A1Price*0.93,"A1"); } #A2진입 if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A2" Then { A2Price = LatestEntryPrice(0); A2high = H; } if A2high > 0 and H > A2high Then A2high = H; if A2Price > 0 Then #추가된 if문 { ExitLong("D1",AtLimit,A2Price*1.12,"A2"); if A2high >= A2Price*1.02 Then ExitLong("D2",AtStop,A2high*0.93,"A2"); ExitLong("D3",AtStop,A2Price*0.93,"A2"); } } Else { A1Price = 0; A1high = 0; A2Price = 0; A2high = 0; } 즐거운 하루되세요 > 말라 님이 쓴 글입니다. > 제목 : 재질문입니다.ㅍ.ㅍ > 여러번 질문드려서 이제죄송하기까지한데여 자꾸 값이 이상하게 나와서요 68799번글에 대한 답변을 받고 대입시켜봤습니다. 오류?같은데 아무튼 사진과 설명 다시 드려보겠습니다 3번에 대한 답변을 듣고 똑같이 복사하여 대입해봤습니다 var : A1Price(0),A1high(0); var : A2Price(0),A2high(0); if MarketPosition == 1 Then { #A1진입 발생 #보유수량이 증가하고 최근 발생한 진입명이 A1이면 if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A1" Then { #진입가 저장 A1Price = LatestEntryPrice(0); #진입이후 최고가의 초기값으로 현재봉 고가저장 A1high = H; } #새로운 고가가 발생하면 변수의 값을 새로운 고가를 변경 if A1high > 0 and H > A1high Then A1high = H; #12% 수익이면 청산 ExitLong("C1",AtLimit,A1Price*1.12,"A1"); #2% 이상 수익이후에 7% 하락하면 청산 if A1high >= A1Price*1.02 Then ExitLong("C2",AtStop,A1high*0.93,"A1"); #7% 손실시 청산 ExitLong("C3",AtStop,A1Price*0.93,"A1"); #A2진입 if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "A2" Then { A2Price = LatestEntryPrice(0); A2high = H; } if A2high > 0 and H > A2high Then A2high = H; ExitLong("D1",AtLimit,A2Price*1.12,"A2"); if A2high >= A2Price*1.02 Then ExitLong("D2",AtStop,A2high*0.93,"A2"); ExitLong("D3",AtStop,A2Price*0.93,"A2"); } Else { A1Price = 0; A1high = 0; A2Price = 0; A2high = 0; } 이 식을 대입해 봤는데요 파일과 같이 매도 신호가 잡힙니다. 왜이러죠 진입신호 A2대비 청산 될만한게 아무것도 없는데요 참고로 "D1"표시된 봉은 저가고가폭이 7프로가 채 안됩니다