커뮤니티
손절식 추가.
2008-09-22 17:50:06
925
글번호 17158
아래 식에서 손절부분을 다음과 같이 수정추가하려고 합니다.
어떻게 수정하면 될까요?
진입가가 10만원이하는 손절매율 8%, 10만원초과 15만원이하는 손절매율 7%, 15만원초과 20만원이하는 손절매율 6%, 20만원초과 25만원이하는 손절매율 5%, 25만원초과 30만원이하는 손절매율 4%, 이렇게 진입가가 다르면 손절매율도 달리 적용하고 싶은데 어떻게 수정하면 될까요?
메일(aceace77@hanmail.net)로 답변부탁드립니다.
---------------------------------------------------------------------------------
input : ts(4),fl(5),sp(8),maxbar(15);
var : maxp(0);
if dayindex() == 0 Then
var2=Close;
if MarketPosition() == 0 Then{
if dayindex() == 0 and C >= O Then
buy("매수1",onclose);
if dayindex() == 1 and C >= O and C >= C[1] Then
buy("매수2",onclose);
if sdate == exitdate(1) and EntryPrice(1) >= exitprice(1) and c>entryprice(1) and stime < 150000 Then
buy("매수3",atstop,c);
if sdate == exitdate(1) and EntryPrice(1) < exitprice(1) and c>exitprice(1) and stime < 150000 Then
buy("매수4",atstop,c);
if sdate != exitdate(1) and dayindex() > 1 and c>var2 Then
buy("매수5",atstop,C);
}
MaxP = Highest(High, BarsSinceEntry + 1);
If marketPosition() == 1 Then {
If MaxP >= (EntryPrice * (1+fl/100)) Then
ExitLong("이익보존", Atstop, MaxP *(1-ts/100));
else
exitLong("손절매", Atstop, EntryPrice * (1-SP/100));
If MaxBar <= BarsSinceEntry + 1 And MaxP < EntryPrice * (1 + fl / 100) Then
ExitLong("기간청산", Atmarket);
}
---------------------------------------------------------------------------------
답변 1
예스스탁 예스스탁 답변
2008-09-22 19:32:02
> 송사범 님이 쓴 글입니다.
> 제목 : 손절식 추가.
> 아래 식에서 손절부분을 다음과 같이 수정추가하려고 합니다.
어떻게 수정하면 될까요?
진입가가 10만원이하는 손절매율 8%, 10만원초과 15만원이하는 손절매율 7%, 15만원초과 20만원이하는 손절매율 6%, 20만원초과 25만원이하는 손절매율 5%, 25만원초과 30만원이하는 손절매율 4%, 이렇게 진입가가 다르면 손절매율도 달리 적용하고 싶은데 어떻게 수정하면 될까요?
메일(aceace77@hanmail.net)로 답변부탁드립니다.
---------------------------------------------------------------------------------
input : ts(4),fl(5),sp(8),maxbar(15);
var : maxp(0);
if dayindex() == 0 Then
var2=Close;
if MarketPosition() == 0 Then{
if dayindex() == 0 and C >= O Then
buy("매수1",onclose);
if dayindex() == 1 and C >= O and C >= C[1] Then
buy("매수2",onclose);
if sdate == exitdate(1) and EntryPrice(1) >= exitprice(1) and c>entryprice(1) and stime < 150000 Then
buy("매수3",atstop,c);
if sdate == exitdate(1) and EntryPrice(1) < exitprice(1) and c>exitprice(1) and stime < 150000 Then
buy("매수4",atstop,c);
if sdate != exitdate(1) and dayindex() > 1 and c>var2 Then
buy("매수5",atstop,C);
}
MaxP = Highest(High, BarsSinceEntry + 1);
If marketPosition() == 1 Then {
If MaxP >= (EntryPrice * (1+fl/100)) Then
ExitLong("이익보존", Atstop, MaxP *(1-ts/100));
else
exitLong("손절매", Atstop, EntryPrice * (1-SP/100));
If MaxBar <= BarsSinceEntry + 1 And MaxP < EntryPrice * (1 + fl / 100) Then
ExitLong("기간청산", Atmarket);
}
---------------------------------------------------------------------------------
다음글
이전글