커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

수익선그리기 수정 요청 드립니다.

* 수식 작성에 많은 도움 고맙습니다. * 아래 수식은 잘쓰고 있는데 차트에 표시된 수치와 성능보고서 와 차이가 나는데 어느부분을 수정 해야 하나요? ▶ 아프리카TV → "sotiman" 검색 라이브 방송 에 보시면 화면에 보입니다. ## 그리기 var : TL(0),str(""),TX9(0); if TotalTrades > TotalTrades[1] Then TL_Delete(TL); if MarketPosition == 1 then { if PositionProfit(0) > 0 then str = "수익 : "+NumToStr(abs(C-entryprice),2); else str = "손실 : "+NumToStr(abs(C-entryprice),2); if BarsSinceEntry == 1 then { TL = TL_new(entrydate,entrytime,entryprice,sdate,stime,c); TX9 = text_new(sdate,stime,C,str); TL_SetSize(TX9,3); } else { TL_setend(TL,sdate,stime,c); text_setlocation(tx9,sdate,stime,c); Text_SetString(TX9, str); } if PositionProfit(0) > 0 then TL_setcolor(TL,red); else TL_setcolor(TL,blue); } if MarketPosition == -1 then { if PositionProfit(0) > 0 then str = "수익 : "+NumToStr(abs(C-entryprice),2); else str = "손실 : "+NumToStr(abs(C-entryprice),2); if BarsSinceEntry == 1 then { TL = TL_new(entrydate,entrytime,entryprice,sdate,stime,c); TX9 = text_new(sdate,stime,C,str); TL_SetSize(TX9,3); } else { TL_setend(TL,sdate,stime,c); text_setlocation(tx9,sdate,stime,c); Text_SetString(TX9, str); TL_SetSize(TX9,3); } if PositionProfit(0) > 0 then TL_setcolor(TL,red); else TL_setcolor(TL,blue); } * 매번 고맙습니다. 수고하십시요.
프로필 이미지
요타
2020-10-05
843
글번호 142822
시스템
답변완료

시스템 부탁드립니다

- 분봉테스트 - 하루 시작의 5봉중 3봉이 양이고 - 6번째 봉부터 진입 - 직전봉의 고점을 돌파하고 양봉으로 마감하는 봉의 종가에 매수 진입 - 매수 청산 및 손절- - 진입한 직전봉의 저가에 손절 - 또는 직전봉 저점을 돌파하는 음봉으로 마감시 봉의 종가에 매수 청산 - 또는 15:20분에 매수 청산 혹시몰라 그림을 추가했습니다^^ 부탁드려요~
프로필 이미지
마식
2020-10-05
837
글번호 142821
시스템
답변완료

추가좀 부탁드립니다

아래의 수식에 상하단 밴드 안으로 4등분 선좀 부탁드립니다. input : 기간(20),k(0.03); var1 = highest(H,기간)[1]; var11 = var1*(1+k/100); var2 = lowest(L,기간)[1]; var22 = var2*(1+k/100); plot1(var1,"고점"); plot2(var11,"고점+k%"); plot3(var2,"저점"); plot4(var22,"저점+k%");
프로필 이미지
harrywin
2020-10-04
1025
글번호 142820
지표
답변완료

이동평균 최대치?

안녕하세요, 적합 이동평균 최대치가 있는지 궁금합니다. 예를들면 10000 이평, 20000 이평 이렇게 큰 숫자의 적합이동평균이 가능한건지, 아니면 최대치가 있는지 궁금합니다. 적합이동평균 숫자를 크게 늘려 보니 예상되는 지표가 안나오고 한계치가 있는 것 같아서요..
프로필 이미지
김예스
2020-10-04
919
글번호 142819
지표
답변완료

문의 드립니다.

