커뮤니티

인트라 시스템 추가진입 여부 체크

프로필 이미지
회원
2005-01-17 15:09:57
1537
글번호 6346
답변완료
안녕하세요 추운 날씨에 고생이 많으십니다. 코딩 질문을 하려고 하는데요... 인트라 시스템에서 당일 첫번째 진입에 의해 수익을 났을 경우엔 추가진입이 없고 1. 손실이 났을 경우엔 추가진입을 할 수 있다 2. 손실이 났을 경우 첫번째 진입의 반대방향으로만 진입할 수 있다 2가지 경우로 나누어서 코딩 부탁드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2005-01-20 15:10:47

안녕하세요 예스스탁입니다. 문의하신 식은 다음과 같습니다. 1. Input : shortPeriod(12), longPeriod(26), Period(9); Var : Point(0),position1(0),position2(0),Profit(0),value(0), macdosc(0),Bpoint(0),Spoint(0),pos(0),pos1(0),Bpos(0),Spos(0),cnt(0); value = MACD(shortPeriod, longPeriod); macdosc = ema(value,Period); if date != date[1] then{ cnt = 0; position1 = 0; position2 = 0; Profit = 0; } if marketposition() == 0 and stime < 150000 then{ if crossup(c,ma(c,20)) and cnt < 1 then{ buy("첫매수"); cnt = cnt+1; position1 = 1; } } if marketposition() == 0 and stime < 150000 then{ if crossdown(c,ma(c,20)) and cnt < 1 then{ sell("첫매도"); cnt = cnt+1; position1= 1; } } if marketposition() == 0 and stime < 150000 then{ if crossup(c,ma(c,20)) and cnt == 1 and Profit < 1 then{ buy("매수"); position2 = 1; } } if marketposition() == 0 and stime < 150000 then{ if crossdown(c,ma(c,20)) and cnt == 1 and Profit < 1 then{ sell("매도"); position2 = 1; } } if marketposition() == 1 and position1 == 1 then{ if crossdown(value,macdosc) then{ exitlong("첫매수청산"); position1 = 0; point = C - entryprice(); if point > 0 then Profit = 1; } } if marketposition() == -1 and position1 == 1 then{ if crossup(value,macdosc) then{ exitshort("첫매도청산"); position1 = 0; point = entryprice() - C ; if point > 0 then Profit = 1; } } if marketposition() == 1 and position2 == 1 then{ if crossdown(value,macdosc) then{ exitlong("매수청산"); } } if marketposition() == -1 and position2 == 1 then{ if crossup(value,macdosc) then{ exitshort("매도청산"); } } if stime == 150000 then{ exitlong(); exitshort(); } 2. Input : shortPeriod(12), longPeriod(26), Period(9); Var : Point(0),position1(0),position2(0),Profit(0),value(0), macdosc(0),Bpoint(0),Spoint(0),pos(0),pos1(0),Bpos(0),Spos(0),cnt(0); value = MACD(shortPeriod, longPeriod); macdosc = ema(value,Period); if date != date[1] then{ cnt = 0; position1 = 0; position2 = 0; Profit = 0; Bpos = 0; Spos = 0; } if marketposition() == 0 and stime < 150000 then{ if crossup(c,ma(c,20)) and cnt < 1 then{ buy("첫매수"); cnt = cnt+1; position1 = 1; } } if marketposition() == 0 and stime < 150000 then{ if crossdown(c,ma(c,20)) and cnt < 1 then{ sell("첫매도"); cnt = cnt+1; position1= 1; } } if marketposition() == 0 and stime < 150000 then{ if crossup(c,ma(c,20)) and cnt == 1 and Profit < 1 and Bpos == 0 then{ buy("매수"); position2 = 1; } } if marketposition() == 0 and stime < 150000 then{ if crossdown(c,ma(c,20)) and cnt == 1 and Profit < 1 and Spos == 0 then{ sell("매도"); position2 = 1; } } if marketposition() == 1 and position1 == 1 then{ if crossdown(value,macdosc) then{ exitlong("첫매수청산"); position1 = 0; Bpos = 1; point = C - entryprice(); if point > 0 then Profit = 1; } } if marketposition() == -1 and position1 == 1 then{ if crossup(value,macdosc) then{ exitshort("첫매도청산"); position1 = 0; Spos = 1; point = entryprice() - C ; if point > 0 then Profit = 1; } } if marketposition() == 1 and position2 == 1 then{ if crossdown(value,macdosc) then{ exitlong("매수청산"); } } if marketposition() == -1 and position2 == 1 then{ if crossup(value,macdosc) then{ exitshort("매도청산"); } } if stime == 150000 then{ exitlong(); exitshort(); } 즐거운 하루되세요 > 달려!! 님이 쓴 글입니다. > 제목 : 인트라 시스템 추가진입 여부 체크 > 안녕하세요 추운 날씨에 고생이 많으십니다. 코딩 질문을 하려고 하는데요... 인트라 시스템에서 당일 첫번째 진입에 의해 수익을 났을 경우엔 추가진입이 없고 1. 손실이 났을 경우엔 추가진입을 할 수 있다 2. 손실이 났을 경우 첫번째 진입의 반대방향으로만 진입할 수 있다 2가지 경우로 나누어서 코딩 부탁드립니다.