커뮤니티
손절관련
2017-04-28 15:21:23
104
글번호 109273
손절관련 추가 답변 잘 받았습니다.
아래 수식으로 답변해 주셨는데 해외선물에 적용하려고 하니깐
안맞는 부분이 있어서요 제가 예를 들어 아침11시에 진입조건으로 들어가서
21시에 손절틱수를 바뀌게하고
그다음날 새벽 3시에 청산하려고 하는데 그렇게 하려면 어떻게 작성해야될까요?
input : 손절틱수1(12),손절틱수2(7);
var : Tcond(false);
#영업일 변경되면 진입가능하게 Tcond는 true
if Bdate != Bdate[1] Then
Tcond = true;
#19시가 되면 더이상 진입못하게 Tcond는 false로 만들고
#보유 포지션있으면 청산
if stime == 190000 or (stime > 190000 and stime[1] < 1900000) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
#Tcond가 true일때만 진입
if Tcond == true then{
if 매수진입조건 Then
buy();
if 매도진입조건 Then
sell();
}
if MarketPosition == 1 Then{
if stime < 150000 Then
exitlong("bx1",AtStop,EntryPrice-PriceScale*손절틱수1);
else
exitlong("bx2",AtStop,EntryPrice-PriceScale*손절틱수2);
}
if MarketPosition == -1 Then{
if stime < 150000 Then
ExitShort("sx1",AtStop,EntryPrice+PriceScale*손절틱수1);
else
ExitShort("sx2",AtStop,EntryPrice+PriceScale*손절틱수2);
}
답변 1
예스스탁 예스스탁 답변
2017-04-28 15:33:22
안녕하세요
예스스탁입니다.
국내/해외 모두 동일하게 사용하실수 있게
변경해 드립니다.
외부변수로 틱수와 시간등을 지정하시면 됩니다.
input : 손절틱수1(12),손절틱수2(7),당일청산시간(030000),손절변경시간(210000);
var : Tcond(false),LossCut(0);
#영업일 변경되면 진입가능하게 Tcond는 true
if Bdate != Bdate[1] Then{
Tcond = true;
LossCut = PriceScale*손절틱수1;
}
#19시가 되면 더이상 진입못하게 Tcond는 false로 만들고
#보유 포지션있으면 청산
if stime == 당일청산시간 or (stime > 당일청산시간 and stime[1] < 당일청산시간) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if stime == 손절변경시간 or (stime > 손절변경시간 and stime[1] < 손절변경시간) Then
LossCut = PriceScale*손절틱수2;
#Tcond가 true일때만 진입
if Tcond == true then{
if 매수진입조건 Then
buy();
if 매도진입조건 Then
sell();
}
if MarketPosition == 1 Then{
exitlong("bx1",AtStop,EntryPrice-LossCut);
}
if MarketPosition == -1 Then{
ExitShort("sx1",AtStop,EntryPrice+LossCut);
}
즐거운 하루되세요
> toal 님이 쓴 글입니다.
> 제목 : 손절관련
> 손절관련 추가 답변 잘 받았습니다.
아래 수식으로 답변해 주셨는데 해외선물에 적용하려고 하니깐
안맞는 부분이 있어서요 제가 예를 들어 아침11시에 진입조건으로 들어가서
21시에 손절틱수를 바뀌게하고
그다음날 새벽 3시에 청산하려고 하는데 그렇게 하려면 어떻게 작성해야될까요?
input : 손절틱수1(12),손절틱수2(7);
var : Tcond(false);
#영업일 변경되면 진입가능하게 Tcond는 true
if Bdate != Bdate[1] Then
Tcond = true;
#19시가 되면 더이상 진입못하게 Tcond는 false로 만들고
#보유 포지션있으면 청산
if stime == 190000 or (stime > 190000 and stime[1] < 1900000) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
#Tcond가 true일때만 진입
if Tcond == true then{
if 매수진입조건 Then
buy();
if 매도진입조건 Then
sell();
}
if MarketPosition == 1 Then{
if stime < 150000 Then
exitlong("bx1",AtStop,EntryPrice-PriceScale*손절틱수1);
else
exitlong("bx2",AtStop,EntryPrice-PriceScale*손절틱수2);
}
if MarketPosition == -1 Then{
if stime < 150000 Then
ExitShort("sx1",AtStop,EntryPrice+PriceScale*손절틱수1);
else
ExitShort("sx2",AtStop,EntryPrice+PriceScale*손절틱수2);
}