커뮤니티
주문 이름별 구분청산수식
2013-07-09 08:01:35
170
글번호 65131
이전 주문이름별 주문횟수제한수식 감사드립니다
주문 이름별 구분청산수식 부탁드립니다
주문 이름별로 별도청산이 가능하면 수식 부탁드립니다
예 : 매수주문1 = 매수청산1로 청산
매수주문2 = 매수청산2로 청산
매도주문1 = 매도청산1로 청산
매도주문2 = 매도청산2로 청산
# 아래는 시스템 입니다
부탁드립니다
감사합니다
좋은하루 되세요~
var : cnt(0),B1cnt(0),B2cnt(0),S1cnt(0),S2cnt(0);
#이름별 진입횟수 카운트
B1cnt = 0;
B2cnt = 0;
S1cnt = 0;
S2cnt = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) and IsEntryName("매수1",cnt) == true Then
B1cnt = B1cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매수2",cnt) == true Then
B2cnt = B2cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매도1",cnt) == true Then
S1cnt = S1cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매도2",cnt) == true Then
S2cnt = S2cnt+1;
}
//주문1
///////////////////////////////////////////////////////////////////
if CrossUp(ma(C,20),ma(C,20[1])
and B1cnt < 1
Then
{
Buy("매수1", OnClose, DEF);
}
if CrossDown(ma(C,20),ma(C,20[1])
and S1cnt < 1
Then
{
Sell("매도1", OnClose, DEF);
}
//주문2
///////////////////////////////////////////////////////////////////
if CrossUp(ma(C,60),ma(C,60[1])
and B2cnt < 1
Then
{
Buy("매수2", OnClose, DEF);
}
if CrossDown(ma(C,60),ma(C,60[1])
and S2cnt < 1
Then
{
Sell("매도2", OnClose, DEF);
}
/////////////////////////////////////////////////
//청산1
if CrossDown(C,ma(C,20)
Then
ExitLong("매수청산1");
//매도청산0 ------------------------------------------------------------------------------------------
if CrossUp(C,ma(C,20)
Then
ExitShort("매도청산1");
/////////////////////////////////////////////////
//매수청산2
if CrossDown(C,ma(C,60)
Then
ExitLong("매수청산2");
//매도청산2 ------------------------------------------------------------------------------------------
if CrossUp(C,ma(C,60)
Then
ExitShort("매도청산2");
답변 1
예스스탁 예스스탁 답변
2013-07-09 15:52:50
안녕하세요
예스스탁입니다.
var : cnt(0),B1cnt(0),B2cnt(0),S1cnt(0),S2cnt(0);
#이름별 진입횟수 카운트
B1cnt = 0;
B2cnt = 0;
S1cnt = 0;
S2cnt = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) and IsEntryName("매수1",cnt) == true Then
B1cnt = B1cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매수2",cnt) == true Then
B2cnt = B2cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매도1",cnt) == true Then
S1cnt = S1cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매도2",cnt) == true Then
S2cnt = S2cnt+1;
}
//주문1
///////////////////////////////////////////////////////////////////
if CrossUp(ma(C,20),ma(C[1],20))
and B1cnt < 1
Then
{
Buy("매수1", OnClose, DEF);
}
if CrossDown(ma(C,20),ma(C[1],20))
and S1cnt < 1
Then
{
Sell("매도1", OnClose, DEF);
}
//주문2
///////////////////////////////////////////////////////////////////
if CrossUp(ma(C,60),ma(C[1],60))
and B2cnt < 1
Then
{
Buy("매수2", OnClose, DEF);
}
if CrossDown(ma(C,60),ma(C[1],60))
and S2cnt < 1
Then
{
Sell("매도2", OnClose, DEF);
}
/////////////////////////////////////////////////
//청산1
if CrossDown(C,ma(C,20)) and IsEntryName("매수1") == true
Then
ExitLong("매수청산1");
//매도청산0 ------------------------------------------------------------------------------------------
if CrossUp(C,ma(C,20)) and IsEntryName("매도1") == true
Then
ExitShort("매도청산1");
/////////////////////////////////////////////////
//매수청산2
if CrossDown(C,ma(C,60)) and IsEntryName("매수2") == true
Then
ExitLong("매수청산2");
//매도청산2 ------------------------------------------------------------------------------------------
if CrossUp(C,ma(C,60)) and IsEntryName("매도2") == true
Then
ExitShort("매도청산2");
즐거운 하루되세요
> 감사1 님이 쓴 글입니다.
> 제목 : 주문 이름별 구분청산수식
> 이전 주문이름별 주문횟수제한수식 감사드립니다
주문 이름별 구분청산수식 부탁드립니다
주문 이름별로 별도청산이 가능하면 수식 부탁드립니다
예 : 매수주문1 = 매수청산1로 청산
매수주문2 = 매수청산2로 청산
매도주문1 = 매도청산1로 청산
매도주문2 = 매도청산2로 청산
# 아래는 시스템 입니다
부탁드립니다
감사합니다
좋은하루 되세요~
var : cnt(0),B1cnt(0),B2cnt(0),S1cnt(0),S2cnt(0);
#이름별 진입횟수 카운트
B1cnt = 0;
B2cnt = 0;
S1cnt = 0;
S2cnt = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) and IsEntryName("매수1",cnt) == true Then
B1cnt = B1cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매수2",cnt) == true Then
B2cnt = B2cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매도1",cnt) == true Then
S1cnt = S1cnt+1;
if sdate == EntryDate(cnt) and IsEntryName("매도2",cnt) == true Then
S2cnt = S2cnt+1;
}
//주문1
///////////////////////////////////////////////////////////////////
if CrossUp(ma(C,20),ma(C,20[1])
and B1cnt < 1
Then
{
Buy("매수1", OnClose, DEF);
}
if CrossDown(ma(C,20),ma(C,20[1])
and S1cnt < 1
Then
{
Sell("매도1", OnClose, DEF);
}
//주문2
///////////////////////////////////////////////////////////////////
if CrossUp(ma(C,60),ma(C,60[1])
and B2cnt < 1
Then
{
Buy("매수2", OnClose, DEF);
}
if CrossDown(ma(C,60),ma(C,60[1])
and S2cnt < 1
Then
{
Sell("매도2", OnClose, DEF);
}
/////////////////////////////////////////////////
//청산1
if CrossDown(C,ma(C,20)
Then
ExitLong("매수청산1");
//매도청산0 ------------------------------------------------------------------------------------------
if CrossUp(C,ma(C,20)
Then
ExitShort("매도청산1");
/////////////////////////////////////////////////
//매수청산2
if CrossDown(C,ma(C,60)
Then
ExitLong("매수청산2");
//매도청산2 ------------------------------------------------------------------------------------------
if CrossUp(C,ma(C,60)
Then
ExitShort("매도청산2");