커뮤니티

지표 변환

프로필 이미지
jdavid
2023-11-09 13:30:35
766
글번호 173875
답변완료
감사합니다. 아래 지표를 변환하고 싶습니다. 1. 일봉지표를 분봉지표로 변환 2. 분봉지표를 타분봉지표로 변환 Var:A(0),B(0),cnt(0),direction(0); Array: AA[100](0),BB[100](0); If Index == 0 Then { A=H[0]; B=L[0]; Direction = 0; } //1번조건 if direction <= 0 and H[0] > H[1] and L >= L[1] then { A = H[0]; direction = 1; } //2번조건 If direction >= 0 and L[0] < L[1] and H <= H[1] Then { B = L[0]; direction = -1; } //3번조건 if countif(Direction == -1,2) == 2 and H[0] > H[1] then { BB[0] = B; direction = -2; } //4번조건 If countif(Direction == 1,2) == 2 and L[0] < L[1] Then { AA[0] = A; direction = 2; } Plot1(A); 3. 날짜와 시간표시. 예를 들어 5이평이 20이평을 돌파했을 때의 날짜와 시간을 표시하고 싶습니다. 이미 발생된 날짜와 시간은 지우지 않고 다음 신호 발생시 다시 날짜와 시간 표시. 4. 시스템에서 매수신호가 발생했을 때 종가의 +2% 가격과 수평선 표시. -2%가격과 수평선 표시. 예) 5이평이 20이평을 돌파했을 때의 종가를 매수신호라고 한다면 종가의 +2% 가격과 수평선 표시. -2%가격과 수평선을 표시. 현재가가 +2%.-2%가격을 터치하면 수평선을 종료하지만 이미 발생된 수평선은 지우지 않고 종료만 시킴. 다음 신호가 발생하면 다시 수평선과 가격을 표시함. 익절:12000. 손절:9800
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-11-10 13:49:24

