커뮤니티

이평 돌파후 2번째MACD크로스에서진입식 문의

프로필 이미지
변동성
2009-04-19 05:04:15
949
글번호 21769
답변완료
수고 많으십니다. 빠른 회신에 감사드립니다. 문의 가 있는데요 하다가 신호가 안나와서 여쭤봅니다. 아래식은 특정 이평 돌파후 MACD와 시그널선의 크로스로 진입하는 식인데요, 첫번째가 나이라 두번째 크로스일때 진입하려고 하려고 하는데 신호가 안나옵니다. 무엇인문제인지 알려주시면 대단히 감사하겠습니다. Input : Period3(9),shortPeriod(12), longPeriod(26); Variables:value(0),Value1(0); value = MACD(shortPeriod, longPeriod); value1 = ema(value, Period3); # 매수/매도청산 if MarketPosition() == 0 Then{ if ma(c,10) > ma(c,360)and dayindex() > 0 then { if Crossup(Value,Value1) and accumn(iff(Crossup(value,Value1),1,0),BarsSinceEntry()) ==2 Then buy("매수"); } } if MarketPosition() == 1 Then{ if CrossDown(Value,Value1) then { exitlong("B청산"); } } # 매도/매수청산 if MarketPosition() == 0 Then if ma(c,10) < ma(c,360) then { if CrossDown(Value,Value1) and accumn(iff(CrossDown(value,Value1),1,0),BarsSinceEntry()) ==2 Then sell("매도"); } if MarketPosition() == -1 Then{ if CrossUp(Value,Value1)then exitshort("s청산"); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2009-04-20 09:39:09

안녕하세요 예스스탁입니다. BarsSinceEntry는 진입이후의 봉갯수를 카운트 하는 식입니다. 무포지션 상태에서는 항상 0값을 가지므로 0봉동안 상향하향돌파가 2번일어나면 매수와 매도를 하므로 조건이 맞지 않습니다. 식을 수정했습니다. 당일 첫번째 진입은 첫봉부터 카운트하여 2번 골드나 데드가 발생시 진입하며 두번째 진입부터는 청산후의 봉을 카운트하여 2번 골드나 데드시에 진입합니다. 참고하시기 바랍니다. Input : Period3(9),shortPeriod(12), longPeriod(26); Variables:value(0),Value1(0),cnt(0),count(0); count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } value = MACD(shortPeriod, longPeriod); value1 = ema(value, Period3); if MarketPosition() == 0 and count == 0 Then{ if ma(c,10) > ma(c,360)and dayindex() > 0 then { if Crossup(Value,Value1) and accumn(iff(Crossup(value,Value1),1,0),dayindex+1) ==2 Then buy("매수"); } if ma(c,10) < ma(c,360) then { if CrossDown(Value,Value1) and accumn(iff(CrossDown(value,Value1),1,0),DayIndex+1) ==2 Then sell("매도"); } } if MarketPosition() == 0 and count > 0 Then{ if ma(c,10) > ma(c,360)and dayindex() > 0 then { if Crossup(Value,Value1) and accumn(iff(Crossup(value,Value1),1,0),BarsSinceExit(1)) ==2 Then buy("매수."); } if ma(c,10) < ma(c,360) then { if CrossDown(Value,Value1) and accumn(iff(CrossDown(value,Value1),1,0),BarsSinceExit(1)) ==2 Then sell("매도."); } } if MarketPosition() == 1 Then{ if CrossDown(Value,Value1) then exitlong("B청산"); } if MarketPosition() == -1 Then{ if CrossUp(Value,Value1)then exitshort("s청산"); } > 변동성 님이 쓴 글입니다. > 제목 : 이평 돌파후 2번째MACD크로스에서진입식 문의 > 수고 많으십니다. 빠른 회신에 감사드립니다. 문의 가 있는데요 하다가 신호가 안나와서 여쭤봅니다. 아래식은 특정 이평 돌파후 MACD와 시그널선의 크로스로 진입하는 식인데요, 첫번째가 나이라 두번째 크로스일때 진입하려고 하려고 하는데 신호가 안나옵니다. 무엇인문제인지 알려주시면 대단히 감사하겠습니다. Input : Period3(9),shortPeriod(12), longPeriod(26); Variables:value(0),Value1(0); value = MACD(shortPeriod, longPeriod); value1 = ema(value, Period3); # 매수/매도청산 if MarketPosition() == 0 Then{ if ma(c,10) > ma(c,360)and dayindex() > 0 then { if Crossup(Value,Value1) and accumn(iff(Crossup(value,Value1),1,0),BarsSinceEntry()) ==2 Then buy("매수"); } } if MarketPosition() == 1 Then{ if CrossDown(Value,Value1) then { exitlong("B청산"); } } # 매도/매수청산 if MarketPosition() == 0 Then if ma(c,10) < ma(c,360) then { if CrossDown(Value,Value1) and accumn(iff(CrossDown(value,Value1),1,0),BarsSinceEntry()) ==2 Then sell("매도"); } if MarketPosition() == -1 Then{ if CrossUp(Value,Value1)then exitshort("s청산"); }