커뮤니티

매수식 수정을 부탁드립니다

프로필 이미지
짙은안개
2017-12-17 07:57:15
159
글번호 115043
답변완료
안녕하세요? 친절한 답변에 감사드립니다. 분봉을 이용해서 당일매수,당일청산하는 매매를 하는 아래식에서 어제 종가보다 5퍼센트 이상 상승해서 장이 시작되는 경우에는 플러스값이던 macd oscillatorr값이 마이너스 값으로 된 다음부터 거래가 되는 식으로 만들고자 합니다 항상 행복하세요!! Input : shortPeriod(5), longPeriod(20); Input : 시작시간(090010),종료시간(151000); value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Xcond = false; idx = 0; } if (sdate != sdate[1] and stime >= 종료시간) or (sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } # 매수/매도청산 If CrossUP(value1, value2) Then { Buy(); } # 매도/매수청산 If CrossDown(value1, value2) Then { Sell(); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-12-18 15:57:27

안녕하세요 예스스탁입니다. Input : shortPeriod(5), longPeriod(20); Input : 시작시간(090010),종료시간(151000); Input : short(12), long(26),signal(9); var : Tcond(false),XCond(false),idx(0); Var : MACDv(0), MACDs(0),macdosc(0) ; value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); MACDv = MACD(short, long); MACDs = ema(MACDv,signal); macdosc = MACDv-MACDs; if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{ Xcond = false; idx = 0; Tcond = true; if dayopen >= DayClose(1)*1.05 Then Tcond = false; } if macdosc < 0 Then Tcond = true; if (sdate != sdate[1] and stime >= 종료시간) or (sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } if Tcond == true then{ If CrossUP(value1, value2) Then { Buy(); } If CrossDown(value1, value2) Then { Sell(); } } 즐거운 하루되세요 > 짙은안개 님이 쓴 글입니다. > 제목 : 매수식 수정을 부탁드립니다 > 안녕하세요? 친절한 답변에 감사드립니다. 분봉을 이용해서 당일매수,당일청산하는 매매를 하는 아래식에서 어제 종가보다 5퍼센트 이상 상승해서 장이 시작되는 경우에는 플러스값이던 macd oscillatorr값이 마이너스 값으로 된 다음부터 거래가 되는 식으로 만들고자 합니다 항상 행복하세요!! Input : shortPeriod(5), longPeriod(20); Input : 시작시간(090010),종료시간(151000); value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Xcond = false; idx = 0; } if (sdate != sdate[1] and stime >= 종료시간) or (sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } # 매수/매도청산 If CrossUP(value1, value2) Then { Buy(); } # 매도/매수청산 If CrossDown(value1, value2) Then { Sell(); }