커뮤니티

예스랭귀지 Q&A

글쓰기

234fsdae 님에 의해서 삭제되었습니다.

프로필 이미지
234fsdae
2022-11-18
12
글번호 163933
시스템
답변완료

수식 변환 문의2

수고 하십니다. 아래 식 변환 부탁드립니다. 수고하세요... ################### https://www.prorealcode.com/prorealtime-indicators/swingarm-atr-trailing-stop/ //PRC_Swingarm ATR Trailing Stop | indicator //03.08.2020 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //converted from TOS //https://www.prorealcode.com/topic/conversion-of-swingarm-atr-trailing-stop/ // --- settings trailType = 1 //1=modified, 0=unmodified ATRPeriod = 28 ATRFactor = 5 firstTrade = 0 //0= long, 1= short averageType = 3 //0 = SMA 1 = EMA 2 = WMA 3 = Wilder 4 = Triangular 5 = End point 6 = Time series 7 = Hull (PRT v11 only) 8 = ZeroLag (PRT v11 only) showArrows = 0 //0=false ; 1=true //--- end of settings fib1Level = 61.8 fib2Level = 78.6 fib3Level = 88.6 HiLo = Min(high - low, 1.5 * Average[ATRPeriod](range)) if low <= high[1] then Href = high - close[1] else Href = (high - close[1]) - 0.5 * (low - high[1]) endif if high >= low[1] then Lref = close[1] - low else Lref = (close[1] - low) - 0.5 * (low[1] - high) endif //case modified: if trailType = 1 then trueRange = Max(HiLo, Max(HRef, LRef)) else //case unmodified trueRange = tr(close) // TrueRange(high, close, low) endif iloss = ATRFactor * Average[ATRPeriod,averageType](trueRange) once init=0 if init=0 then if firsttrade=0 then state = 0 trail = close - iloss else state = 1 trail = close + iloss endif init=1 endif //case long: if state[1] = 0 then if (close > trail[1]) then state = 0 trail = Max(trail[1], close - iloss) else state = 1 trail = close + iloss endif endif //case short: if state[1] = 1 then if (close < trail[1]) then state = 1 trail = Min(trail[1], close + iloss) else state = 0 trail = close - iloss endif endif BuySignal = state<>state[1] and state = 0 SellSignal = state<>state[1] and state = 1 if BuySignal then ex = high elsif SellSignal then ex = low else if state = 0 then ex = Max(ex[1], high) elsif state = 1 then ex = Min(ex[1], low) else ex = ex[1] endif endif TrailingStop = trail if state = 0 then r=0 g=255 else r=255 g=0 endif f1 = ex + (trail - ex) * fib1Level / 100 f2 = ex + (trail - ex) * fib2Level / 100 f3 = ex + (trail - ex) * fib3Level / 100 if showArrows then l1 = state[1] = 0 and close crosses under f1[1] l2 = state[1] = 0 and close crosses under f2[1] l3 = state[1] = 0 and close crosses under f3[1] s1 = state[1] = 1 and close crosses over f1[1] s2 = state[1] = 1 and close crosses over f2[1] s3 = state[1] = 1 and close crosses over f3[1] atr = AverageTrueRange[14](close) y=0 if l1 or l2 or l3 then y =low - atr endif if s1 or s2 or s3 then y=high + atr endif if y>0 then if y>close then drawarrowdown(barindex,y) coloured(r,g,0) else drawarrowup(barindex,y) coloured(r,g,0) endif endif endif return TrailingStop coloured(r,g,0) style(line,3) as "ATR Trailing Stop" , ex coloured(r,g,0) style(point,4) as "Extremum", f1 coloured(168,168,168), f2 coloured(168,168,168), f3 coloured(168,168,168)
프로필 이미지
오이도인
2022-11-18
1121
글번호 163930
지표
답변완료

함수요청

