커뮤니티
주문 수식 문의드립니당
2015-03-06 06:17:26
135
글번호 83756
어제
어떤 전략을 만족하면 매수 하고 이후에
5틱이 내려가면
포지션을 매도로 변경하면서 사이즈를 2배로 키우는 수식을 질문해서 이렇게 답변받았는데요
if MarketPosition == 1 Then{
var1 = MaxContracts;
sell("BS",AtStop,EntryPrice-PriceScale*5,var1*2);
}
여기에 추가해서 5틱 내려가면 바로 매도로 바꾸는게 아니라
5틱엔 청산만 하고 진입시점에서 10틱이 내려갔을때 사이즈를 2배로 키우면서 매도로
변경하는 수식은 어떻게 작성하죠?
if MarketPosition == 1 Then{
var1 = MaxContracts;
sell("매수청산",AtStop,EntryPrice-PriceScale*5,var1);
}
if MarketPosition == -1 Then{
var1 = MaxContracts;
Buy("매도청산",AtStop,EntryPrice+PriceScale*5,var1);
}
if BasePrice == EntryPrice-PriceScale*10 Then
sell("매도로변경",AtStop,EntryPrice-PriceScale*10,var1*2);
if BasePrice == EntryPrice+PriceScale*10 Then
Buy("매수로변경",AtStop,EntryPrice+PriceScale*10,var1*2);
이런식으로 하면 뭐가 잘못됐나요? 더 간단하게하는 식은 뭐가있을가요
항상감사합니당
답변 1
예스스탁 예스스탁 답변
2015-03-06 11:18:31
안녕하세요
예스스탁입니다.
청산만 하고자 하시면 매수포지션 청산은 exitlong
매도포지션 청산은 exitshort 함수를 이용하셔야 합니다.
buy와 sell함수는 진입함수로
반대포지션이 상태에서 발생하면 반대포지션 청산과 본진입을 같이 하고
무포지션 상태이면 진입만 합니다.
var : buyvol(0),Sellvol(0);
if MarketPosition == 1 Then{
buyvol = MaxContracts;
exitlong("매수청산",AtStop,EntryPrice-PriceScale*5);
}
if MarketPosition == 0 and MarketPosition(1) == 1 Then
sell("매도로전환",AtStop,EntryPrice(1)-PriceScale*10);
if MarketPosition == -1 Then{
Sellvol = MaxContracts;
ExitShort("매도청산",AtStop,EntryPrice+PriceScale*5);
}
if MarketPosition == 0 and MarketPosition(1) == -1 Then
Buy("매수로전환",AtStop,EntryPrice(1)+PriceScale*10);
즐거운 하루되세요
> ysp2101 님이 쓴 글입니다.
> 제목 : 주문 수식 문의드립니당
> 어제
어떤 전략을 만족하면 매수 하고 이후에
5틱이 내려가면
포지션을 매도로 변경하면서 사이즈를 2배로 키우는 수식을 질문해서 이렇게 답변받았는데요
if MarketPosition == 1 Then{
var1 = MaxContracts;
sell("BS",AtStop,EntryPrice-PriceScale*5,var1*2);
}
여기에 추가해서 5틱 내려가면 바로 매도로 바꾸는게 아니라
5틱엔 청산만 하고 진입시점에서 10틱이 내려갔을때 사이즈를 2배로 키우면서 매도로
변경하는 수식은 어떻게 작성하죠?
if MarketPosition == 1 Then{
var1 = MaxContracts;
sell("매수청산",AtStop,EntryPrice-PriceScale*5,var1);
}
if MarketPosition == -1 Then{
var1 = MaxContracts;
Buy("매도청산",AtStop,EntryPrice+PriceScale*5,var1);
}
if BasePrice == EntryPrice-PriceScale*10 Then
sell("매도로변경",AtStop,EntryPrice-PriceScale*10,var1*2);
if BasePrice == EntryPrice+PriceScale*10 Then
Buy("매수로변경",AtStop,EntryPrice+PriceScale*10,var1*2);
이런식으로 하면 뭐가 잘못됐나요? 더 간단하게하는 식은 뭐가있을가요
항상감사합니당
다음글
이전글