커뮤니티
시스템식과 지표식 문의드립니다.
2013-04-29 22:40:45
196
글번호 62630
지난 20회거래중 15회이상 손실시에 한해 일정조간 하에서 진입하는 식을 아래와 같이 주셨습니다. 수고에 감사드립니다.
이번에는 약간 다른 각도에서 질문을 드립니다.
1. 우선 시스템식을 부탁드립니다.
틱봉그래프의 Data2에 분봉그래프를 놓구요,
하루 1회 거래조건에 다음과 같은 조건의 거래를 하고자 합니다.
(A>B and Data2(C>D)) 또는 (E>F and Data2(G>H))이면 매수
(A>B and Data2(C<D)) 또는 (E>F and Data2(G<H))이면 매수청산
(A<B and Data2(C<D)) 또는 (E<F and Data2(G<H))이면 매도
(A<B and Data2(C>D)) 또는 (E<F and Data2(G>H))이면 매도청산
익절(목표)2포인트
손절1포인트
3시4분무조건청산
Data2와 관련된 내용을 위처럼 전체괄호로 묶어 표현해도 되는 것인지,
아니면 Data2(C)>Data2(D)처럼 각각 풀어서 표현해야 하는 것인지 어느 것이 옳은지 모르겠습니다.
2. 아래의 내용을 보조지표로 만들어 선그래프로 나타내고 싶습니다.
지표식은 어떻게 작성해야 하는지요.
"위의 거래를 진행시켰을 때 나타나는 최종 15번의 거래중 이익이 발생한 횟수"
3. 위1번의 경우에 진입은 2개씩. 청산과 손절은 한꺼번에, 익절은 2P와 3P에 각각 하나씩 하고 싶다면 어떻게 적어야 하나요?
4. 위 1번의 경우에 거래를 1일1회로 한정하지 않되, 청산신호에 의한 일반청산의 경우에는 동일방향 연속진입을 허용하고, 익절(목표달성)직후와 손절(스탑로스)직후만은 당일 동일방향 연속진입을 금지시키려면 어떻게 식을 작성해야 하는지요.
5. 일목균형표에서 전환선>기준선이면 두 선 사이를 빨강색으로,
전환선<기준선이면 파랑색으로 칠할 수 있는지요.
var:cnt(0),count(0),loss(0);
count=0;
loss = 0;
for cnt=0 to 20{
if sdate==Entrydate(cnt) Then
count=count+1;
if cnt >= 1 Then{
if PositionProfit(cnt) < 0 Then
loss = loss+1;
}
}
if TotalTrades < 20 Then{
If count==0 or (count>=1 and MarketPosition==-1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==-1) Then{
If (A>B and C<D) or (E>F and G<H) Then
buy();
}
If count==0 or (count>=1 and MarketPosition==1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==1) Then{
If (A<B and C>D) or (E<F and G>H) Then
Sell();
}
}
if TotalTrades > 20 and loss >= 15 Then{
If count==0 or (count>=1 and MarketPosition==-1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==-1) Then{
If (A>B and C<D) or (E>F and G<H) Then
buy();
}
If count==0 or (count>=1 and MarketPosition==1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==1) Then{
If (A<B and C>D) or (E<F and G>H) Then
Sell();
}
}
SetstopProfittarget(1.5,PointStop);
답변 1
예스스탁 예스스탁 답변
2013-04-30 14:15:26
안녕하세요
예스스탁입니다.
1.
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if count == 0 then{
if (A>B and Data2(C>D)) or (E>F and Data2(G>H)) Then
buy();
if (A<B and Data2(C<D)) or (E<F and Data2(G<H)) Then
sell();
}
if (A>B and Data2(C<D)) or (E>F and Data2(G<H)) then
ExitLong();
if (A<B and Data2(C>D)) or (E<F and Data2(G>H)) Then
ExitShort();
SetStopProfittarget(2,PointStop);
SetStopLoss(1,PointStop);
SetStopEndofday(150400);
참조데이터에 대한 조건은 data2(C > D)과 같이 작성하셔도 되고
data2(C) > data2(D)와 같이 작성하셔도 같은 내용입니다.
2.
시스템식에는 지표출력함수를 이용할수가 없습니다.
해당부분은 시스템식 내요에서 messagelog함수를 이용해 디버깅창으로 확인해 보셔야 합니다.
var : cnt(0),count(0),proiftcnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if count == 0 then{
if (A>B and Data2(C>D)) or (E>F and Data2(G>H)) Then
buy();
if (A<B and Data2(C<D)) or (E<F and Data2(G<H)) Then
sell();
}
if (A>B and Data2(C<D)) or (E>F and Data2(G<H)) then
ExitLong();
if (A<B and Data2(C>D)) or (E<F and Data2(G>H)) Then
ExitShort();
SetStopProfittarget(2,PointStop);
SetStopLoss(1,PointStop);
SetStopEndofday(150400);
proiftcnt = 0;
for cnt = 1 to 15{
if PositionProfit(cnt) > 0 Then
proiftcnt = proiftcnt+1;
}
MessageLog("%,f",proiftcnt);
3.
var : cnt(0),count(0),proiftcnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if count == 0 then{
if (A>B and Data2(C>D)) or (E>F and Data2(G>H)) Then
buy("b",OnClose,def,2);
if (A<B and Data2(C<D)) or (E<F and Data2(G<H)) Then
sell("s",OnClose,def,2);
}
if (A>B and Data2(C<D)) or (E>F and Data2(G<H)) then
ExitLong();
if (A<B and Data2(C>D)) or (E<F and Data2(G>H)) Then
ExitShort();
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+2,"",1,1);
if CurrentContracts < MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+3,"",1,1);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-2,"",1,1);
if CurrentContracts < MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-3,"",1,1);
}
SetStopLoss(1,PointStop);
SetStopEndofday(150400);
proiftcnt = 0;
for cnt = 1 to 15{
if PositionProfit(cnt) > 0 Then
proiftcnt = proiftcnt+1;
}
MessageLog("%,f",proiftcnt);
4.
var : cnt(0),count(0),proiftcnt(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
#첫진입
if count == 0 then{
if (A>B and Data2(C>D)) or (E>F and Data2(G>H)) Then
buy("b",OnClose,def,2);
if (A<B and Data2(C<D)) or (E<F and Data2(G<H)) Then
sell("s",OnClose,def,2);
}
Condition1 = MarketPosition == 0 AND ExitDate(1) == sdate and MarketPosition(1) == 1 AND (IsExitName("StopLoss",1) or IsExitName("StopProfittarget",1));
Condition2 = MarketPosition == 0 AND ExitDate(1) == sdate and MarketPosition(1) == -1 AND (IsExitName("StopLoss",1) or IsExitName("StopProfittarget",1));
#두번째 진입부터
if count >= 1 then{
if Condition1 == false and ((A>B and Data2(C>D)) or (E>F and Data2(G>H))) Then
buy("b",OnClose,def,2);
if Condition2 == false and ((A<B and Data2(C<D)) or (E<F and Data2(G<H))) Then
sell("s",OnClose,def,2);
}
if (A>B and Data2(C<D)) or (E>F and Data2(G<H)) then
ExitLong();
if (A<B and Data2(C>D)) or (E<F and Data2(G>H)) Then
ExitShort();
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+2,"",1,1);
if CurrentContracts < MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+3,"",1,1);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-2,"",1,1);
if CurrentContracts < MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-3,"",1,1);
}
SetStopLoss(1,PointStop);
SetStopEndofday(150400);
proiftcnt = 0;
for cnt = 1 to 15{
if PositionProfit(cnt) > 0 Then
proiftcnt = proiftcnt+1;
}
MessageLog("%,f",proiftcnt);
5.
채우기 기능은 수식안에서는 가능하지 않고
지표속성창에서 직접 설정하셔야 합니다.
일목균형표의 지표속성화면을 여신후에
차트표시탭에서 채우기 기능 이용하시면 됩니다.
즐거운 하루되세요
> 묘선낭자 님이 쓴 글입니다.
> 제목 : 시스템식과 지표식 문의드립니다.
> 지난 20회거래중 15회이상 손실시에 한해 일정조간 하에서 진입하는 식을 아래와 같이 주셨습니다. 수고에 감사드립니다.
이번에는 약간 다른 각도에서 질문을 드립니다.
1. 우선 시스템식을 부탁드립니다.
틱봉그래프의 Data2에 분봉그래프를 놓구요,
하루 1회 거래조건에 다음과 같은 조건의 거래를 하고자 합니다.
(A>B and Data2(C>D)) 또는 (E>F and Data2(G>H))이면 매수
(A>B and Data2(C<D)) 또는 (E>F and Data2(G<H))이면 매수청산
(A<B and Data2(C<D)) 또는 (E<F and Data2(G<H))이면 매도
(A<B and Data2(C>D)) 또는 (E<F and Data2(G>H))이면 매도청산
익절(목표)2포인트
손절1포인트
3시4분무조건청산
Data2와 관련된 내용을 위처럼 전체괄호로 묶어 표현해도 되는 것인지,
아니면 Data2(C)>Data2(D)처럼 각각 풀어서 표현해야 하는 것인지 어느 것이 옳은지 모르겠습니다.
2. 아래의 내용을 보조지표로 만들어 선그래프로 나타내고 싶습니다.
지표식은 어떻게 작성해야 하는지요.
"위의 거래를 진행시켰을 때 나타나는 최종 15번의 거래중 이익이 발생한 횟수"
3. 위1번의 경우에 진입은 2개씩. 청산과 손절은 한꺼번에, 익절은 2P와 3P에 각각 하나씩 하고 싶다면 어떻게 적어야 하나요?
4. 위 1번의 경우에 거래를 1일1회로 한정하지 않되, 청산신호에 의한 일반청산의 경우에는 동일방향 연속진입을 허용하고, 익절(목표달성)직후와 손절(스탑로스)직후만은 당일 동일방향 연속진입을 금지시키려면 어떻게 식을 작성해야 하는지요.
5. 일목균형표에서 전환선>기준선이면 두 선 사이를 빨강색으로,
전환선<기준선이면 파랑색으로 칠할 수 있는지요.
var:cnt(0),count(0),loss(0);
count=0;
loss = 0;
for cnt=0 to 20{
if sdate==Entrydate(cnt) Then
count=count+1;
if cnt >= 1 Then{
if PositionProfit(cnt) < 0 Then
loss = loss+1;
}
}
if TotalTrades < 20 Then{
If count==0 or (count>=1 and MarketPosition==-1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==-1) Then{
If (A>B and C<D) or (E>F and G<H) Then
buy();
}
If count==0 or (count>=1 and MarketPosition==1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==1) Then{
If (A<B and C>D) or (E<F and G>H) Then
Sell();
}
}
if TotalTrades > 20 and loss >= 15 Then{
If count==0 or (count>=1 and MarketPosition==-1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==-1) Then{
If (A>B and C<D) or (E>F and G<H) Then
buy();
}
If count==0 or (count>=1 and MarketPosition==1) or (count>=1 and MarketPosition==0 and MarketPosition(1)==1) Then{
If (A<B and C>D) or (E<F and G>H) Then
Sell();
}
}
SetstopProfittarget(1.5,PointStop);