안녕하세요? 아래 전략에 대해 스크립트 작성 요청드립니다. 국내선물 1분봉으로 일중 거래를 하고자 합니다.(오버나티트하지 않습니다.) 9시 개장후 전일종가대비 하락 출발하고 15분봉상 양봉이 누적으로 2개 혹은 30분봉으로 양봉이 1개 발생되면 익봉시가에 매도 진입 9시 개장후 전일종가대비 상승 출발하고 15분봉상 음봉이 누적으로 2개 혹은 30분봉으로 음봉이 1개 발생되면 익봉시가에 매수 진입 매수든 매도든 하루 최대 1번 진입하며 청산됩니다. 15시 강제청산합니다. 1.참조함수(data1: 1분봉, data2: 15분봉, data3: 30분봉)를 사용하여 스크립트 2. 참조함수를 사용하지 않고 1분봉으로 함수를 작성하여 스크립트를 각각 요청드립니다. 감사합니다.
프로필 이미지
흰둥이아빠
2022-11-18
852
글번호 163929
시스템
답변완료

종목 검색식 부탁 드립니다.

안녕 하십니까 종목 검색식 부탁 드립니다. A=Disparity(기간); K99=valuewhen(1, crossup(A, 기준1) or crossdown(A, 기준1), 가격); K101=valuewhen(1, crossup(A, 기준2) or crossdown(A, 기준2), 가격); M20=ma(c,20); crossup(M20,K99) or crossup(M20,K101) 지표변수 가격 (고가+저가)/2 기간 20 기준1 99 기준2 101 키움애서 신호로 쓰던건데 종목검색 하고 싶습니다. 부탁드립니다. 감사합니다.
프로필 이미지
칼이쓰마빡가
2022-11-18
1026
글번호 163922
종목검색
답변완료

수식의뢰

수고하십니다. N(40)봉중 8% 급등한 종목을 기준봉으로 하여 N일간 등락을 반복하다가 5일선을 하향 이탈한 시점에서 종목을 검색할 수 있는 종목검색식 부탁드립니다.
프로필 이미지
심홍
2022-11-18
1104
글번호 163917
종목검색
답변완료

당일 종가선 색깔

감사합니다. 아래는 틱차트에서 5분주기 전봉전전봉갯수를 돌파할 때 종가를 표시하는 수식입니다. 이 수식이 나타내는 종가에서 1. 장시작 후 처음 나타난 종가를 저장하고 장마지막까지 지표값을 표시. 녹색 2. 장시작 후 처음 나타난 종가보다 상승한 종가 또는 이전 종가보다 상승한 종가를 저장하고 각각 장마지막까지 지표값을 표시. 빨강 3. 장시작 후 처음 나타난 종가보다 하락한 종가 또는 이전 종가보다하락한 종가를 저장하고 각각 장마지막까지 지표값을 교시. 파랑 input : ntime(5); var : S1(0),D1(0),TM(0),TF(0),B(0); var : idx(0),idx1(0),idx2(0),tx(0); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; var1 = 0; } 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 { B = B+1; idx = 0; idx1 = idx[1]; idx2 = idx1[1]; tx = Text_New(sDate,sTime,L,NumToStr(1,0)); Text_SetStyle(tx,2,0); Text_SetColor(tx,Red); Text_SetBold(tx,1); } idx = idx+1; Text_SetString(tx,NumToStr(idx,0)); Text_SetLocation(tx,sDate,sTime,L); if B >= 3 and idx > max(idx1,idx2) Then var1 = C; if var1 > 0 Then Plot1(var1); Else NoPlot(1); }
프로필 이미지
jdavid
2022-11-18
1080
글번호 163915
지표
답변완료

추세선 크기

