커뮤니티
수식 문의
2017-04-25 22:51:53
191
글번호 109124
안녕하세요?
서로 비슷한 시스템 2개의 수식을 부탁드립니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2017-04-25 16:00:32
안녕하세요
예스스탁입니다.
1.
input : ATRP(10),Left(3),right(3);
Input: n1(1), n2(2), n3(3);
var : T(0),매수조건(false), 매도조건(false);
var : ATRV(0),HH(0),LL(0),SHV(0),SHI(0),SLV(0),SLi(0);
ATRV = ATR(ATRP);
if 매수조건 Then{
T = 1;
if MarketPosition == -1 Then
ExitShort();
}
if 매도조건 Then{
T = -1;
if MarketPosition == 1 Then
exitlong();
}
if SwingHigh(1,h,Left,right,Left+right+1) != -1 Then{
SHV = H[3];
SHI = 0;
}
if SwingLow(1,l,Left,right,Left+right+1) != -1 Then{
SLV = L[3];
SLI = 0;
}
SHI = SHI+1;
SLI = SLI+1;
if T == 1 and T != T[1] Then
HH = H;
if T == -1 and T != T[1] Then
LL = L;
if T == 1 Then{
if H > HH Then
HH = H;
if MarketPosition == 0 and
C < HH-ATRv*2 Then
buy("b11",OnClose,def,n1);
#if MarketPosition == 0 then
# buy("b11",AtLimit,HH-ATRv*2,n1);
if MarketPosition == 0 and
countif(T != T[1],BarsSinceExit(1)) < 1 and
BarsSinceExit(1) > SHI and
C < SHV-ATRv*2 Then
buy("b12",OnClose,def,n1);
#if MarketPosition == 0 and
# countif(T != T[1],BarsSinceExit(1)) < 1 and
# BarsSinceExit(1) > SHI Then
# buy("b12",AtLimit,SHV-ATRv*2,n1);
if MarketPosition == 1 Then{
exitlong("bp",AtLimit,AvgEntryPrice+atrv*4);
if MaxEntries == 1 and C <= LatestEntryPrice(0)-atrv*3 Then
buy("b2",OnClose,def,n2);
#if MaxEntries == 1 Then
# buy("b2",atlimit,LatestEntryPrice(0)-atrv*3,n2);
if MaxEntries == 2 and C <= LatestEntryPrice(0)-atrv*3 Then
buy("b3",OnClose,def,n3);
#if MaxEntries == 2 Then
# buy("b3",atlimit,LatestEntryPrice(0)-atrv*3,n3);
if MaxEntries == 2 Then
ExitLong("bl",AtStop,LatestEntryPrice(0)-atrv*5);
}
}
if T == -1 Then{
if L < LL Then
LL = L;
if MarketPosition == 0 and
C > LL+ATRv*2 Then
sell("s11",OnClose,def,n1);
#if MarketPosition == 0 Then
# sell("s11",AtLimit,LL+ATRv*2,n1);
if MarketPosition == 0 and
countif(T != T[1],BarsSinceExit(1)) < 1 and
BarsSinceExit(1) > SLI and
C > SLV+ATRv*2 Then
sell("s12",OnClose,def,n1);
#if MarketPosition == 0 and
# countif(T != T[1],BarsSinceExit(1)) < 1 and
# BarsSinceExit(1) > SLI Then
# sell("s12",AtLimit,SLV+ATRv*2,n1);
if MarketPosition == -1 Then{
ExitShort("sp",AtLimit,AvgEntryPrice-atrv*4);
if MaxEntries == 1 and C >= LatestEntryPrice(0)+atrv*3 Then
sell("s2",OnClose,def,n2);
#if MaxEntries == 1 Then
# sell("s2",atlimit,LatestEntryPrice(0)+atrv*3,n2);
if MaxEntries == 2 and C >= LatestEntryPrice(0)+atrv*3 Then
sell("s3",OnClose,def,n3);
#if MaxEntries == 2 Then{
# sell("s3",atlimit,LatestEntryPrice(0)+atrv*3,n3);
if MaxEntries == 2 Then{
ExitShort("sl",AtStop,LatestEntryPrice(0)+atrv*5);
}
}
}
2
input : ATRP(10),Left(3),right(3),factor(2);
Input: n1(1), n2(2), n3(3);
var : T(0),매수조건(false), 매도조건(false);
var : ATRV(0),HH(0),LL(0),SHV(0),SHI(0),SLV(0),SLi(0);
ATRV = ATR(ATRP);
if 매수조건 Then{
T = 1;
if MarketPosition == -1 Then
buy("b",OnClose,def,CurrentContracts*2);
}
if 매도조건 Then{
T = -1;
if MarketPosition == 1 Then
sell("s",OnClose,def,CurrentContracts*2);
}
if SwingHigh(1,h,Left,right,Left+right+1) != -1 Then{
SHV = H[3];
SHI = 0;
}
if SwingLow(1,l,Left,right,Left+right+1) != -1 Then{
SLV = L[3];
SLI = 0;
}
SHI = SHI+1;
SLI = SLI+1;
if T == 1 and T != T[1] Then
HH = H;
if T == -1 and T != T[1] Then
LL = L;
if T == 1 Then{
if H > HH Then
HH = H;
if MarketPosition == 0 and
C < HH-ATRv*2 Then
buy("b11",OnClose,def,n1);
#if MarketPosition == 0 then
# buy("b11",AtLimit,HH-ATRv*2,n1);
if MarketPosition == 0 and
countif(T != T[1],BarsSinceExit(1)) < 1 and
BarsSinceExit(1) > SHI and
C < SHV-ATRv*2 Then
buy("b12",OnClose,def,n1);
#if MarketPosition == 0 and
# countif(T != T[1],BarsSinceExit(1)) < 1 and
# BarsSinceExit(1) > SHI Then
# buy("b12",AtLimit,SHV-ATRv*2,n1);
if MarketPosition == 1 Then{
exitlong("bp",AtLimit,AvgEntryPrice+atrv*4);
if C <= LatestEntryPrice(0)-atrv*3 Then
buy("b2",OnClose,def,CurrentContracts*factor);
# buy("b2",atlimit,LatestEntryPrice(0)-atrv*3,CurrentContracts*factor);
}
}
if T == -1 Then{
if L < LL Then
LL = L;
if MarketPosition == 0 and
C > LL+ATRv*2 Then
sell("s11",OnClose,def,n1);
#if MarketPosition == 0 Then
# sell("s11",AtLimit,LL+ATRv*2,n1);
if MarketPosition == 0 and
countif(T != T[1],BarsSinceExit(1)) < 1 and
BarsSinceExit(1) > SLI and
C > SLV+ATRv*2 Then
sell("s12",OnClose,def,n1);
#if MarketPosition == 0 and
# countif(T != T[1],BarsSinceExit(1)) < 1 and
# BarsSinceExit(1) > SLI Then
# sell("s12",AtLimit,SLV+ATRv*2,n1);
if MarketPosition == -1 Then{
ExitShort("sp",AtLimit,AvgEntryPrice-atrv*4);
if C >= LatestEntryPrice(0)+atrv*3 Then
sell("s2",OnClose,def,CurrentContracts*factor);
# sell("s2",atlimit,LatestEntryPrice(0)+atrv*3,CurrentContracts*factor);
}
}
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 수식 문의
> 안녕하세요?
서로 비슷한 시스템 2개의 수식을 부탁드립니다.
감사합니다.