커뮤니티
재 수정좀 부탁드립니다.
2013-03-22 15:46:04
215
글번호 61102
아래에 시스템식을 작성하면 매매가 계속나옵니다..
장중에 어떤 신호의 매매가 청산될시점에 총손익이 그날 수익으로
마감되면 매매신호가 더이상 안나오게 하고싶은데 계속 나옵니다...
var : cnt(0),count(0),dayPL(0);
count = 0;
dayPL = 0;
for cnt = 0 to 30{
if sdate == EntryDate(cnt) Then{
count = count+1;
dayPL = dayPL+PositionProfit(cnt);
}
}
var1 = ma(c,5);
var2 = ma(c,20);
if (crossup(c,var1) or crossup(c,var2)) Then{
if count == 0 Then
buy("b1",OnClose,def,1);
if count >= 1 and MarketPosition == -1 and C > EntryPrice Then
buy("b2",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) < 0 Then
buy("b3",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0 Then
buy("b4",OnClose,def,1);
if count >= 1 and MarketPosition == -1 and C < EntryPrice Then
ExitShort("sx");
}
if (CrossDown(c,var1) or crossdown(c,var2)) and dayPL <= 0 Then{
if count == 0 Then
Sell("s1",OnClose,def,1);
if count >= 1 and MarketPosition == 1 and C < EntryPrice Then
Sell("s2",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) < 0 Then
Sell("s3",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0 Then
Sell("s4",OnClose,def,1);
if count >= 1 and MarketPosition == 1 and C > EntryPrice Then
ExitLong("bx");
}
if count >= 1 and dayPL > 0 Then{
if CrossDown(c,var1) Then
exitlong();
if crossup(c,var2) Then
ExitShort();
}
답변 1
예스스탁 예스스탁 답변
2013-03-22 16:45:21
안녕하세요
예스스탁입니다.
매수쪽에 당일손익이 +이면 진입하지 않는 내용이 빠져 있었었습니다.
수정한 식입니다.
var : cnt(0),count(0),dayPL(0);
count = 0;
dayPL = 0;
for cnt = 0 to 30{
if sdate == EntryDate(cnt) Then{
count = count+1;
dayPL = dayPL+PositionProfit(cnt);
}
}
var1 = ma(c,5);
var2 = ma(c,20);
if (crossup(c,var1) or crossup(c,var2)) and dayPL <= 0 Then{
if count == 0 Then
buy("b1",OnClose,def,1);
if count >= 1 and MarketPosition == -1 and C > EntryPrice Then
buy("b2",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) < 0 Then
buy("b3",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0 Then
buy("b4",OnClose,def,1);
if count >= 1 and MarketPosition == -1 and C < EntryPrice Then
ExitShort("sx");
}
if (CrossDown(c,var1) or crossdown(c,var2)) and dayPL <= 0 Then{
if count == 0 Then
Sell("s1",OnClose,def,1);
if count >= 1 and MarketPosition == 1 and C < EntryPrice Then
Sell("s2",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) < 0 Then
Sell("s3",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0 Then
Sell("s4",OnClose,def,1);
if count >= 1 and MarketPosition == 1 and C > EntryPrice Then
ExitLong("bx");
}
if count >= 1 and dayPL > 0 Then{
if CrossDown(c,var1) Then
exitlong();
if crossup(c,var2) Then
ExitShort();
}
즐거운 하루되세요
> 최재영 님이 쓴 글입니다.
> 제목 : 재 수정좀 부탁드립니다.
> 아래에 시스템식을 작성하면 매매가 계속나옵니다..
장중에 어떤 신호의 매매가 청산될시점에 총손익이 그날 수익으로
마감되면 매매신호가 더이상 안나오게 하고싶은데 계속 나옵니다...
var : cnt(0),count(0),dayPL(0);
count = 0;
dayPL = 0;
for cnt = 0 to 30{
if sdate == EntryDate(cnt) Then{
count = count+1;
dayPL = dayPL+PositionProfit(cnt);
}
}
var1 = ma(c,5);
var2 = ma(c,20);
if (crossup(c,var1) or crossup(c,var2)) Then{
if count == 0 Then
buy("b1",OnClose,def,1);
if count >= 1 and MarketPosition == -1 and C > EntryPrice Then
buy("b2",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) < 0 Then
buy("b3",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0 Then
buy("b4",OnClose,def,1);
if count >= 1 and MarketPosition == -1 and C < EntryPrice Then
ExitShort("sx");
}
if (CrossDown(c,var1) or crossdown(c,var2)) and dayPL <= 0 Then{
if count == 0 Then
Sell("s1",OnClose,def,1);
if count >= 1 and MarketPosition == 1 and C < EntryPrice Then
Sell("s2",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) < 0 Then
Sell("s3",OnClose,def,CurrentContracts*2);
if count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0 Then
Sell("s4",OnClose,def,1);
if count >= 1 and MarketPosition == 1 and C > EntryPrice Then
ExitLong("bx");
}
if count >= 1 and dayPL > 0 Then{
if CrossDown(c,var1) Then
exitlong();
if crossup(c,var2) Then
ExitShort();
}
다음글
이전글