커뮤니티

수식문의드립니다

프로필 이미지
짜왕
2022-02-25 13:52:01
917
글번호 156752
답변완료
아래 조건의 수식을 5분봉 차트에서 사용하고있었다면 1분봉 차트에서 5분봉의 아래와같은 수식의 데이터를 불러오고 싶습니다 예를들어 1분봉 차트에서 5분봉차트 N개의 캔들의 고점을 돌파시 진입 1분봉 차트에서 5분봉차트 N개의 캔들의 저점을 돌파시 진입 과 같은 함수를 만들고싶습니다 input : Period(1); Vars: HH(0), LL(0) ,center(0), LongCondition(False),ShortCondition(False),ExitLongConditon(False), ExitShortCondition(False); HH = Highest(high, Period); LL = Lowest(low, Period); center= (HH+LL)/2 ; If MarketPosition <= 0 and C < HH Then Begin Buy("매수",AtStop,HH); End; If MarketPosition == 1 and C > center Then Begin ExitLong("매수청산",AtStop,center); End; If MarketPosition >= 0 and C > LL Then Begin Sell("매도",AtStop,LL); End; If MarketPosition == -1 and C < center Then Begin ExitShort("매도청산",AtStop,center); End;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-02-25 14:07:04

안녕하세요 예스스탁입니다. input : ntime(5),Period(1); Vars: HH(0), LL(0) ,center(0), LongCondition(False),ShortCondition(False),ExitLongConditon(False), ExitShortCondition(False); var : S1(0),D1(0),TM(0),TF(0),cnt(0); Array : tH[100](0),tL[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 { tH[0] = H; tL[0] = L; For cnt = 1 to 99 { tH[cnt] = tH[cnt-1][1]; tL[cnt] = tL[cnt-1][1]; } } if tH[0] > 0 and H > tH[0] Then tH[0] = H; if tL[0] > 0 and L < tL[0] Then tL[0] = L; if tH[Period] > 0 and tL[Period] > 0 Then { HH = 0; LL = 0; For cnt = 1 to Period { if HH == 0 or (HH > 0 and tH[cnt] > HH) Then HH = tH[cnt]; if LL == 0 or (LL > 0 and tL[cnt] < LL) Then LL = tL[cnt]; } center= (HH+LL)/2 ; If MarketPosition <= 0 and C < HH Then Begin Buy("매수",AtStop,HH); End; If MarketPosition == 1 and C > center Then Begin ExitLong("매수청산",AtStop,center); End; If MarketPosition >= 0 and C > LL Then Begin Sell("매도",AtStop,LL); End; If MarketPosition == -1 and C < center Then Begin ExitShort("매도청산",AtStop,center); End; } } 즐거운 하루되세요 > 짜왕 님이 쓴 글입니다. > 제목 : 수식문의드립니다 > 아래 조건의 수식을 5분봉 차트에서 사용하고있었다면 1분봉 차트에서 5분봉의 아래와같은 수식의 데이터를 불러오고 싶습니다 예를들어 1분봉 차트에서 5분봉차트 N개의 캔들의 고점을 돌파시 진입 1분봉 차트에서 5분봉차트 N개의 캔들의 저점을 돌파시 진입 과 같은 함수를 만들고싶습니다 input : Period(1); Vars: HH(0), LL(0) ,center(0), LongCondition(False),ShortCondition(False),ExitLongConditon(False), ExitShortCondition(False); HH = Highest(high, Period); LL = Lowest(low, Period); center= (HH+LL)/2 ; If MarketPosition <= 0 and C < HH Then Begin Buy("매수",AtStop,HH); End; If MarketPosition == 1 and C > center Then Begin ExitLong("매수청산",AtStop,center); End; If MarketPosition >= 0 and C > LL Then Begin Sell("매도",AtStop,LL); End; If MarketPosition == -1 and C < center Then Begin ExitShort("매도청산",AtStop,center); End;