커뮤니티
Re : Re : 시스템 수식 문의드립니다.
2016-07-06 09:48:45
162
글번호 99791
안녕하세요.
일전에 진입/청산을 작성해주신 로직입니다.(첨부파일 )
해당 로직에 5분봉 기준 20 이평 터치시 무조건 청산 로직을 넣게 되면,
아래 추가해주신 로직에 따르면 input p 값이 겹치게 되는데,
이럴경우,
input : p1(5), p2(20); 으로 정의 내려주면 될까요?
그리고 var 값도 d1(0), mm(0) 의 기존값에 아래 추가해주신 mav(0) 을 단순히 추가하면 되는지 문의 드립니다.
(var : D1(0), mm(0), mav(0) ; )
많은 도움 주셔서 감사합니다.
======================================================================================
안녕하세요
예스스탁입니다.
input : P(20);
var : mav(0);
mav = ma(C,P);
#매수진입후
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then
var1 = H;
if H > var1 Then
var1 = H;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 하락하면 1계약 추가매수진입
buy("bb",atlimit,EntryPrice-PriceScale*15,1);
#진입가+10틱에 청산
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*10);
#4틱이상 상승후 진입가+2틱에 도달하면 매수청산
if var1 >= EntryPrice+PriceScale*4 Then
exitlong("bx1",AtStop,EntryPrice+PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
#청산이 아직 발생하지 않은 경우 평단가+4틱 수익이면 1계약청
if CurrentContracts == MaxContracts Then
ExitLong("bp21",Atlimit,avgEntryPrice+PriceScale*4,"",1,1);
#일부청산이 된 경우
if CurrentContracts < MaxContracts Then
#평단가 +10틱이상이면 나머지 청산
ExitLong("bp22",Atlimit,AvgEntryPrice+PriceScale*10);
#평단가 +4틱이상 상승후 하락해서 평단가+4틱에 도달하면 나머지 청산
if var1 > AvgEntryPrice+PriceScale*4 Then
exitlong("bx2",AtStop,EntryPrice+PriceScale*4);
}
if H < mav Then
exitlong("bx21",AtLimit,mav);
if L > mav Then
exitlong("bx22",AtStop,mav);
}
#매도진입후
if MarketPosition == -1 Then{
if CurrentContracts > CurrentContracts[1] Then
var2 = L;
if L < var2 Then
var2 = L;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 상승하면 1계약 추가매도진입
sell("ss",atlimit,EntryPrice+PriceScale*15,1);
#진입가-10틱에 청산
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*10);
#4틱 하락 후 진입가-2틱에 도달하면 매도청산
if var2 <= EntryPrice-PriceScale*4 Then
ExitShort("sx1",AtStop,EntryPrice-PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitShort("sp21",Atlimit,avgEntryPrice-PriceScale*4);
if CurrentContracts < MaxContracts Then
ExitShort("sp22",Atlimit,AvgEntryPrice-PriceScale*10);
if var2 < AvgEntryPrice-PriceScale*4 Then
ExitShort("sx2",AtStop,EntryPrice-PriceScale*4);
}
if L > mav Then
ExitShort("sx21",AtLimit,mav);
if H < mav Then
ExitShort("sx22",AtStop,mav);
}
즐거운 하루되세요
> 제이크 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 안녕하세요.
만들어주신 시스템 로직의 도움을 받아 다양한 변수 조건에서 테스트를 하고 있습니다.
너무 감사합니다.
아래 작성해주신 조건을 바탕으로 강제 청산 조건을 하나 추가 하고 싶습니다.
로직에 따른 미청산이 있을 경우,
"상품의 현재가가 20 이평"을 터치할 경우, 무조건 청산이라는 조건을 넣고 싶습니다.
늘 빠르고 훌륭한 로직으로 도와주셔서 감사합니다.
#매수진입후
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then
var1 = H;
if H > var1 Then
var1 = H;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 하락하면 1계약 추가매수진입
buy("bb",atlimit,EntryPrice-PriceScale*15,1);
#진입가+10틱에 청산
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*10);
#4틱이상 상승후 진입가+2틱에 도달하면 매수청산
if var1 >= EntryPrice+PriceScale*4 Then
exitlong("bx1",AtStop,EntryPrice+PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
#청산이 아직 발생하지 않은 경우 평단가+4틱 수익이면 1계약청
if CurrentContracts == MaxContracts Then
ExitLong("bp21",Atlimit,avgEntryPrice+PriceScale*4,"",1,1);
#일부청산이 된 경우
if CurrentContracts < MaxContracts Then
#평단가 +10틱이상이면 나머지 청산
ExitLong("bp22",Atlimit,AvgEntryPrice+PriceScale*10);
#평단가 +4틱이상 상승후 하락해서 평단가+4틱에 도달하면 나머지 청산
if var1 > AvgEntryPrice+PriceScale*4 Then
exitlong("bx2",AtStop,EntryPrice+PriceScale*4);
}
}
#매도진입후
if MarketPosition == -1 Then{
if CurrentContracts > CurrentContracts[1] Then
var2 = L;
if L < var2 Then
var2 = L;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 상승하면 1계약 추가매도진입
sell("ss",atlimit,EntryPrice+PriceScale*15,1);
#진입가-10틱에 청산
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*10);
#4틱 하락 후 진입가-2틱에 도달하면 매도청산
if var2 <= EntryPrice-PriceScale*4 Then
ExitShort("sx1",AtStop,EntryPrice-PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitShort("sp21",Atlimit,avgEntryPrice-PriceScale*4);
if CurrentContracts < MaxContracts Then
ExitShort("sp22",Atlimit,AvgEntryPrice-PriceScale*10);
if var2 < AvgEntryPrice-PriceScale*4 Then
ExitShort("sx2",AtStop,EntryPrice-PriceScale*4);
}
}
- 1. 5분봉_진입조건.JPG (0.06 MB)
답변 1
예스스탁 예스스탁 답변
2016-07-06 11:33:14
안녕하세요
예스스탁입니다.
외부변수(input)의 이름만 변경하시면 안되고
변경된 변수이름이 사용된 함수안에도 변경해주셔야 합니다.
내부변수는 그대로 선언해서 사용하시면 됩니다.
input : P1(5),P2(20);
var : D1(0),MM(0),mav(0);
MM = stime%100;
D1 = C/ma(C,P1); #<< P를 P1으로
mav = ma(C,p2); #<< P를 P2로
즐거운 하루되세요
> 제이크 님이 쓴 글입니다.
> 제목 : Re : Re : 시스템 수식 문의드립니다.
> 안녕하세요.
일전에 진입/청산을 작성해주신 로직입니다.(첨부파일 )
해당 로직에 5분봉 기준 20 이평 터치시 무조건 청산 로직을 넣게 되면,
아래 추가해주신 로직에 따르면 input p 값이 겹치게 되는데,
이럴경우,
input : p1(5), p2(20); 으로 정의 내려주면 될까요?
그리고 var 값도 d1(0), mm(0) 의 기존값에 아래 추가해주신 mav(0) 을 단순히 추가하면 되는지 문의 드립니다.
(var : D1(0), mm(0), mav(0) ; )
많은 도움 주셔서 감사합니다.
======================================================================================
안녕하세요
예스스탁입니다.
input : P(20);
var : mav(0);
mav = ma(C,P);
#매수진입후
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then
var1 = H;
if H > var1 Then
var1 = H;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 하락하면 1계약 추가매수진입
buy("bb",atlimit,EntryPrice-PriceScale*15,1);
#진입가+10틱에 청산
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*10);
#4틱이상 상승후 진입가+2틱에 도달하면 매수청산
if var1 >= EntryPrice+PriceScale*4 Then
exitlong("bx1",AtStop,EntryPrice+PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
#청산이 아직 발생하지 않은 경우 평단가+4틱 수익이면 1계약청
if CurrentContracts == MaxContracts Then
ExitLong("bp21",Atlimit,avgEntryPrice+PriceScale*4,"",1,1);
#일부청산이 된 경우
if CurrentContracts < MaxContracts Then
#평단가 +10틱이상이면 나머지 청산
ExitLong("bp22",Atlimit,AvgEntryPrice+PriceScale*10);
#평단가 +4틱이상 상승후 하락해서 평단가+4틱에 도달하면 나머지 청산
if var1 > AvgEntryPrice+PriceScale*4 Then
exitlong("bx2",AtStop,EntryPrice+PriceScale*4);
}
if H < mav Then
exitlong("bx21",AtLimit,mav);
if L > mav Then
exitlong("bx22",AtStop,mav);
}
#매도진입후
if MarketPosition == -1 Then{
if CurrentContracts > CurrentContracts[1] Then
var2 = L;
if L < var2 Then
var2 = L;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 상승하면 1계약 추가매도진입
sell("ss",atlimit,EntryPrice+PriceScale*15,1);
#진입가-10틱에 청산
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*10);
#4틱 하락 후 진입가-2틱에 도달하면 매도청산
if var2 <= EntryPrice-PriceScale*4 Then
ExitShort("sx1",AtStop,EntryPrice-PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitShort("sp21",Atlimit,avgEntryPrice-PriceScale*4);
if CurrentContracts < MaxContracts Then
ExitShort("sp22",Atlimit,AvgEntryPrice-PriceScale*10);
if var2 < AvgEntryPrice-PriceScale*4 Then
ExitShort("sx2",AtStop,EntryPrice-PriceScale*4);
}
if L > mav Then
ExitShort("sx21",AtLimit,mav);
if H < mav Then
ExitShort("sx22",AtStop,mav);
}
즐거운 하루되세요
> 제이크 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 안녕하세요.
만들어주신 시스템 로직의 도움을 받아 다양한 변수 조건에서 테스트를 하고 있습니다.
너무 감사합니다.
아래 작성해주신 조건을 바탕으로 강제 청산 조건을 하나 추가 하고 싶습니다.
로직에 따른 미청산이 있을 경우,
"상품의 현재가가 20 이평"을 터치할 경우, 무조건 청산이라는 조건을 넣고 싶습니다.
늘 빠르고 훌륭한 로직으로 도와주셔서 감사합니다.
#매수진입후
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] Then
var1 = H;
if H > var1 Then
var1 = H;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 하락하면 1계약 추가매수진입
buy("bb",atlimit,EntryPrice-PriceScale*15,1);
#진입가+10틱에 청산
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*10);
#4틱이상 상승후 진입가+2틱에 도달하면 매수청산
if var1 >= EntryPrice+PriceScale*4 Then
exitlong("bx1",AtStop,EntryPrice+PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
#청산이 아직 발생하지 않은 경우 평단가+4틱 수익이면 1계약청
if CurrentContracts == MaxContracts Then
ExitLong("bp21",Atlimit,avgEntryPrice+PriceScale*4,"",1,1);
#일부청산이 된 경우
if CurrentContracts < MaxContracts Then
#평단가 +10틱이상이면 나머지 청산
ExitLong("bp22",Atlimit,AvgEntryPrice+PriceScale*10);
#평단가 +4틱이상 상승후 하락해서 평단가+4틱에 도달하면 나머지 청산
if var1 > AvgEntryPrice+PriceScale*4 Then
exitlong("bx2",AtStop,EntryPrice+PriceScale*4);
}
}
#매도진입후
if MarketPosition == -1 Then{
if CurrentContracts > CurrentContracts[1] Then
var2 = L;
if L < var2 Then
var2 = L;
#진입이 1번일경우
if MaxEntries == 1 Then{
#15틱 상승하면 1계약 추가매도진입
sell("ss",atlimit,EntryPrice+PriceScale*15,1);
#진입가-10틱에 청산
ExitShort("sp1",Atlimit,EntryPrice-PriceScale*10);
#4틱 하락 후 진입가-2틱에 도달하면 매도청산
if var2 <= EntryPrice-PriceScale*4 Then
ExitShort("sx1",AtStop,EntryPrice-PriceScale*2);
}
#진입이 2번일 경우
if MaxEntries == 2 Then{
if CurrentContracts == MaxContracts Then
ExitShort("sp21",Atlimit,avgEntryPrice-PriceScale*4);
if CurrentContracts < MaxContracts Then
ExitShort("sp22",Atlimit,AvgEntryPrice-PriceScale*10);
if var2 < AvgEntryPrice-PriceScale*4 Then
ExitShort("sx2",AtStop,EntryPrice-PriceScale*4);
}
}
이전글