커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

수식 문의드립니다.

안녕하세요. 다음 파인 스크립트 수식을 예스로 변환 부탁드립니다. 쓰기 금지단어 셀렉트&업데이트는 한글로 수정했습니다. 그리고 Table 과 Break-Even Curve는 시간이 걸리면 생략해도 됩니다. 다시 한번 감사드립니다^^ indicator(overlay=true,max_lines_count=500) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Settings { // ~~ Tooltips t1 = "셀렉트 the method used to calculate the trailing stop. 'Auto' dynamically calculates based on market conditions. 'Percentage' uses a fixed percentage for trailing. ₩n₩nThe second value defines the lookback period over which to calculate the highest high and lowest low for trailing stop calculations. Increasing this value will make the trailing stop less sensitive to price changes." t2 = "Sets the percentage step for the trailing stop when 'Percentage' method is 셀렉티드. Increasing this value will increase the distance of the trailing stop from the price." t3 = "Determines the bias of the trailing stop. 'Bullish' sets it to track only upward moves, 'Bearish' only downward, and 'Auto' adjusts dynamically based on price action." // ~~ Inputs step = input.string("Auto","Trailing Method",["Auto","Percentage","Pivot"], group="Trailing", inline="Trailing", tooltip="") prd = input.int(20,"Trailing Size", minval=2, group="Trailing", inline="Trailing", tooltip=t1) perc = input.float(.5,"Percentage Step",step=.01,group="Trailing", inline="", tooltip=t2)/100 bias = input.string("Auto","Set Bias",["Bullish","Bearish","Auto"], group="Bias", inline="", tooltip=t3) upcol = input.color(#089981 , title='', group='Style', inline="Style") dncol = input.color(#f23645, title='', group='Style', inline="Style") upcol1 = input.color(color.lime , title='', group='Style', inline="Style1") dncol1 = input.color(color.maroon, title='', group='Style', inline="Style1") showBE = input.bool(true,"Break-Even Curve",group="Table",inline="Table") showTable = input.bool(true, title='Show Table', group='Table', inline='Table') labels = input.bool(false, title='Show Labels', group='Table', inline='Table') tblSize = input.string("Auto","Table Size",["Auto","Tiny","Small","Normal","Large","Huge"], group="Table", inline="style") posi = input.string(position.top_right, title="",options =[position.top_right,position.top_center, position.top_left,position.bottom_right,position.bottom_center,position.bottom_left,position.middle_right,position.middle_left], group="Table",inline="style", tooltip="") Table_Text = input.color(color.new(color.white, 0), title='Text', inline='style', group='Table') Table_BG = input.color(color.new(#176cff, 0), title='BG', inline='style', group='Table') //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ General Variables { b = bar_index dot = label(na) var curve = array.new<line>() var labs = array.new<label>() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ AutoMove calc { hi = ta.highest(high,prd*10) lo = ta.lowest(low,prd*10) var ph = high var pl = low var phL = b var plL = b var peaks = array.new<float>() ph := ta.highestbars(high, prd) == 0 ? high : ph pl := ta.lowestbars(low, prd) == 0 ? low : pl phL:= ta.highestbars(high, prd) == 0 ? b : phL plL:= ta.lowestbars(low, prd) == 0 ? b : plL dir = phL>plL ? 1 : -1 //Delayed if dir!=dir[1] peaks.push(dir>0 ? (ph[1]-pl)/ph[1] : (ph-pl[1])/pl[1]) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Functions { Switch(Los)=> autocalc = na(peaks.median())?0:peaks.median() output = switch step "Auto" => Los?low-(low*autocalc):high+(high*autocalc) "Percentage" => Los?low-(low*perc):high+(high*perc) "Pivot" => Los?pl:ph Cleaner(arr)=> if arr.size()>0 for a in arr a.delete() arr.clear() ts = switch tblSize "Tiny" => size.tiny "Small" => size.small "Normal" => size.normal "Large" => size.large "Huge" => size.huge "Auto" => size.auto //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Trailing Mangement { var longtsl = Switch(true) var shorttsl = Switch(false) var pos = 0 if low<=longtsl longtsl := Switch(true) shorttsl := Switch(false) pos := -1 if high>=shorttsl longtsl := Switch(true) shorttsl := Switch(false) pos := 1 pos := bias=="Bullish"?1:bias=="Bearish"?-1:pos //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Plots { active = longtsl==longtsl[1] lt1 = plot(longtsl,color=active?pos>0?dncol:upcol:na, title="TSL") st1 = plot(shorttsl,color=active?pos>0?upcol:dncol:na, title="TSL") p1 = plot(close,"",color(na),editable=false,display=display.none) mid = math.avg(longtsl,shorttsl) plot(mid,color=active?color.rgb(125, 196, 255):na, style=plot.style_steplinebr, title="Mid") PosOver = pos ==-1 and close>mid?na:upcol1 NegUnder = pos ==1 and close<mid?na:dncol1 fill(p1,lt1,pos>0 and active?color.new(PosOver,80):active?color.new(NegUnder,80):na, title="") fill(p1,st1,pos>0 and active?color.new(upcol,80):active?color.new(dncol,80):na, title="") //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Table { if barstate.islast tpdist = pos>0?shorttsl-close:close-longtsl sldist = pos>0?close-longtsl:shorttsl-close distdiff = tpdist/sldist wr = (1/(1+distdiff))*100 if showTable var tbl = table.new(posi, 2, 5, frame_color=color.black, frame_width=3, border_width=2, border_color=color.new(color.white, 100)) tbl.cell(0, 0, 'Risk/Reward', text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(1, 0, "1:"+str.tostring(math.round(distdiff,2)), text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(0,1, 'Minimum Winrate', text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(1,1, str.tostring(wr,format.percent), text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(0, 2, 'Reward', text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(1, 2, str.tostring((tpdist/close)*100,format.percent), text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(0, 3, 'Risk', text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(1, 3, str.tostring((sldist/close)*100,format.percent), text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(0, 4, 'Bias', text_halign=text.align_center, bgcolor=Table_BG, text_color=Table_Text, text_size=ts) tbl.cell(1, 4, str.tostring(pos>0?"Bullish":"Bearish"), text_halign=text.align_center, bgcolor=pos>0?color.rgb(104, 218, 108):color.red, text_color=Table_Text, text_size=ts) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Break-Even Curve { if showBE Cleaner(curve) top = lo + (hi-lo)/3 float prev_y = top for j=b+100 to b+200 by 1 y = prev_y-((prev_y-lo)/14) curve.push(line.new(j,prev_y,j+1,y,color=color.blue, width=2)) prev_y := y //Create & 업데이트 Frame var box box_upper_left = box.new(na,na,na,na,na, text="Zone 2", text_color = color.white, bgcolor=color.new(color.lime, 80)) var box box_upper_right = box.new(na,na,na,na,na, text="The Magic Zone",text_color = color.white, bgcolor=color.new(color.lime, 70)) var box box_lower_left = box.new(na,na,na,na,na, text ="Zone 1", text_color = color.white,bgcolor=color.new(color.green, 70)) var box box_lower_right = box.new(na,na,na,na,na, text="Zone 3", text_color = color.white,bgcolor=color.new(color.green, 80)) box_upper_left.set_lefttop(b+100,top) box_upper_left.set_rightbottom(b+150,(top+lo)/2) box_upper_right.set_lefttop(b+150,top) box_upper_right.set_rightbottom(b+200,(top+lo)/2) box_lower_left.set_lefttop(b+100,(top+lo)/2) box_lower_left.set_rightbottom(b+150,lo) box_lower_right.set_lefttop(b+150,(top+lo)/2) box_lower_right.set_rightbottom(b+200,lo) // Delete & Add labels Cleaner(labs) for i=0 to 10 labs.push(label.new(chart.point.from_index(b+100,lo+i*(top-lo)/10), str.tostring(i*2)+"R", color=color(na), textcolor=chart.fg_color, style=label.style_label_right)) labs.push(label.new(chart.point.from_index(b+100+i*10, lo), str.tostring(i * 10) + "%", color=color(na), textcolor=chart.fg_color, style=label.style_label_up)) // Dot for the 'Break-Even Point' y = (top-lo)*(distdiff/20) dot := label.new(chart.point.from_index(b+100+int(wr),lo+y), style=label.style_circle,color=color.yellow,size=size.tiny) (dot[1]).delete() // ~~ labels { var label stopLossLabel = na var label riskRewardLabel = na stoploss = pos>0?longtsl:shorttsl riskreward = pos>0?shorttsl:longtsl if labels stopLossLabel := label.new(bar_index+5, stoploss, "Risk" + " " + str.tostring((sldist/close)*100,format.percent), color=dncol, textcolor=color.white, style=label.style_label_left, yloc=yloc.price) riskRewardLabel := label.new(bar_index+5, riskreward, "Reward" + " " + str.tostring((tpdist/close)*100,format.percent), color=upcol, textcolor=color.white, style=label.style_label_left, yloc=yloc.price) label.delete(stopLossLabel[1]) label.delete(riskRewardLabel[1]) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} // ~~ Trend Change switchUp = pos==1 switchDn = pos==-1 plotshape(switchUp and switchDn[1]?longtsl:na, location=location.absolute, style=shape.triangleup, color=upcol, size=size.small, title="Positive Trend") plotshape(switchDn and switchUp[1]?shorttsl:na, location=location.absolute, style=shape.triangledown ,color=dncol, size=size.small, title="Negative Trend") //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
프로필 이미지
cooparoo
2024-05-16
1005
글번호 179621
지표
답변완료

문의드립니다.

87137번의 연장선에서 몇가지 더 문의드리겠습니다. input : RSIP(14); var : R(0),B(0),S(0),HH(0),LL(0),BPrice(0),SPrice(0); var : k(0),lk(0); R = RSI(RSIP); k = StochasticsK(10,5); if CrossUp(R,40) Then { B = 1; if MarketPosition <= 0 and B[1] == -1 and ll < 30 and lk < 20 Then { BPrice = C; Buy(); } } if CrossDown(R,40) Then { B = -1; ll = R; lk = k; } if B == -1 Then { if R < ll Then ll = R; if k < lk Then lk = k; } ------------------------------------------------------------------ 1. 위의 식은 RSI가 40이하로 가서 RSI가 30이하와 스톡 20이하 조건을 만족한 후 RSI 40을 돌파할 때 매수신호가 나오는 식입니다. RSI 30이하+스톡 20이하에 추가로 20선 이격도 조건도 추가해서 작성하고 싶습니다. var : Period1(20), DParity1(0); DParity1 = Disparity(Period1); 20선 이격도로 99.90 이하입니다. 2. 위에 매수식만 있는데 1번을 포함해 반대 수치로 매도식도 함께 부탁드립니다. 늘 노고에 감사드립니다~
프로필 이미지
카르마다
2024-05-17
722
글번호 179620
시스템
답변완료

검색식 부탁 드려요

아래신호수식을 예스트레이더로 종목검색 하고 싶은데요 단, 0봉전부터~60봉전 까지의 종목을 모두 검색하는 조건식을 만들고 싶습니다. 좋은 하루 되세요. wvf = ((highest(C, 22) - low) / highest(C, 22)) * 100; sDev = 2.0 * stdev(wvf, 20); midLine = avg(wvf, 20); upperBand = midLine + sDev; rangeHigh = (highest(wvf, 50)) * ph; os = (wvf >= upperBand) or (wvf >= rangeHigh); ap = (HIGH+LOW+CLOSE)/3; esa = eavg(ap, 기간1); d = eavg(abs(ap - esa), 기간1); ci = (ap - esa) / (0.015 * d); wt1 = eavg(ci,기간2); wt2 = avg(wt1,4); A=Lowest(L, 260, 1); A1=Lowest(L, 260, 1)*1.25; A2=요일(DATE); A3=Valuewhen(1,A2(1)>A2,O); MO=floor(date/100); MO1=MO%100; A4=VALUEWHEN(1, MO1!=MO1(1),O); wt1(1)<=-53 && (os(1) or os) && wvf(1)<wvf && (Crossup(wt1,wt2) or Crossup(wt1,-60) or Crossup(wt1,-53)) && C>O && A1>=C && A<=C && (A3<=C OR A4<=C) -지표조건설정 기간1 : 10 기간2 : 21 PH : 0.85
프로필 이미지
일지매7
2024-05-16
844
글번호 179618
종목검색
답변완료

종목검색식 요청드립니다.

아래 조건을 만족하는 종목을 검색하는 검색기를 만들고 싶습니다. 도움 부탁드리며 항상 감사합니다.^^ 키움수식 1. 라인 M=Trix(12); ValueWhen(1,CrossUp(M,0),h) 키움수식 2. TSF(20)라인 키움수식 3. 보조지표 (Period : 10) (eavg(eavg(eavg(v,period),period),period) - eavg(eavg(eavg(v(1),period),period),period)) / eavg(eavg(eavg(v(1),period),period),period)*100 키움수식 4. 매수/매도체결 보조지표 4-1) 매수체결수식 A=IF(C>O,V,0); B=SUM(A); D=ValueWhen(1,Date(1)!=Date,B(1)); B-D; 4-2) 매도체결수식 A=IF(C<O,V,0); B=SUM(A); D=ValueWhen(1,Date(1)!=Date,B(1)); B-D; 만들고 싶은 종목검색식은 아래 3가지 조건을 모두 만족하는 종목을 검색하는 검색식을 만들고 싶습니다. 1. 키움수식1 라인을 키움수식2 라인이 상향돌파 (Period 수치 변경가능하도록 요청) 2. 키움수식3 보조지표의 값이 0 이상 (수치값 변경 가능하도록 요청) 3. 키움수식4 매수체결수식값 > 매도체결수식값
프로필 이미지
onlypsn
2024-05-16
759
글번호 179616
종목검색
답변완료