input : Period(10),선두께(2); Var:상승색(Red), 하락색(Blue); Var:j(0),T(0); Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0), date21(0),date22(0),time21(0),time22(0), date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0); Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0); Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0); r[0] = 0; r[1] = 2; r[2] = 3.; r[3] = -1; r[4] = -2.; r[5] = 1; r[6] = 0.5; For j = 0 To 19 { HiBar[j] = HiBar[j] + 1; LoBar[j] = LoBar[j] + 1; } if crossup(c,highest(H,Period)[1]) Then T = 1; if CrossDown(c,Lowest(L,Period)[1]) Then T = -1; If T == -1 Then { If T[1] != -1 Then { For j = 18 DownTo 0 { LoVal[j+1] = LoVal[j]; LoBar[j+1] = LoBar[j]; } LoVal[0] = L; LoBar[0] = 0; date11 = date[HiBar[0]]; time11 = stime[HiBar[0]]; Value11 = HiVal[0]; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_Delete(tl); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,하락색); date21 = date[HiBar[0]]; time21 = stime[HiBar[0]]; date22 = date[0]; time22 = stime[0]; for j = 0 to 6 { fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]); } } If LoVal[0] > L Then { LoVal[0] = L; LoBar[0] = 0; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date22 = date[0]; time22 = stime[0]; TL_Delete(tl); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); } } If T == 1 Then { If T[1] != 1 Then { For j = 18 DownTo 0 { HiVal[j+1] = HiVal[j]; HiBar[j+1] = HiBar[j]; } HiVal[0] = H; HiBar[0] = 0; date11 = date[LoBar[0]]; time11 = stime[LoBar[0]]; Value11 = LoVal[0]; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_Delete(tl); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,상승색); date31 = date[LoBar[0]]; time31 = stime[LoBar[0]]; date32 = date[0]; time32 = stime[0]; for j = 0 to 5 { fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]); } } If HiVal[0] < H Then { HiVal[0] = H; HiBar[0] = 0; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date32 = date[0]; time32 = stime[0]; TL_Delete(tl); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); } } TL_SetSize(TL1,선두께); 추세선이 하락하다 크기가 1.5p에 도달하면 매수,다음봉에 매수청산. 상승하다 크기가 1p에 도달하면 매도,다음봉에 매도청산. 감사합니다.
프로필 이미지
고성
2022-11-18
1212
글번호 163913
시스템
답변완료

포지션

안녕하세요. 포지션 관련하여 질문드립니다. 예를들어 제가 전략 두개를 운용중이라 하겠습니다. 하나의 전략이 매수포지션 유지 중인데, 나머지 다른 전략이 매도 포지션 진입 신호가 나온다면, 매수포지션 유지 중이었던게 매도가 되면서 청산되고 매도포지션은 매수포지션이었던게 청산되므로써 매도가 이루어진 것이므로 포지션진입을 안하게 될 것 같은데 만약 이렇게 된다면 문제를 어떻게 해결하면 좋을까요? 코스피 선물 기준으로 질문드립니다.
프로필 이미지
히익
2022-11-18
1415
글번호 163912
시스템
답변완료

수식 변환 문의