안녕하세요 추석연휴 잘보내셨즌지요..ㅎㅎ 키움 수식을 예스로 변환좀 부탁드립니다. 수식1 aa=ma(가격,기간,이평종류); bb=if(aa(1)<=aa,1,-1); sum(bb) 수식2 aa=ma(가격,기간,이평종류); bb=if(aa(1)<=aa,1,-1); cc=sum(bb); if(cc(1)<=cc,cc,0) 수식3 aa=ma(가격,기간,이평종류); bb=if(aa(1)<=aa,1,-1); cc=sum(bb); if(cc(1)>=cc,cc,0) 수식4 0 지표조건설정 가격 종가 기간 60 이평종류 삼각 이런수식인데요... 선이 상승시에는 빨간선이 하락시에는 파란선이 나오게 하고 싶습니다. 괜찮으시다면 키움차트에 있는 강세약세 처럼 만드는 수식도 같이 만들어 주시면 감사하겠습니다. 감사합니다.
프로필 이미지
로꼬로꼬
2020-10-03
1007
글번호 142818
지표
답변완료

분봉에서..

안녕하세요. 항상 감사드립니다. 분봉에서 바이너리MACD 의 일봉, 주봉 값을 계산해서 쓰고 싶은데요. data2로는 안될 것 같은데.. data2말고 계산해서 쓸 수 있는 방법이 있을까요? 가이드 부탁드립니다.
프로필 이미지
롬롬7
2020-10-03
1006
글번호 142817
시스템
답변완료

문의드립니다.

아래수식을 예스로 부탁합니다. rsiSource = input(title="RSI Source", type=input.source, defval=close) rsiLength = input(title="RSI Length", type=input.integer, defval=7) rsiOverbought = input(title="RSI Overbought", type=input.integer, defval=70, minval=51, maxval=100) rsiOvesold = input(title="RSI Oversold", type=input.integer, defval=30, minval=1, maxval=49) rsiValue = rsi(rsiSource, rsiLength) isOverbought = rsiValue >= rsiOverbought isOversold = rsiValue <= rsiOvesold var laststate = 0 var hh = low var ll = high var label labelll = na var label labelhh = na var line line_up = na var line line_down = na var last_actual_label_hh_price = 0.0 var last_actual_label_ll_price = 0.0 obLabelText() => if(last_actual_label_hh_price < high) "HH" else "LH" osLabelText() => if(last_actual_label_ll_price < low) "HL" else "LL" createOverBoughtLabel(isIt) => if(isIt) label.new(x=bar_index, y=na ,yloc=yloc.abovebar, style=label.style_label_down, color=color.red, size=size.tiny, text=obLabelText()) else label.new(x=bar_index, y=na ,yloc=yloc.belowbar, style=label.style_label_up, color=color.green, size=size.tiny, text=osLabelText()) moveOversoldLabel() => label.set_x(labelll, bar_index) label.set_y(labelll, low) label.set_text(labelll, osLabelText()) line.set_x1(line_down, bar_index) line.set_y1(line_down, low) moveOverBoughtLabel() => label.set_x(labelhh, bar_index) label.set_y(labelhh, high) label.set_text(labelhh, obLabelText()) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) if(laststate == 2 and isOverbought) hh := high labelhh := createOverBoughtLabel(true) last_actual_label_ll_price := label.get_y(labelll) labelll_ts = label.get_x(labelll) labelll_price = label.get_y(labelll) line_up := line.new(x1=bar_index, y1=high, x2=labelll_ts, y2=labelll_price, width=1) if(laststate == 1 and isOversold) ll := low labelll := createOverBoughtLabel(false) last_actual_label_hh_price := label.get_y(labelhh) labelhh_ts = label.get_x(labelhh) labelhh_price = label.get_y(labelhh) line_down := line.new(x1=bar_index, y1=high, x2=labelhh_ts, y2=labelhh_price, width=1) if(isOverbought) if(high >= hh) hh := high moveOverBoughtLabel() laststate := 1 if(isOversold) if(low <= ll) ll := low moveOversoldLabel() laststate := 2 if(laststate == 1 and isOverbought) if(hh <= high) hh := high moveOverBoughtLabel() if(laststate == 2 and isOversold) if(low <= ll) ll := low moveOversoldLabel() if(laststate == 1) if(hh <= high) hh := high moveOverBoughtLabel() if(laststate == 2) if(ll >= low) ll := low moveOversoldLabel()
프로필 이미지
as8282
2020-10-03
1132
글번호 142816
지표
답변완료

부탁드립니다

