커뮤니티
수식 문의 드립니다.
2011-04-11 23:09:15
728
글번호 37518
문의 드릴 것이 두 가지 인데요.
첫 째는 다음 <수식1>에서 처음 진입가격이 0.5 미만이면 1.0 포인트 상승시마다 추가진입하고, 처음진입가격이 0.5 이상이면 최초진입 가격에서 20% 상승시 마다 추가진입하게끔 식을 세분화 하고 싶습니다. 수정된 수식좀 부탁드립니다.
<수식1>
#최초진입
if MarketPosition == 0 and C > 0.15 and daylow*1.3 < dayhigh and stime < 150000 Then{
buy("b",AtStop,daylow*1.3);
}
#추가진입
if countif(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 Then{
if MarketPosition == 1 and CurrentEntries == 1 and highest(H,BarsSinceEntry) < EntryPrice+0.1 Then
buy("BB",AtStop,EntryPrice+0.1);
if MarketPosition == 1 and CurrentEntries == 2 and highest(H,BarsSinceEntry) < EntryPrice+0.2 Then
buy("CC",AtStop,EntryPrice+0.2);
if MarketPosition == 1 and CurrentEntries == 3 and highest(H,BarsSinceEntry) < EntryPrice+0.3 Then
buy("DD",AtStop,EntryPrice+0.3);
if MarketPosition == 1 and CurrentEntries == 4 and highest(H,BarsSinceEntry) < EntryPrice+0.4 Then
buy("EE",AtStop,EntryPrice+0.4);
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,AvgEntryPrice,"BB");
if MarketPosition == 1 Then
exitlong("cx",AtStop,AvgEntryPrice,"CC");
if MarketPosition == 1 Then
exitlong("dx",AtStop,AvgEntryPrice,"DD");
if MarketPosition == 1 Then
exitlong("ex",AtStop,AvgEntryPrice,"EE");
SetStopEndofday(143000);
두번 째는 오전 10시 이후에 당일 최고가(장 시작인 오전 9시 이후부터 모두 고려)를 돌파할 때 매수할 수 있게 <수식2> 수정 좀 부탁드립니다. 간단한 것 같은데 제가 만든 다음의 <수식2>는 자꾸 오류가 납니다. 참고로 1초봉 차트를 사용하고 있습니다.
<수식2>
#최초진입
if stime > 093000 and MarketPosition == 0 and C > 0.15 and C > dayhigh(1) and stime < 150000 Then{
buy("b",AtStop,c);
}
그럼 부탁드리겠습니다. 감사합니다.
답변 1
예스스탁 예스스탁 답변
2011-04-12 12:55:14
안녕하세요
예스스탁입니다.
1.
var : EP(0);
#최초진입
if MarketPosition == 0 and C > 0.15 and daylow*1.3 < dayhigh and stime < 150000 Then{
buy("b",AtStop,daylow*1.3);
}
if MarketPosition == 1 and CurrentEntries == 1 Then
EP = EntryPrice;
#추가진입
if countif(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 Then{
if MarketPosition == 1 and CurrentEntries == 1 and highest(H,BarsSinceEntry) < EntryPrice+0.1 Then
buy("BB",AtStop,iff(EP < 0.5,EntryPrice+1,EntryPrice*1.2));
if MarketPosition == 1 and CurrentEntries == 2 and highest(H,BarsSinceEntry) < EntryPrice+0.2 Then
buy("CC",AtStop,iff(EP < 0.5,EntryPrice+2,EntryPrice*1.4));
if MarketPosition == 1 and CurrentEntries == 3 and highest(H,BarsSinceEntry) < EntryPrice+0.3 Then
buy("DD",AtStop,iff(EP < 0.5,EntryPrice+3,EntryPrice*1.6));
if MarketPosition == 1 and CurrentEntries == 4 and highest(H,BarsSinceEntry) < EntryPrice+0.4 Then
buy("EE",AtStop,iff(EP < 0.5,EntryPrice+4,EntryPrice*1.8));
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,AvgEntryPrice,"BB");
if MarketPosition == 1 Then
exitlong("cx",AtStop,AvgEntryPrice,"CC");
if MarketPosition == 1 Then
exitlong("dx",AtStop,AvgEntryPrice,"DD");
if MarketPosition == 1 Then
exitlong("ex",AtStop,AvgEntryPrice,"EE");
SetStopEndofday(143000);
2.
if stime > 100000 and MarketPosition == 0 and C > 0.15 and C > dayhigh(1) and stime < 150000 Then{
buy("b",AtStop,dayhigh+PriceScale);
}
즐거운 하루되세요
> WT_mbloc 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 문의 드릴 것이 두 가지 인데요.
첫 째는 다음 <수식1>에서 처음 진입가격이 0.5 미만이면 1.0 포인트 상승시마다 추가진입하고, 처음진입가격이 0.5 이상이면 최초진입 가격에서 20% 상승시 마다 추가진입하게끔 식을 세분화 하고 싶습니다. 수정된 수식좀 부탁드립니다.
<수식1>
#최초진입
if MarketPosition == 0 and C > 0.15 and daylow*1.3 < dayhigh and stime < 150000 Then{
buy("b",AtStop,daylow*1.3);
}
#추가진입
if countif(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 Then{
if MarketPosition == 1 and CurrentEntries == 1 and highest(H,BarsSinceEntry) < EntryPrice+0.1 Then
buy("BB",AtStop,EntryPrice+0.1);
if MarketPosition == 1 and CurrentEntries == 2 and highest(H,BarsSinceEntry) < EntryPrice+0.2 Then
buy("CC",AtStop,EntryPrice+0.2);
if MarketPosition == 1 and CurrentEntries == 3 and highest(H,BarsSinceEntry) < EntryPrice+0.3 Then
buy("DD",AtStop,EntryPrice+0.3);
if MarketPosition == 1 and CurrentEntries == 4 and highest(H,BarsSinceEntry) < EntryPrice+0.4 Then
buy("EE",AtStop,EntryPrice+0.4);
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,AvgEntryPrice,"BB");
if MarketPosition == 1 Then
exitlong("cx",AtStop,AvgEntryPrice,"CC");
if MarketPosition == 1 Then
exitlong("dx",AtStop,AvgEntryPrice,"DD");
if MarketPosition == 1 Then
exitlong("ex",AtStop,AvgEntryPrice,"EE");
SetStopEndofday(143000);
두번 째는 오전 10시 이후에 당일 최고가(장 시작인 오전 9시 이후부터 모두 고려)를 돌파할 때 매수할 수 있게 <수식2> 수정 좀 부탁드립니다. 간단한 것 같은데 제가 만든 다음의 <수식2>는 자꾸 오류가 납니다. 참고로 1초봉 차트를 사용하고 있습니다.
<수식2>
#최초진입
if stime > 093000 and MarketPosition == 0 and C > 0.15 and C > dayhigh(1) and stime < 150000 Then{
buy("b",AtStop,c);
}
그럼 부탁드리겠습니다. 감사합니다.
다음글
이전글