커뮤니티
재문의 드립니다
2013-05-30 11:43:37
287
글번호 63795
안녕하세요^^
기준가 보다 종가가 커야 하는데..
예로 260기준일때 종가가260.05부터 신호가 발생해야 하는데
수식을 넣어보면 기준가와 종가가 동일한데도 신호가 발생하는 경우가
많이 나옵니다 수정할 사항이 있는지 봐주십시요.
수고하세요^^
var : cnt(0),entrynum(0),기본수량(1);
Array : CC[100](0);
var1 = int(DayClose(1));
#0.5 레인지(전일종가기준 위아래 20단계)
for cnt = 0 to 41{
CC[cnt] = var1+0.5*(cnt-20);
}
Condition1 = ExitDate(1) == sdate and (IsExitName("매수손절끝",1) or IsExitName("매도손절끝",1));
if dayindex == 0 and MarketPosition == 0 Then{
for cnt = 0 to 30{
if C >= CC[cnt] and CC[cnt] > O Then{
buy("매수.",OnClose,def,기본수량);
entrynum = cnt;
cnt = 100;
}
if C <= CC[cnt] and CC[cnt] < O Then{
Sell("매도.",OnClose,def,기본수량);
entrynum = cnt;
cnt = 100;
}
}
}
if Condition1 == false Then{
if dayindex > 0 and MarketPosition == 0 Then{
for cnt = 0 to 30{
if C >= CC[cnt] and C[1] < CC[cnt][1] Then{
buy("매수");
entrynum = cnt;
cnt = 100;
}
if C <= CC[cnt] and C[1] > CC[cnt][1] Then{
sell("매도");
entrynum = cnt;
cnt = 100;
}
}
}
if MarketPosition == -1 Then{
ExitShort("매도익절",AtLimit,CC[Entrynum-1]);
if C >= CC[entryNum+1] and CurrentContracts < 기본수량*2*2 Then{
Buy("매도손절매수스위칭",OnClose,def,CurrentContracts*2);
entrynum = entrynum+1;
}
if CurrentContracts == 기본수량*2*2 Then
ExitShort("매도손절끝",AtStop,CC[Entrynum+1]);
}
if MarketPosition == 1 Then{
ExitLong("매수익절",AtLimit,CC[Entrynum+1]);
if C <= CC[Entrynum-1] and CurrentContracts < 기본수량*2*2 Then{
Sell("매수손절매도스위칭",OnClose,def,CurrentContracts*2);
entrynum = entrynum-1;
}
if CurrentContracts == 기본수량*2*2 Then
ExitLong("매수손절끝",AtStop,CC[Entrynum-1]);
}
}
- 1. 시스템2.jpg (0.45 MB)
답변 1
예스스탁 예스스탁 답변
2013-05-30 18:23:24
안녕하세요
예스스탁입니다.
수정한 식입니다.
var : cnt(0),entrynum(0),기본수량(1);
Array : CC[100](0);
var1 = int(DayClose(1));
#0.5 레인지(전일종가기준 위아래 20단계)
for cnt = 0 to 41{
CC[cnt] = var1+0.5*(cnt-20);
}
Condition1 = ExitDate(1) == sdate and (IsExitName("매수손절끝",1) or IsExitName("매도손절끝",1));
if dayindex == 0 and MarketPosition == 0 Then{
for cnt = 0 to 30{
if C >= CC[cnt] and CC[cnt] > O Then{
buy("매수.",OnClose,def,기본수량);
entrynum = cnt;
cnt = 100;
}
if C <= CC[cnt] and CC[cnt] < O Then{
Sell("매도.",OnClose,def,기본수량);
entrynum = cnt;
cnt = 100;
}
}
}
if Condition1 == false Then{
if dayindex > 0 and MarketPosition == 0 Then{
for cnt = 0 to 30{
if C > CC[cnt] and C[1] < CC[cnt][1] Then{
buy("매수");
entrynum = cnt;
cnt = 100;
}
if C < CC[cnt] and C[1] > CC[cnt][1] Then{
sell("매도");
entrynum = cnt;
cnt = 100;
}
}
}
if MarketPosition == -1 Then{
ExitShort("매도익절",AtLimit,CC[Entrynum-1]);
if C > CC[entryNum+1] and CurrentContracts < 기본수량*2*2 Then{
Buy("매도손절매수스위칭",OnClose,def,CurrentContracts*2);
entrynum = entrynum+1;
}
if CurrentContracts == 기본수량*2*2 Then
ExitShort("매도손절끝",AtStop,CC[Entrynum+1]);
}
if MarketPosition == 1 Then{
ExitLong("매수익절",AtLimit,CC[Entrynum+1]);
if C < CC[Entrynum-1] and CurrentContracts < 기본수량*2*2 Then{
Sell("매수손절매도스위칭",OnClose,def,CurrentContracts*2);
entrynum = entrynum-1;
}
if CurrentContracts == 기본수량*2*2 Then
ExitLong("매수손절끝",AtStop,CC[Entrynum-1]);
}
}
즐거운 하루되세요
> 림경이랑 님이 쓴 글입니다.
> 제목 : 재문의 드립니다
> 안녕하세요^^
기준가 보다 종가가 커야 하는데..
예로 260기준일때 종가가260.05부터 신호가 발생해야 하는데
수식을 넣어보면 기준가와 종가가 동일한데도 신호가 발생하는 경우가
많이 나옵니다 수정할 사항이 있는지 봐주십시요.
수고하세요^^
var : cnt(0),entrynum(0),기본수량(1);
Array : CC[100](0);
var1 = int(DayClose(1));
#0.5 레인지(전일종가기준 위아래 20단계)
for cnt = 0 to 41{
CC[cnt] = var1+0.5*(cnt-20);
}
Condition1 = ExitDate(1) == sdate and (IsExitName("매수손절끝",1) or IsExitName("매도손절끝",1));
if dayindex == 0 and MarketPosition == 0 Then{
for cnt = 0 to 30{
if C >= CC[cnt] and CC[cnt] > O Then{
buy("매수.",OnClose,def,기본수량);
entrynum = cnt;
cnt = 100;
}
if C <= CC[cnt] and CC[cnt] < O Then{
Sell("매도.",OnClose,def,기본수량);
entrynum = cnt;
cnt = 100;
}
}
}
if Condition1 == false Then{
if dayindex > 0 and MarketPosition == 0 Then{
for cnt = 0 to 30{
if C >= CC[cnt] and C[1] < CC[cnt][1] Then{
buy("매수");
entrynum = cnt;
cnt = 100;
}
if C <= CC[cnt] and C[1] > CC[cnt][1] Then{
sell("매도");
entrynum = cnt;
cnt = 100;
}
}
}
if MarketPosition == -1 Then{
ExitShort("매도익절",AtLimit,CC[Entrynum-1]);
if C >= CC[entryNum+1] and CurrentContracts < 기본수량*2*2 Then{
Buy("매도손절매수스위칭",OnClose,def,CurrentContracts*2);
entrynum = entrynum+1;
}
if CurrentContracts == 기본수량*2*2 Then
ExitShort("매도손절끝",AtStop,CC[Entrynum+1]);
}
if MarketPosition == 1 Then{
ExitLong("매수익절",AtLimit,CC[Entrynum+1]);
if C <= CC[Entrynum-1] and CurrentContracts < 기본수량*2*2 Then{
Sell("매수손절매도스위칭",OnClose,def,CurrentContracts*2);
entrynum = entrynum-1;
}
if CurrentContracts == 기본수량*2*2 Then
ExitLong("매수손절끝",AtStop,CC[Entrynum-1]);
}
}