커뮤니티

부탁 드립니다.

프로필 이미지
고운무지개
2013-11-11 12:26:25
133
글번호 69374
답변완료
안녕하세요? 추운데 감기 조심하세요. 수식 좀 부탁 드릴께요. Atlimit나 AtStop에는 CurrentContracts-1 수식이 작동 안하나요? 숫자를 변경해도 한개씩만 청산되네요. MaxContracts-1 이런 수식도 가능한가요? 진입된 계약이 1~10개 일 때 원하는 가격(현재 진입가격에서 일부청산값+5틱 값 이하로 내려갈 때)에 도달하는 즉시 전체 계약수에서 2계약을 남기고 일부청산 남아있는 두계약 중 한계약은 일부청산값+10틱 값 이하로 내려갈 때 청산하고 마지막 한계약은 잔량청산조건에 청산하고 싶습니다. #매도 포지션일 때 If MarketPosition == -1 then { if CurrentContracts == MaxContracts Then { if CurrentContracts >= 3 then ExitShort("매도일부청산1",Atlimit,EntryPrice-PriceScale*(일부청산+5),"",CurrentContracts-2,1); } if CurrentContracts >= 2 and CurrentContracts < CurrentContracts[1] then { ExitShort("매도일부청산2",Atlimit,EntryPrice-PriceScale*(일부청산+10),"",CurrentContracts-1,1); } if CurrentContracts == 2 then ExitShort("매도청산a",Atlimit,EntryPrice-PriceScale*(일부청산+5),"",CurrentContracts-1,1); if CurrentContracts == 1 Then #매도수량이 1계약 남았을 때 ExitShort("매도잔량익절",Atlimit,잔량청산조건); //나머지 전량청산 현재 보유중인 총 계약에서 세번으로 나눠서 청산하는 수식 작성 좀 부탁드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-11-12 10:31:51

안녕하세요 예스스탁입니다. 모든 청산함수의 수량은 주문타입과는 관계없이 설정할수 있습니다. Atlimit나 AtStop은 가격과 관련된 타입니다. 매도청산a는 2계약 일때는 무조건 발생하므로 중복될수 있으므로 아래와 같이 조건을 추가해 주셔야 ㅎ바니다. #매도 포지션일 때 If MarketPosition == -1 then { #포지견 최대계약수가 3이상일때 첫번째 청산 if (CurrentContracts == MaxContracts and MaxContracts >= 3) Then ExitShort("매도일부청산1",Atlimit,EntryPrice-PriceScale*(일부청산+5),"",MaxContracts-2,1); #포지션 최대계약수가 3이상일때 두번째 청산 if CurrentContracts < MaxContracts and MaxContracts >= 3 and CurrentContracts == 2 then ExitShort("매도일부청산2",Atlimit,EntryPrice-PriceScale*(일부청산+10),"",1,1); #포지견 최대계약수가 2일때 첫번째 청산 if (CurrentContracts == MaxContracts and MaxContracts == 2) Then ExitShort("매도청산a",Atlimit,EntryPrice-PriceScale*(일부청산+5),"",1,1); #마지막 청산 if CurrentContracts == 1 Then ExitShort("매도잔량익절",Atlimit,잔량청산조건); //나머지 전량청산 } 즐거운 하루되세요 > 고운무지개 님이 쓴 글입니다. > 제목 : 부탁 드립니다. > 안녕하세요? 추운데 감기 조심하세요. 수식 좀 부탁 드릴께요. Atlimit나 AtStop에는 CurrentContracts-1 수식이 작동 안하나요? 숫자를 변경해도 한개씩만 청산되네요. MaxContracts-1 이런 수식도 가능한가요? 진입된 계약이 1~10개 일 때 원하는 가격(현재 진입가격에서 일부청산값+5틱 값 이하로 내려갈 때)에 도달하는 즉시 전체 계약수에서 2계약을 남기고 일부청산 남아있는 두계약 중 한계약은 일부청산값+10틱 값 이하로 내려갈 때 청산하고 마지막 한계약은 잔량청산조건에 청산하고 싶습니다. #매도 포지션일 때 If MarketPosition == -1 then { if CurrentContracts == MaxContracts Then { if CurrentContracts >= 3 then ExitShort("매도일부청산1",Atlimit,EntryPrice-PriceScale*(일부청산+5),"",CurrentContracts-2,1); } if CurrentContracts >= 2 and CurrentContracts < CurrentContracts[1] then { ExitShort("매도일부청산2",Atlimit,EntryPrice-PriceScale*(일부청산+10),"",CurrentContracts-1,1); } if CurrentContracts == 2 then ExitShort("매도청산a",Atlimit,EntryPrice-PriceScale*(일부청산+5),"",CurrentContracts-1,1); if CurrentContracts == 1 Then #매도수량이 1계약 남았을 때 ExitShort("매도잔량익절",Atlimit,잔량청산조건); //나머지 전량청산 현재 보유중인 총 계약에서 세번으로 나눠서 청산하는 수식 작성 좀 부탁드립니다.