커뮤니티

연속손실 진입횟수

프로필 이미지
쿠리
2014-11-20 23:02:42
169
글번호 80606
답변완료
input : N(3); var : vol(0),cnt(0),count(0); count = 0; if MarketPosition != 0 Then{ for cnt = 0 to N-1{ if PositionProfit(cnt) < 0 Then count = count+1; } } Else{ for cnt = 1 to N{ if PositionProfit(cnt) < 0 Then count = count+1; } } if count == N Then Vol = 4; Else Vol = 1; if 매수진입조건 Then buy("b",OnClose,def,vol); if 매도진입조건 Then sell("s",OnClose,def,vol); 현재의 수식은 N번째 조건에서 손실이 나면 수익이 날때까지 4개의 수량으로 주문이 나가는데 N번째에만 4개의 수량으로 주문을 내고 N번째에서 손실이 발생햇더라도 5번째에서는 원래의 1개 수량으로 복귀하는 수식을 부탁합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-11-24 11:28:16

안녕하세요 예스스탁입니다. input : N(3); var : vol(0),cnt(0),count(0),cond(false); count = 0; cond = false; if MarketPosition != 0 Then{ for cnt = 0 to N-1{ if PositionProfit(cnt) < 0 Then count = count+1; } if PositionProfit(N) >= 0 Then cond = true; } Else{ for cnt = 1 to N{ if PositionProfit(cnt) < 0 Then count = count+1; } if PositionProfit(N+1) >= 0 Then cond = true; } if count == N and cond == true Then Vol = 4; Else Vol = 1; if 매수진입조건 Then buy("b",OnClose,def,vol); if 매도진입조건 Then sell("s",OnClose,def,vol); 즐거운 하루되세요 > 쿠리 님이 쓴 글입니다. > 제목 : 연속손실 진입횟수 > input : N(3); var : vol(0),cnt(0),count(0); count = 0; if MarketPosition != 0 Then{ for cnt = 0 to N-1{ if PositionProfit(cnt) < 0 Then count = count+1; } } Else{ for cnt = 1 to N{ if PositionProfit(cnt) < 0 Then count = count+1; } } if count == N Then Vol = 4; Else Vol = 1; if 매수진입조건 Then buy("b",OnClose,def,vol); if 매도진입조건 Then sell("s",OnClose,def,vol); 현재의 수식은 N번째 조건에서 손실이 나면 수익이 날때까지 4개의 수량으로 주문이 나가는데 N번째에만 4개의 수량으로 주문을 내고 N번째에서 손실이 발생햇더라도 5번째에서는 원래의 1개 수량으로 복귀하는 수식을 부탁합니다.