$,언제나 늘 신속명쾌한 답변을 주시는 관리자님께 경의를 표하며 아래조건 로직을 재삼 부탁드립니다. 1,음봉 다음캔들이 캔들 아래꼬리 길이가 몸통 길이 보다 3배이살 클때를 기본 조건으로 합니다 ㅡ,O < C 이고,H = C 또는 C < H(+2틱까지)일때 양봉캔들에 강조색 RED 2,양봉다음 캔들이 캔들 윗꼬리 길이가 몸통 길이 보다 3배이살 클때를 기본 조건으로 합니다 ㅡ,O > C 이고,L = C 또는 C > L(-2틱까지)일때 음봉캔들에 강조색 BLUE $$,고맙습니다.
프로필 이미지
골든키
2020-10-03
926
글번호 142815
지표
답변완료

문의드립니다~

input : 분주기(30),P(5),분주기1(15),분주기2(5); var : S1(0),D1(0),TM(0),TF(0); var : cnt(0),sum(0),mav(0),tf1(0),TFF(0),entry(false),tf2(0); Array : CC[100](0),OO[100](0),HH[100](0),LL[100](0),TT[100](0),ii[100](0),O2[100](0); Array : C1[100](0),T1[100](0); if (sdate != sdate[1] and stime >= 100000) or (sdate == sdate[1] and (Stime == 100000 or (stime > 100000 and stime[1] < 100000))) Then{ S1 = TimeToMinutes(100000); D1 = sdate; } if D1 > 0 then{ if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TFF = TM%60; TF = TM%분주기; if (sdate != sdate[1] and stime >= 100000) or (sdate == sdate[1] and (Stime == 100000 or (stime > 100000 and stime[1] < 100000))) or (TF < TF[1]) Then{ OO[0] = o; HH[0] = H; LL[0] = L; TT[0] = stime; ii[0] = 0; for cnt = 1 to 99{ OO[cnt] = OO[cnt-1][1]; HH[cnt] = HH[cnt-1][1]; LL[cnt] = LL[cnt-1][1]; CC[cnt] = CC[cnt-1][1]; TT[cnt] = TT[cnt-1][1]; ii[cnt] = ii[cnt-1][1]; } } if H > HH[0] Then HH[0] = H; if L < LL[0] Then LL[0] = L; CC[0] = C; ii[0] = ii[0]+1; TF1 = TM%분주기1; if (sdate != sdate[1] and stime >= 100000) or (sdate == sdate[1] and (Stime == 100000 or (stime > 100000 and stime[1] < 100000))) or (TF1 < TF1[1]) Then{ T1[0] = stime; for cnt = 1 to 99{ C1[cnt] = C1[cnt-1][1]; T1[cnt] = T1[cnt-1][1]; } } C1[0] = C; TF2 = TM%분주기2; if (sdate != sdate[1] and stime >= 100000) or (sdate == sdate[1] and (Stime == 100000 or (stime > 100000 and stime[1] < 100000))) or (TF2 < TF2[1]) Then{ O2[0] = o; for cnt = 1 to 99{ O2[cnt] = O2[cnt-1][1]; } } } 1. 위식의 oo[0]에서 "매30분마다 oo[0]가 새로 생성되고 나서 10봉이내일때만(30분시초가 이후로 10개캔들 이내일때만) 진입한다"를 식으로 표현하고 싶습니다. 2. 위 식을 기준으로 30분단위로 30분시초가(oo[0])에 매수 30분종가에 청산식도 부탁드립니다. 감사합니다~
프로필 이미지
겐지
2020-10-03
924
글번호 142814
시스템
답변완료

트레이딩뷰 PMax 지표를 예스수식으로 변환요청드립니다.

