커뮤니티
부탁드립니다
2013-06-18 13:30:19
150
글번호 64435
var: n지표(0),cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then
n지표 = 0;
If dayindex > 0 Then
{
If Close[0] > Close[1] Then
n지표= n지표[1] + Volume;
Else
If Close[0] < Close[1] Then
n지표= n지표[1] - Volume;
Else
n지표= n지표[1];
}
var1 = highest(n지표,dayindex+1);
var2 = Lowest(n지표,dayindex+1);
if dayindex > 0 and count == 0 and MarketPosition == 0 Then{
if C >= dayopen+PriceScale*1 Then
buy("b1");
if C <= dayopen-PriceScale*1 Then
Sell("s1");
}
if MarketPosition == 1 Then{
if CrossDown(n지표,n지표[BarsSinceEntry]-1500) then
ExitLong("bx1");
if CrossDown(n지표,var1-5000) Then
ExitLong("bx2");
}
if MarketPosition == -1 Then{
if crossup(n지표,n지표[BarsSinceEntry]+1500) then
ExitShort("sx1");
if crossup(n지표,var2+5000) Then
ExitShort("sx2");
}
1.
위 식에서 추가적으로
진입시간을 9시~10시로 제한(매매시간이 아닌 진입시간입니다)
매수한번 매도한번으로 매매회수를 당일2회로 제한
첫진입이 수익이면 두번째 진입을 제한
2.
진입시점의 n지표값이 -1500이 넘어도 청산이 되지 않는 경우가 있는데 이 부분은
어떻게 수정해야되나요
답변 1
예스스탁 예스스탁 답변
2013-06-18 18:08:11
안녕하세요
예스스탁입니다.
var: n지표(0),cnt(0),count(0),Bcount(0),Scount(0);
count = 0;
Bcount = 0;
Scount = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
if sdate == EntryDate(cnt) and MarketPosition(cnt) == 1 Then
Bcount = Bcount+1;
if sdate == EntryDate(cnt) and MarketPosition(cnt) == -1 Then
Scount = Scount+1;
}
if date != date[1] Then
n지표 = 0;
If dayindex > 0 Then
{
If Close[0] > Close[1] Then
n지표= n지표[1] + Volume;
Else
If Close[0] < Close[1] Then
n지표= n지표[1] - Volume;
Else
n지표= n지표[1];
}
var1 = highest(n지표,dayindex+1);
var2 = Lowest(n지표,dayindex+1);
if dayindex > 0 and count < 2 and MarketPosition == 0 and stime >= 090000 and stime < 100000 Then{
if C >= dayopen+PriceScale*1 and
(count == 0 or (count > 0 and Bcount < 1 and PositionProfit(1) < 0)) Then
buy("b1");
if C <= dayopen-PriceScale*1 and
(count == 0 or (count > 0 and Scount < 1 and PositionProfit(1) < 0)) Then
Sell("s1");
}
if MarketPosition == 1 Then{
if n지표 <= n지표[BarsSinceEntry]-1500 then
ExitLong("bx1");
if CrossDown(n지표,var1-5000) Then
ExitLong("bx2");
}
if MarketPosition == -1 Then{
if n지표 >= n지표[BarsSinceEntry]+1500 then
ExitShort("sx1");
if crossup(n지표,var2+5000) Then
ExitShort("sx2");
}
bx1과 sx1이 +-1500이면 청산하는 식입니다.
현재 식상에 진입시점의 n지표값 대비 -1500이면 매수청산하고
+1500이면 매도청산하게 되어 있습니다.
cross로 되어 있는 것을 부등호를 이용한 식으로 변경했습니다.
즐거운 하루되세요
> 1231241 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> var: n지표(0),cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then
n지표 = 0;
If dayindex > 0 Then
{
If Close[0] > Close[1] Then
n지표= n지표[1] + Volume;
Else
If Close[0] < Close[1] Then
n지표= n지표[1] - Volume;
Else
n지표= n지표[1];
}
var1 = highest(n지표,dayindex+1);
var2 = Lowest(n지표,dayindex+1);
if dayindex > 0 and count == 0 and MarketPosition == 0 Then{
if C >= dayopen+PriceScale*1 Then
buy("b1");
if C <= dayopen-PriceScale*1 Then
Sell("s1");
}
if MarketPosition == 1 Then{
if CrossDown(n지표,n지표[BarsSinceEntry]-1500) then
ExitLong("bx1");
if CrossDown(n지표,var1-5000) Then
ExitLong("bx2");
}
if MarketPosition == -1 Then{
if crossup(n지표,n지표[BarsSinceEntry]+1500) then
ExitShort("sx1");
if crossup(n지표,var2+5000) Then
ExitShort("sx2");
}
1.
위 식에서 추가적으로
진입시간을 9시~10시로 제한(매매시간이 아닌 진입시간입니다)
매수한번 매도한번으로 매매회수를 당일2회로 제한
첫진입이 수익이면 두번째 진입을 제한
2.
진입시점의 n지표값이 -1500이 넘어도 청산이 되지 않는 경우가 있는데 이 부분은
어떻게 수정해야되나요