수고 하십니다. 아래 식 변환 부탁드립니다. L100, f1,f2,f3의 지표를 구현하고 싶습니다 그 외의 것이 있어서 복잡하거나 시간이 많이 걸린다면 생략하셔도 됩니다.. 수고하세요... ######## # Original Code From: TD Ameritrade IP Company, Inc. (c) 2009-2020 # Original StudyName: ATRTrailingStop # Type: Study # blackFLAG FTS SwingArms # Edited by: Jose Azcarate # blackFLAG Futures Trading - FOR EDUCATIONAL PURPOSES ONLY # TWITTER: @blackflagfuture # Settings Vary. My preferred setting is 28 / 5 But also use 30 / 8 and 5 / 3.5 depending on strategy. input trailType = {default modified, unmodified}; input ATRPeriod = 28; input ATRFactor = 5; input firstTrade = {default long, short}; input averageType = AverageType.WILDERS; input fib1Level = 61.8; input fib2Level = 78.6; input fib3Level = 88.6; Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor); def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod)); def HRef = if low <= high[1] then high - close[1] else (high - close[1]) - 0.5 * (low - high[1]); def LRef = if high >= low[1] then close[1] - low else (close[1] - low) - 0.5 * (low[1] - high); def trueRange; switch (trailType) { case modified: trueRange = Max(HiLo, Max(HRef, LRef)); case unmodified: trueRange = TrueRange(high, close, low); } def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod); def state = {default init, long, short}; def trail; switch (state[1]) { case init: if (!IsNaN(loss)) { switch (firstTrade) { case long: state = state.long; trail = close - loss; case short: state = state.short; trail = close + loss; } } else { state = state.init; trail = Double.NaN; } case long: if (close > trail[1]) { state = state.long; trail = Max(trail[1], close - loss); } else { state = state.short; trail = close + loss; } case short: if (close < trail[1]) { state = state.short; trail = Min(trail[1], close + loss); } else { state = state.long; trail = close - loss; } } def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE); def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE); def ex = if BuySignal then high else if SellSignal then low else if state == state.long then Max(ex[1], high) else if state == state.short then Min(ex[1], low) else ex[1]; plot TrailingStop = trail; TrailingStop.SetPaintingStrategy(PaintingStrategy.POINTS); TrailingStop.DefineColor("Long", Color.GREEN); TrailingStop.DefineColor("Short", Color.RED); TrailingStop.AssignValueColor(if state == state.long then TrailingStop.Color("Long") else TrailingStop.Color("Short")); plot Extremum = ex; Extremum.SetPaintingStrategy(PaintingStrategy.POINTS); Extremum.DefineColor("HH", Color.GREEN); Extremum.DefineColor("LL", Color.RED); Extremum.AssignValueColor(if state == state.long then Extremum.Color("HH") else Extremum.Color("LL")); Extremum.Hide(); def f1 = ex + (trail - ex) * fib1Level / 100; def f2 = ex + (trail - ex) * fib2Level / 100; def f3 = ex + (trail - ex) * fib3Level / 100; def l100 = trail + 0; plot Fib1 = f1; Fib1.SetPaintingStrategy(PaintingStrategy.POINTS); Fib1.SetDefaultColor(Color.BLACK); Fib1.Hide(); plot Fib2 = f2; Fib2.SetPaintingStrategy(PaintingStrategy.POINTS); Fib2.SetDefaultColor(Color.BLACK); Fib2.Hide(); plot Fib3 = f3; Fib3.SetPaintingStrategy(PaintingStrategy.POINTS); Fib3.SetDefaultColor(Color.BLACK); Fib3.Hide(); /* AddCloud(f1, f2, Color.LIGHT_GREEN, Color.LIGHT_RED, no); AddCloud(f2, f3, Color.GREEN, Color.RED, no); AddCloud(f3, l100, Color.DARK_GREEN, Color.DARK_RED, no);
프로필 이미지
오이도인
2022-11-18
1431
글번호 163911
지표
답변완료

문의드립니다.

아래 조건을 만족하는 종목 검색식을 부탁드립니다. 기준봉= O>C[1]*1.10 ; 상단선 =기준봉의 시가 ; 하단선= 기준봉의 1봉전 고가 ; 1) 기준봉 출현이후 상승하다가 2) 기준봉 출현이후 저가가 하단선을 한 번도 이탈하지 않고 3) 현재봉의 저가가 상단선 아래 하단선 위에 위치하는 봉이 출현 경과봉수 = 기준봉~현재봉까지의 캔들수 ; 4) 경과봉수가 20일보다 작은 종목 검색식 FIND(경과봉수); 기준봉 조건을 달리 하여 여러 검색식을 작성해 볼 생각입니다. 여건이 된다면 주석 좀 달아 주시면 감사하겠습니다.
프로필 이미지
이심전심
2022-11-18
1219
글번호 163910
종목검색