돌파 조건 검색식 부탁 합니다

변동성라 A=PREDAYHIGH()-PREDAYLOW(); B=DAYOPEN()+A*0.5; B1=RSI(2); A1= LinearRegressionValue(C,기간,0); A2= LinearRegressionValue(A1,기간,0); eq=A1-A2; VL=A1+eq; 지표조건 기간 25 H연장라인 조건=Highest(H,L기간+R기간+1)==H(R기간); valuewhen(1,조건,H(R기간),1) 지표조건 L기간 15 R기간 12 H 연장라인을 변동성라인이 돌파하는 검색식 부탁드립니다 감사 합니다
프로필 이미지
구경꾼그림자
2024-05-17
833
글번호 179615
종목검색
답변완료

안녕하세요

1. 일봉에서의 adx값을 리턴하는 사용자함수 2. 일봉에서의 atr값을 리턴하는 사용자함수 3. 일봉에서의 볼밴의 좁아짐 정도값을 리턴하는 사용자 함수 4. 아래는 일전에 짜주신내용인데 선행조건을 만족하지 않아도 그냥 피봇만 크로스업 다운하면 신호가 발생하기도 하네요 Var : Pv(0),R1(0),R2(0),S1(0),S2(0); var : T(0),T1(0),T2(0),T3(0); Pv = (HighD(1)+LowD(1)+CloseD(1))/3; R1 = 2*Pv-LowD(1); R2 = Pv+HighD(1)-LowD(1); S1 = 2*Pv-HighD(1); S2 = Pv-HighD(1)+LowD(1); if CrossUp(c,R2) or CrossDown(c,R2) Then { T = 5; T1 = T[1]; T2 = T1[1]; T3 = T2[1]; } if CrossUp(c,R1) or CrossDown(c,R1) Then { T = 4; T1 = T[1]; T2 = T1[1]; T3 = T2[1]; } if CrossUp(c,Pv) or CrossDown(c,Pv) Then { T = 3; T1 = T[1]; T2 = T1[1]; T3 = T2[1]; } if CrossUp(c,S1) or CrossDown(c,S1) Then { T = 2; T1 = T[1]; T2 = T1[1]; T3 = T2[1]; } if CrossUp(c,S2) or CrossDown(c,S2) Then { T = 1; T1 = T[1]; T2 = T1[1]; T3 = T2[1]; } if T1 == 3 and T2 == 2 Then Sell(); 항상 감사합니다 ^^
프로필 이미지
돈을잃자
2024-05-17
818
글번호 179614
지표
답변완료

