커뮤니티

함수요청

프로필 이미지
흰둥이아빠
2022-01-17 16:04:44
857
글번호 155525
답변완료
안녕하세요? 답변주신 아래 글번호 75497번을 매매에 응용하고 싶습니다. 국내 선물 3분봉으로 매매를 하되 - 현주가 > 전일주가이며, 현주가 > 20ma(주가) 이고, 누적미결제약정 > 60ma(누적미결제약정)이면 익봉시가에 매수 진입 - 매수 진입 이후 현주가 < 20ma(주가)이고, 누적미결제약정 < 60ma(누적미결제약정)이면 익봉시가에 매수청산 - 현주가 < 전일주가이며, 현주가 < 20ma(주가) 이고, 누적미결제약정 > 60ma(누적미결제약정)이면 익봉시가에 매도 - 매도 진입 이후 현주가 > 20ma(주가) 이고, 누적미결제약정 < 60ma(누적미결제약정)이면 익봉시가에 매도청산 - 15시 15분 모든 포지션 강제청산 - 당일 첫봉에서 진입신호가 발생되면 익봉부터 신호를 생성하고자 합니다. - 진입기준으로 매매횟수를 최대 2회로 하고자 합니다. ==================================================================================== input : ntime(60),P(60); var : S1(0),D1(0),TM(0),TF(0),cnt(0); var : sum1(0),mav1(0); Array : CC[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { for cnt = 1 to 99 { CC[cnt] = CC[cnt-1][1]; } } CC[0] = OI; if CC[P-1] > 0 then { sum1 = 0; for cnt = 0 to P-1 { sum1 = sum1+CC[cnt]; } mav1 = sum1/P; plot1(mav1,"이평1"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-01-18 13:57:46

안녕하세요 예스스탁입니다. input : ntime(60),P1(20),P2(60),N(2); var : S1(0),D1(0),TM(0),TF(0),cnt(0); var : sum1(0),mav1(0),sum2(0),mav2(0),entry(0); Array : CC[100](0),OT[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { for cnt = 1 to 99 { CC[cnt] = CC[cnt-1][1]; OT[cnt] = OT[cnt-1][1]; } } CC[0] = C; OT[0] = OI; if CC[P1-1] > 0 then { sum1 = 0; for cnt = 0 to P1-1 { sum1 = sum1+CC[cnt]; } mav1 = sum1/P1; } if OT[P2-1] > 0 then { sum2 = 0; for cnt = 0 to P2-1 { sum2 = sum2+CC[cnt]; } mav2 = sum2/P2; } if mav1 > 0 and mav2 > 0 Then { if Bdate == Bdate[1] and MarketPosition <= 0 and C > DayClose(1) and C > mav1 and OI < mav2 and entry < N Then Buy("b",AtMarket); if MarketPosition == 1 and C < mav1 and OI < mav2 Then ExitLong("bx",AtMarket); if Bdate == Bdate[1] and MarketPosition >= 0 and C < DayClose(1) and C > mav1 and OI > mav2 and entry < N Then Sell("s",AtMarket); if MarketPosition == 1 and C > mav1 and OI < mav2 Then ExitShort("sx",AtMarket); } } SetStopEndofday(151500); 즐거운 하루되세요 > 흰둥이아빠 님이 쓴 글입니다. > 제목 : 함수요청 > 안녕하세요? 답변주신 아래 글번호 75497번을 매매에 응용하고 싶습니다. 국내 선물 3분봉으로 매매를 하되 - 현주가 > 전일주가이며, 현주가 > 20ma(주가) 이고, 누적미결제약정 > 60ma(누적미결제약정)이면 익봉시가에 매수 진입 - 매수 진입 이후 현주가 < 20ma(주가)이고, 누적미결제약정 < 60ma(누적미결제약정)이면 익봉시가에 매수청산 - 현주가 < 전일주가이며, 현주가 < 20ma(주가) 이고, 누적미결제약정 > 60ma(누적미결제약정)이면 익봉시가에 매도 - 매도 진입 이후 현주가 > 20ma(주가) 이고, 누적미결제약정 < 60ma(누적미결제약정)이면 익봉시가에 매도청산 - 15시 15분 모든 포지션 강제청산 - 당일 첫봉에서 진입신호가 발생되면 익봉부터 신호를 생성하고자 합니다. - 진입기준으로 매매횟수를 최대 2회로 하고자 합니다. ==================================================================================== input : ntime(60),P(60); var : S1(0),D1(0),TM(0),TF(0),cnt(0); var : sum1(0),mav1(0); Array : CC[100](0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { for cnt = 1 to 99 { CC[cnt] = CC[cnt-1][1]; } } CC[0] = OI; if CC[P-1] > 0 then { sum1 = 0; for cnt = 0 to P-1 { sum1 = sum1+CC[cnt]; } mav1 = sum1/P; plot1(mav1,"이평1"); } }