안녕하세요 예스스탁입니다. 1 Var:A(0),B(0),cnt(0),direction(0),direction1(0); Array: AA[100](0),BB[100](0); If Index == 0 Then { A=H[0]; B=L[0]; Direction = 0; } if NextBarSdate > sDate Then { direction1 = direction[1]; //1번조건 if direction <= 0 and DayHigh(0) > DayHigh(1) and DayLow(0) >= DayLow(1) then { A = DayHigh(0); direction = 1; } //2번조건 If direction >= 0 and DayLow(0) < DayLow(1) and DayHigh(0) <= DayHigh(1) Then { B = DayLow(0); direction = -1; } //3번조건 if direction == -1 and direction1 == -1 and DayHigh(0) > DayHigh(1) then { BB[0] = B; direction = -2; } //4번조건 If direction == 1 and direction1 == 1 and DayLow(0) < DayLow(1) Then { AA[0] = A; direction = 2; } } Plot1(A); 2 input : 분(30); Var:A(0),B(0),cnt(0),direction(0),direction1(0); Array: AA[100](0),BB[100](0); var : S1(0),D1(0),TM(0),TF(0),HH(0),HH1(0),HH2(0),LL(0),LL1(0),LL2(0); var : nS1(0),nD1(0),nTM(0),nTF(0); If Index == 0 Then { A=H[0]; B=L[0]; Direction = 0; } if Bdate != Bdate[1] Then { S1 = TimeToMinutes(sTime); D1 = Bdate; } if NextBarBdate > Bdate Then { nS1 = TimeToMinutes(NextBarsTime); nD1 = NextBarBdate; } if D1 > 0 then { if Bdate == D1 Then TM = TimeToMinutes(sTime)-S1; Else TM = TimeToMinutes(sTime)+1440-S1; TF = TM%분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and 분 > 1 and TF < TF[1]) or (Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or (Bdate == Bdate[1] and 분 == 1 and TM > TM[1]) Then { HH = H; LL = L; HH1 = HH[1]; LL1 = LL[1]; } Else { if HH > 0 and H > HH Then HH = H; if LL > 0 and L < LL Then LL = L; } if NextBarBdate == D1 Then nTM = TimeToMinutes(NextBarsTime)-nS1; Else nTM = TimeToMinutes(NextBarsTime)+1440-nS1; nTF = nTM%분; if NextBarBdate > Bdate or (NextBarBdate == Bdate and 분 > 1 and nTF < nTF[1]) or (NextBarBdate == Bdate and 분 > 1 and nTM >= nTM[1]+분) or (NextBarBdate == Bdate and 분 == 1 and nTM > nTM[1]) Then { if direction <= 0 and HH > HH1 and LL >= LL1 then { A = HH; direction = 1; } //2번조건 If direction >= 0 and LL < LL1 and HH <= HH1 Then { B = LL; direction = -1; } //3번조건 if direction == -1 and direction1 == -1 and HH >HH1 then { BB[0] = B; direction = -2; } //4번조건 If direction == 1 and direction1 == 1 and LL < LL1 Then { AA[0] = A; direction = 2; } } Plot1(A); } 3 var : tx(0); var1 = ma(C,5); Var2 = ma(c,20); plot1(var1); plot2(Var2); if CrossUp(var1,Var2) Then { tx = text_new(sDate,sTime,H,NumToStr(sDate,0)+NewLine+NumToStr(sTime,0)); Text_SetStyle(tx,2,1); } if CrossDown(var1,Var2) Then { tx = text_new(sDate,sTime,L,NumToStr(sDate,0)+NewLine+NumToStr(sTime,0)); Text_SetStyle(tx,2,1); } 4 input : 익절(2),손절(2); var : tx1(0),tx2(0),tl1(0),tl2(0); var1 = ma(C,5); Var2 = ma(C,20); if MarketPosition <= 0 and CrossUp(var1,Var2) Then { Buy(); value1 = c; TL1 = TL_New(sDate,sTime,value1*(1+익절/100),NextBarSdate,NextBarStime,value1*(1+익절/100)); TL2 = TL_New(sDate,sTime,value1*(1-손절/100),NextBarSdate,NextBarStime,value1*(1-손절/100)); TX1 = text_new(sDate,sTime,H,NumToStr(value1*(1+익절/100),2)); TX2 = text_new(sDate,sTime,H,NumToStr(value1*(1-손절/100),2)); } if MarketPosition == 1 Then { TL_SetEnd(TL1,NextBarSdate,NextBarStime,value1*(1+익절/100)); TL_SetEnd(TL2,NextBarSdate,NextBarStime,value1*(1-손절/100)); Text_SetLocation(TX1,NextBarOpen,NextBarStime,value1*(1+익절/100)); Text_SetLocation(TX2,NextBarOpen,NextBarStime,value1*(1-손절/100)); } SetStopProfittarget(익절,PercentStop); SetStopProfittarget(손절,PercentStop); 즐거운 하루되세요 > jdavid 님이 쓴 글입니다. > 제목 : 지표 변환 > 감사합니다. 아래 지표를 변환하고 싶습니다. 1. 일봉지표를 분봉지표로 변환 2. 분봉지표를 타분봉지표로 변환 Var:A(0),B(0),cnt(0),direction(0); Array: AA[100](0),BB[100](0); If Index == 0 Then { A=H[0]; B=L[0]; Direction = 0; } //1번조건 if direction <= 0 and H[0] > H[1] and L >= L[1] then { A = H[0]; direction = 1; } //2번조건 If direction >= 0 and L[0] < L[1] and H <= H[1] Then { B = L[0]; direction = -1; } //3번조건 if countif(Direction == -1,2) == 2 and H[0] > H[1] then { BB[0] = B; direction = -2; } //4번조건 If countif(Direction == 1,2) == 2 and L[0] < L[1] Then { AA[0] = A; direction = 2; } Plot1(A); 3. 날짜와 시간표시. 예를 들어 5이평이 20이평을 돌파했을 때의 날짜와 시간을 표시하고 싶습니다. 이미 발생된 날짜와 시간은 지우지 않고 다음 신호 발생시 다시 날짜와 시간 표시. 4. 시스템에서 매수신호가 발생했을 때 종가의 +2% 가격과 수평선 표시. -2%가격과 수평선 표시. 예) 5이평이 20이평을 돌파했을 때의 종가를 매수신호라고 한다면 종가의 +2% 가격과 수평선 표시. -2%가격과 수평선을 표시. 현재가가 +2%.-2%가격을 터치하면 수평선을 종료하지만 이미 발생된 수평선은 지우지 않고 종료만 시킴. 다음 신호가 발생하면 다시 수평선과 가격을 표시함. 익절:12000. 손절:9800