수식 문의 드립니다.

혹시,, 20틱 익절을 하고 싶은데 진입과 동시에 그 가격에 주문이 들어가게끔 하는 수식이 있나요? (예를들어 18000에 매수가 들어가면 5포인트 위인 18005에 바로 매도주문을 들어가게요.)
프로필 이미지
무청
2024-05-16
749
글번호 179610
시스템
답변완료

수식 부탁드립니다.

전일 아침부터 전일 동시간대까지 거래된 합계거래량을 지표식으로 표시 부탁드립니다.
프로필 이미지
이지화
2024-05-16
681
글번호 179601
지표
답변완료

문의드립니다.

고맙습니다. 죄송하기도 합니다. 아래 문의드렸던 것들은 대부분 해결했습니다. 그동안 알려주신 것들을 차분히 돌려봤습니다. 5번에 대해서만 알려주시면 될 거 같습니다. 늘 친절한 가르침에 고맙습니다. # 오전 질문내용 아직도 index가 자꾸 헷갈립니다. 1. 처음 고점을 찍은 캔들번호 2. 최종 고점을 찍은 캔들번호 3. 진입자리 캔들번호 4. else 사용법이 맞나요? 마지막 else는 처음 포지션이 1이고 고가가 고점일 때 적용되나요? 고가가 고점이 아니어도 적용되나요? 5. 진입조건식에 진입시간을 넣으려면 어떻게 해야 하나요? 예;07시30분부터 09시까지만 진입
프로필 이미지
산골소년
2024-05-16
666
글번호 179600
시스템
답변완료

종목검색식 요청드립니다.

아래 키움수식신호가 N기간 내에 발생한 모든 종목을 검색하는 검색식을 만들고 싶습니다. 도움 부탁드립니다. 감사합니다. a=avg(V,10); a(1)*10<=V and 거래대금 > 50000 and C>O and C>C(1)*1.1
프로필 이미지
onlypsn
2024-05-16
603
글번호 179598
종목검색