커뮤니티
시스템식 문의
2012-07-28 01:06:48
319
글번호 53316
감사합니다.
답변 1
예스스탁 예스스탁 답변
2012-07-27 16:50:50
안녕하세요
예스스탁입니다.
수식에서는 미완성시 발생하는 값은 저장해서 사용할 수 없습니다.
그러므로 추가진입되는 신호에 대해 정확히 값을 저장해서
사용하기는 불가능합니다. 피라미딩시 추가진입값에 대해 리턴하는 함수도 없습니다.
올려드린식은 진입횟수를 이용해서 매수진입후 aa%*1, aa%*2, aa%*3,....과 같은 내용으로
진입하고 직전 진입에서 계산된 값에서 BB%하락하면 청산하게 작성했습니다.
해당식 외에 다른 방법은 없습니다.
ver 1-1
input : AA(0.1),BB(0.1),N(10);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if dayindex == 0 Then
var1 = c;
if MarketPosition == 0 and count == 0 Then
{
if crossup(c,var1*(1+AA/100)) Then
{
buy("b",OnClose,def,1);
}
if CrossDown(c,var1*(1-AA/100)) Then
{
sell("s",OnClose,def,1);
}
}
if MarketPosition == 0 and count > 0 Then
{
if crossup(c,ExitPrice(1)*(1+AA/100)) Then
{
buy("b2",OnClose,def,1);
}
if CrossDown(c,ExitPrice(1)*(1-AA/100)) Then
{
sell("s2",OnClose,def,1);
}
}
if MarketPosition == 1 and CurrentEntries < N Then
{
buy("bb",AtStop,EntryPrice*(1+((AA*CurrentEntries)/100)),1);
ExitLong("bx",AtStop,EntryPrice*(1+((AA*(CurrentEntries-1))/100))*(1-BB/100),"",iff(CurrentContracts >= 2,2,1),1);
}
if MarketPosition == -1 and CurrentEntries < N Then
{
sell("ss",AtStop,EntryPrice*(1-((AA*CurrentEntries)/100)),1);
ExitShort("sx",AtStop,EntryPrice*(1-((AA*(CurrentEntries-1))/100))*(1+BB/100),"",iff(CurrentContracts >= 2,2,1),1);
}
ver 1-2
input : AA(0.1),BB(0.1),N(10);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if dayindex == 0 Then
var1 = c;
if MarketPosition == 0 and count == 0 Then
{
if CrossDown(c,var1*(1-AA/100)) Then
{
sell("s",OnClose,def,1);
}
}
if MarketPosition == 0 and count > 0 Then
{
if CrossDown(c,ExitPrice(1)*(1-AA/100)) Then
{
sell("s2",OnClose,def,1);
}
}
if MarketPosition == -1 and CurrentEntries < N Then
{
sell("ss",AtStop,EntryPrice*(1-((AA*CurrentEntries)/100)),1);
ExitShort("sx",AtStop,EntryPrice*(1-((AA*(CurrentEntries-1))/100))*(1+BB/100),"",iff(CurrentContracts >= 2,2,1),1);
}
ver2-1
input : AA(0.1),BB(0.1),N(10);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if dayindex == 0 Then
var1 = c;
if MarketPosition == 0 and count == 0 Then
{
if crossup(c,daylow*(1+AA/100)) Then
{
buy("b",OnClose,def,1);
}
if CrossDown(c,dayhigh*(1-AA/100)) Then
{
sell("s",OnClose,def,1);
}
}
if MarketPosition == 0 and count > 0 Then
{
if crossup(c,lowest(L,BarsSinceExit(1))*(1+AA/100)) Then
{
buy("b2",OnClose,def,1);
}
if CrossDown(c,highest(H,BarsSinceExit(1))*(1-AA/100)) Then
{
sell("s2",OnClose,def,1);
}
}
if MarketPosition == 1 and CurrentEntries < N Then
{
buy("bb",AtStop,EntryPrice*(1+((AA*CurrentEntries)/100)),1);
ExitLong("bx",AtStop,EntryPrice*(1+((AA*(CurrentEntries-1))/100))*(1-BB/100),"",iff(CurrentContracts >= 2,2,1),1);
}
if MarketPosition == -1 and CurrentEntries < N Then
{
sell("ss",AtStop,EntryPrice*(1-((AA*CurrentEntries)/100)),1);
ExitShort("sx",AtStop,EntryPrice*(1-((AA*(CurrentEntries-1))/100))*(1+BB/100),"",iff(CurrentContracts >= 2,2,1),1);
}
ver 2-2
input : AA(0.1),BB(0.1),N(10);
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if dayindex == 0 Then
var1 = c;
if MarketPosition == 0 and count == 0 Then
{
if CrossDown(c,dayhigh*(1-AA/100)) Then
{
sell("s",OnClose,def,1);
}
}
if MarketPosition == 0 and count > 0 Then
{
if CrossDown(c,highest(H,BarsSinceExit(1))*(1-AA/100)) Then
{
sell("s2",OnClose,def,1);
}
}
if MarketPosition == -1 and CurrentEntries < N Then
{
sell("ss",AtStop,EntryPrice*(1-((AA*CurrentEntries)/100)),1);
ExitShort("sx",AtStop,EntryPrice*(1-((AA*(CurrentEntries-1))/100))*(1+BB/100),"",iff(CurrentContracts >= 2,2,1),1);
}
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 시스템식 문의
> 감사합니다.
다음글
이전글