//@version=4 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // &copy; KivancOzbilgic //developer: @KivancOzbilgic //author: @KivancOzbilgic study("Profit Maximizer","PMax", overlay=true) src = input(hl2, title="Source") Periods = input(title="ATR Length", type=input.integer, defval=10) Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0) mav = input(title="Moving Average Type", defval="EMA", options=["SMA", "EMA", "WMA", "TMA", "VAR", "WWMA", "ZLEMA", "TSF"]) length =input(10, "Moving Average Length", minval=1) changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true) showsupport = input(title="Show Moving Average?", type=input.bool, defval=true) showsignalsk = input(title="Show Crossing Signals?", type=input.bool, defval=true) showsignalsc = input(title="Show Price/Pmax Crossing Signals?", type=input.bool, defval=false) highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true) atr2 = sma(tr, Periods) atr= changeATR ? atr(Periods) : atr2 valpha=2/(length+1) vud1=src>src[1] ? src-src[1] : 0 vdd1=src<src[1] ? src[1]-src : 0 vUD=sum(vud1,9) vDD=sum(vdd1,9) vCMO=nz((vUD-vDD)/(vUD+vDD)) VAR=0.0 VAR:=nz(valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*nz(VAR[1]) wwalpha = 1/ length WWMA = 0.0 WWMA := wwalpha*src + (1-wwalpha)*nz(WWMA[1]) zxLag = length/2==round(length/2) ? length/2 : (length - 1) / 2 zxEMAData = (src + (src - src[zxLag])) ZLEMA = ema(zxEMAData, length) lrc = linreg(src, length, 0) lrc1 = linreg(src,length,1) lrs = (lrc-lrc1) TSF = linreg(src, length, 0)+lrs getMA(src, length) => ma = 0.0 if mav == "SMA" ma := sma(src, length) ma if mav == "EMA" ma := ema(src, length) ma if mav == "WMA" ma := wma(src, length) ma if mav == "TMA" ma := sma(sma(src, ceil(length / 2)), floor(length / 2) + 1) ma if mav == "VAR" ma := VAR ma if mav == "WWMA" ma := WWMA ma if mav == "ZLEMA" ma := ZLEMA ma if mav == "TSF" ma := TSF ma ma MAvg=getMA(src, length) longStop = MAvg - Multiplier*atr longStopPrev = nz(longStop[1], longStop) longStop := MAvg > longStopPrev ? max(longStop, longStopPrev) : longStop shortStop = MAvg + Multiplier*atr shortStopPrev = nz(shortStop[1], shortStop) shortStop := MAvg < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop dir = 1 dir := nz(dir[1], dir) dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir PMax = dir==1 ? longStop: shortStop plot(showsupport ? MAvg : na, color=#0585E1, linewidth=2, title="Moving Avg Line") pALL=plot(PMax, color=color.red, linewidth=2, title="PMax", transp=0) alertcondition(cross(MAvg, PMax), title="Cross Alert", message="PMax - Moving Avg Crossing!") alertcondition(crossover(MAvg, PMax), title="Crossover Alarm", message="Moving Avg BUY SIGNAL!") alertcondition(crossunder(MAvg, PMax), title="Crossunder Alarm", message="Moving Avg SELL SIGNAL!") alertcondition(cross(src, PMax), title="Price Cross Alert", message="PMax - Price Crossing!") alertcondition(crossover(src, PMax), title="Price Crossover Alarm", message="PRICE OVER PMax - BUY SIGNAL!") alertcondition(crossunder(src, PMax), title="Price Crossunder Alarm", message="PRICE UNDER PMax - SELL SIGNAL!") buySignalk = crossover(MAvg, PMax) plotshape(buySignalk and showsignalsk ? PMax*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0) sellSignallk = crossunder(MAvg, PMax) plotshape(sellSignallk and showsignalsk ? PMax*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0) buySignalc = crossover(src, PMax) plotshape(buySignalc and showsignalsc ? PMax*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=#0F18BF, textcolor=color.white, transp=0) sellSignallc = crossunder(src, PMax) plotshape(sellSignallc and showsignalsc ? PMax*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=#0F18BF, textcolor=color.white, transp=0) mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0,display=display.none) longFillColor = highlighting ? (MAvg>PMax ? color.green : na) : na shortFillColor = highlighting ? (MAvg<PMax ? color.red : na) : na fill(mPlot, pALL, title="UpTrend Highligter", color=longFillColor) fill(mPlot, pALL, title="DownTrend Highligter", color=shortFillColor) ----------------------------------------------------------------------------------- 1. buy와 sell이 들어가는거 보면 지표수식은 아닌거 같고 시스템수식인지 잘모르겠는데 저는 지표수식으로 요청했는데 지표수식이 아니면 시스템으로 변경요청해주셔요. 그냥 시스템식과 지표식 둘다 가능하면 둘다 만들어주시면 감사하겠습니다. ----------------------------------------------------------------------------------- input : length(100),mult(1); var : src(0),a(0),b(0),size(0); src = close; size = iff((a[1]-a[2]) > 0 or (b[1]-b[2]) < 0 , atr(length) ,TrueRange); if a[1] > a[2] Then { Condition1 = true; var1 = 0; } Else { if Condition1 == true Then var1 = var1+1; } if b[1] < b[2] Then { Condition2 = true; var2 = 0; } Else { if Condition2 == true Then var2 = var2+1; } a = max(src,a[1]) - size/pow(length,2)*(var1*mult); b = min(src,b[1]) + size/pow(length,2)*(Var2*mult); plot1(a); plot2(b); ------------------------------------------------------------------------ 2.채널의 상단과 하단의 중심선을 만들어 표시하고 싶은데요. 중심에 점선으로 표시하고 싶습니다. 상승하락 구분되게끔 상승시 빨강 하락시 파랑으로 표시해주시면 좋겠습니다. 수식을 첨가해서 만들어주시면 감사하겠습니다. ------------------------------------------------------------------------ Input:Period(14),n(0),multi(0.5),Left(3),Right(3); Var:기울기(0),절편(0),회귀선(0),회귀선tmp(0),채널폭(0),j(0),T(0); var : 상단1(0),상단2(0),하단1(0),하단2(0),TL1(0),TL2(0); 기울기 = LRS(C, Period)[n]; 절편 = _intercept(C,Period)[n]; 회귀선 = 기울기 * Index + 절편; 채널폭 = 0; for j = n to Period + n - 1 { 회귀선tmp = 기울기 * Index[j] + 절편; 채널폭 = max(채널폭,max(abs(H[j] - 회귀선tmp),abs(회귀선tmp - L[j]))); } if 회귀선 > 회귀선[1] Then T = 1; if 회귀선 < 회귀선[1] Then T = -1; 상단2 = 회귀선 + 채널폭 * multi; 상단1 = 회귀선 + 채널폭; 하단1 = 회귀선 - 채널폭; 하단2 = 회귀선 - 채널폭 * multi; plot1(회귀선,"회귀선",iff(T==1,RED,BLUE)); plot2(상단1); plot3(하단1); plot4(상단2); plot5(하단2); if SwingHigh(1,상단2,left,right,left+right+1) != -1 Then { var1 = 상단1[right]; TL1 = TL_New(sDate[right],sTime[right],var1,sDate,sTime,var1); TL_SetColor(TL1,BLUE); } Else TL_SetEnd(TL1,sDate,sTime,var1); if Swinglow(1,하단2,left,right,left+right+1) != -1 Then { var2 = 하단1[right]; TL2 = TL_New(sDate[right],sTime[right],var2,sDate,sTime,var2); TL_SetColor(TL2,RED); } Else TL_SetEnd(TL2,sDate,sTime,var2); ---------------------------------------------------------------------------------- 3. 위 그래프선형채널 수식에 상단하단 빨간선 파란선 나오는 부분에 글자표시 해주시면 감사하겠습니다. 파란선 왼쪽 옆에 "수" 표시가 나오게끔 해주시고 빨간선 오른쪽 옆에 "도" 표시가 나오게끔 해주시면 좋겠습니다. ----------------------------------------------------------------------------------- var:text1(0); plot1(I_CurrentContracts); PlotBaseLine1(0); If I_CurrentContracts <> 0 and I_CurrentContracts[1] <> I_CurrentContracts Then { text1 = Text_New_Self(sDate,sTime,I_CurrentContracts,numtostr(I_CurrentContracts,0)); Text_SetBold(text1,1); Text_SetSize(text1,18); Text_SetStyle(text1,0,IFF(I_MarketPosition==1,0,1)); } -------------------------------------------------------------------------------------- 4. 포지션현재수량 수식인데요. 제가 원하는게 1분봉에서 추세를 파악하려하는데 1분봉상에서 타주기 5분봉, 10분봉, 30분봉, 60분봉의 포지션현재수량이 보조지표로 표현되게끔 할수 있을까요? 가능하면 부탁드리겠습니다.
프로필 이미지
양정희
2020-10-04
1088
글번호 142812
지표