커뮤니티
문의 드립니다.
2014-01-12 19:55:43
142
글번호 71311
If crossup(var1,var2) then buy("B1");
If crossup(var3,var4) then buy("B2");
If crossup(var5,var6) then buy("B3");
If crossdown(var1,var2) then sell("S1");
If crossdown(var3,var4) then sell("S2");
If crossdown(var5,var6) then sell("S3");
안녕하세요?
저는 위와 같이 세종류의 진입및 청산식이 있는데요,
시스템식으로 돌리면 첨부파일과 같은 신호가 나옵니다.
그런데 저는 신호대로 중복진입을 하되 청산과 반대진입은 같은 신호만 할 수 있도록
제어하고 싶습니다.
예를들어 첨부파일을 보면,
아침에 S1, S2 ,S3가 차례로 나온 이후 B1 신호에서 세개가 모두 청산되고 매수 한개가
되었는데요, 이 곳에서는 S1만 청산되고 나머지 수량은 청산되지 않아서 결국 미청산수량은 매도 한개가 될 수 있도록 만들고 싶습니다.
미청산 세개중에 S1은 B1으로 반대 진입되어 매도 두개와 매수한개이므로 최종 미청산수량은 매도 한개로 표시되게 말입니다.
가능하시다면 수식 부탁 드립니다.
감사합니다.
- 1. 71765_Untitled.png (0.02 MB)
답변 1
예스스탁 예스스탁 답변
2014-01-13 15:27:56
안녕하세요
예스스탁입니다.
문의하신 내용으로는 진입중에 B1이나 S1나오면 전체계약수중 2계약
청산을 하는것과 같습니다.
진입중에 반대진입이 발생하지 않게 하셔야 하며
청산함수에 수량을 지정해 청산하셔야 합니다.
if MarketPosition >= 0 Then{
If crossup(var1,var2) then buy("B1");
If crossup(var3,var4) then buy("B2");
If crossup(var5,var6) then buy("B3");
}
if MarketPosition <= 0 Then{
If crossdown(var1,var2) then sell("S1");
If crossdown(var3,var4) then sell("S2");
If crossdown(var5,var6) then sell("S3");
}
if MarketPosition == 1 Then{
If crossdown(var1,var2) and CurrentContracts == 3 then ExitLong("bx1",OnClose,def,"",2,1);
}
if MarketPosition == -1 then{
If crossup(var1,var2) and CurrentContracts == 3 then ExitShort("Sx1",OnClose,def,"",2,1);
}
아래식은 진입과 반대신호로 한계약씩 청산하는 식입니다.
참고하시기 바랍니다.
if MarketPosition >= 0 Then{
If crossup(var1,var2) then buy("B1");
If crossup(var3,var4) then buy("B2");
If crossup(var5,var6) then buy("B3");
}
if MarketPosition <= 0 Then{
If crossdown(var1,var2) then sell("S1");
If crossdown(var3,var4) then sell("S2");
If crossdown(var5,var6) then sell("S3");
}
if MarketPosition == 1 Then{
If crossdown(var1,var2) then ExitLong("bx1",OnClose,def,"B1");
If crossdown(var3,var4) then ExitLong("bx2",OnClose,def,"B2");
If crossdown(var5,var6) then ExitLong("bx3",OnClose,def,"B3");
}
if MarketPosition == -1 then{
If crossup(var1,var2) then ExitShort("Sx1",OnClose,def,"S1");
If crossup(var3,var4) then ExitShort("Sx2",OnClose,def,"S2");
If crossup(var5,var6) then ExitShort("Sx3",OnClose,def,"S3");
}
즐거운 하루되세요
> HI_kw****** 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> If crossup(var1,var2) then buy("B1");
If crossup(var3,var4) then buy("B2");
If crossup(var5,var6) then buy("B3");
If crossdown(var1,var2) then sell("S1");
If crossdown(var3,var4) then sell("S2");
If crossdown(var5,var6) then sell("S3");
안녕하세요?
저는 위와 같이 세종류의 진입및 청산식이 있는데요,
시스템식으로 돌리면 첨부파일과 같은 신호가 나옵니다.
그런데 저는 신호대로 중복진입을 하되 청산과 반대진입은 같은 신호만 할 수 있도록
제어하고 싶습니다.
예를들어 첨부파일을 보면,
아침에 S1, S2 ,S3가 차례로 나온 이후 B1 신호에서 세개가 모두 청산되고 매수 한개가
되었는데요, 이 곳에서는 S1만 청산되고 나머지 수량은 청산되지 않아서 결국 미청산수량은 매도 한개가 될 수 있도록 만들고 싶습니다.
미청산 세개중에 S1은 B1으로 반대 진입되어 매도 두개와 매수한개이므로 최종 미청산수량은 매도 한개로 표시되게 말입니다.
가능하시다면 수식 부탁 드립니다.
감사합니다.