커뮤니티
문의드립니다.
2018-02-20 09:22:03
154
글번호 116720
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다.
1. 기타
코딩 문의드립니다.
당일 리버스진입을 생각해보니 경우의 수가 상당히 많더라구요. 아래 제 질문을 비롯해서 몇가지 것들 검색해서 정리해봤는데도 잘 이해는 가지 않습니다. PositionProfit(1) ( 직전거래 손익액이)0보다 크다로 이전 거래 손실인 지 이익인 지 나누는 건 알겠는데요. 직전 거래가 매수로 이익인 지 매도로 이익인지는 뭘로 나누는 지요.
매수 손익시
매수진입가능
매도진입가능
매수 손익시
매수진입불가
매도진입가능
매수 손익시
매수진입가능
매도진입불가
etc.....
/질문들
input : entryCount(2);
var : count(0),Bcond(false),Scond(false) ;
#진입회수제한
Count = 0 ;
for Value1 = 0 to 10 {
if EntryDate( Value1 ) == sdate then
Count = Count + 1;
}
Bcond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) > 0 and MarketPosition(1) == -1;
Scond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) > 0 and MarketPosition(1) == -1;
if Count < entryCount then {
if 매수조건 and Bcond == false Then
buy();
if 매도조건 and Scond == false Then
sell();
}
안녕하세요
예스스탁입니다.
var : Bcnt(0),Scnt(0),Bcond(false),Scond(False);
if Bdate != bdate[1] Then{
Bcnt = 0;
Scnt = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] Then
Bcnt = Bcnt+1;
if MarketPosition == -1 and MarketPosition != MarketPosition[1] Then
Scnt = Scnt+1;
Bcond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) < 0 and MarketPosition(1) == -1;
Scond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) < 0 and MarketPosition(1) == -1;
if 매수조건 and Bcnt < 2 and Bcond == false Then
buy();
if 매도조건 and Scnt < 2 and Scond == false Then
sell();
/
답변 1
예스스탁 예스스탁 답변
2018-02-20 14:35:40
안녕하세요
예스스탁입니다.
MarketPosition이 포지션 상태를 리턴해주는 함수입니다.
MarketPosition 혹은 MarketPosition(0)은 현재 진행중 거래
MarketPosition(1)이 직전 거래
MarketPosition(1)이 전전 거래..순입니다.
아래와 같이 작성하시면
현재가 무포지션이면 직전거래, 거래중이면 리버스 진입대비 현재 포지션 기준으로
매수 포지션이고 수익이면 2, 매수포지션이고 손실이면 1,
매도 포지션이고 수익이면 -2, 매도 포지션이고 손실이면 -1
가 변수 S에 저장됩니다.
진입불가는 따로 지정할 필요가 없습니다.
수식은 if조건이 만족할때만 진입하므로
진입if 문에 S == 1 or S == 2와 같이 or로 조건 추가하시면 됩니다.
var : S(0);
S = 0;
if MarketPosition == 0 Then{
if ExitDate(1) == sdate and MarketPosition(1) == 1 Then{
if PositionProfit(1) > 0 then
S = 2;
Else
S = 1;
}
if ExitDate(1) == sdate and MarketPosition(1) == -1 Then{
if PositionProfit(1) > 0 Then
S = 2;
Else
S = -2;
}
}
Else{#포지션 진행중
if MarketPosition(0) == 1 Then{
if PositionProfit(0) > 0 then
S = 1;
Else
S = -1;
}
if MarketPosition(0) == -1 Then{
if PositionProfit(0) > 0 Then
S = 2;
Else
S = -2;
}
}
즐거운 하루되세요
> 잡다백수 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다.
1. 기타
코딩 문의드립니다.
당일 리버스진입을 생각해보니 경우의 수가 상당히 많더라구요. 아래 제 질문을 비롯해서 몇가지 것들 검색해서 정리해봤는데도 잘 이해는 가지 않습니다. PositionProfit(1) ( 직전거래 손익액이)0보다 크다로 이전 거래 손실인 지 이익인 지 나누는 건 알겠는데요. 직전 거래가 매수로 이익인 지 매도로 이익인지는 뭘로 나누는 지요.
매수 손익시
매수진입가능
매도진입가능
매수 손익시
매수진입불가
매도진입가능
매수 손익시
매수진입가능
매도진입불가
etc.....
/질문들
input : entryCount(2);
var : count(0),Bcond(false),Scond(false) ;
#진입회수제한
Count = 0 ;
for Value1 = 0 to 10 {
if EntryDate( Value1 ) == sdate then
Count = Count + 1;
}
Bcond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) > 0 and MarketPosition(1) == -1;
Scond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) > 0 and MarketPosition(1) == -1;
if Count < entryCount then {
if 매수조건 and Bcond == false Then
buy();
if 매도조건 and Scond == false Then
sell();
}
안녕하세요
예스스탁입니다.
var : Bcnt(0),Scnt(0),Bcond(false),Scond(False);
if Bdate != bdate[1] Then{
Bcnt = 0;
Scnt = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] Then
Bcnt = Bcnt+1;
if MarketPosition == -1 and MarketPosition != MarketPosition[1] Then
Scnt = Scnt+1;
Bcond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) < 0 and MarketPosition(1) == -1;
Scond = MarketPosition == 0 and ExitDate(1) == sdate and PositionProfit(1) < 0 and MarketPosition(1) == -1;
if 매수조건 and Bcnt < 2 and Bcond == false Then
buy();
if 매도조건 and Scnt < 2 and Scond == false Then
sell();
/
다음글
이전글