커뮤니티

문의드립니다.

프로필 이미지
고민중
2023-06-11 23:41:11
1410
글번호 169664
답변완료
트레이딩뷰에서 참조해온, 시간단위의 바 표시를 거래량단위의 바표시로 바꾸는 수식입니다. 예스랭귀지로 변환해서 사용가능할지 문의드리며, 사용가능하다면 예스랭귀지로 변환하고 싶습니다. //*** Functions changed(x) => x != x[1] //*** Inputs price = input(open, "Price Data") bartype = input("Volume Bar", "Bar Type", options=["Volume Bar","Dollar Bar"]) delta = input(34, "Delta", minval=0., step=.01) //*** Main bar = 0.0 bar := (bartype=="Volume Bar" ? nz(bar) + volume : nz(bar) + volume * price) bar := bar > delta ? 0.0 : bar long = nz(bar) + volume > delta and open < close short = nz(bar) + volume > delta and open > close state = 0 state := long ? 1 : short ? -1 : nz(state[1]) longst = changed(state) and state[1]==-1 shortst = changed(state) and state[1]==1 plotshape(longst ? low : na, location=location.belowbar, style=shape.triangleup, color=color.lime, size=size.tiny, text=" ", textcolor=color.white, transp=0) plotshape(shortst ? high : na, location=location.abovebar, style=shape.triangledown, color=color.red, size=size.tiny, text=" ", textcolor=color.white, transp=0)
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-06-12 13:54:22

안녕하세요 예스스탁입니다. input : price(open); input : bartype(1);#1:Volume Bar, 2:Dollar Bar input : delta(34); var : bar(0),long(False),short(False),state(0); var : longst(False),shortst(False),tx(0); bar = 0.0; bar = IFf(bartype==1, bar + volume , bar + volume * price); bar = iff(bar > delta , 0.0 , bar); long = bar + volume > delta and open < close; short = bar + volume > delta and open > close; state = 0; state = iff(long , 1 , iff(short , -1 , state[1])); longst = state != state[1] and state[1]==-1; shortst = state != state[1] and state[1]==1 ; if longst == true Then { tx = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Lime); } if shortst == true Then { tx = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Red); } 즐거운 하루되세요 > 고민중 님이 쓴 글입니다. > 제목 : 문의드립니다. > 트레이딩뷰에서 참조해온, 시간단위의 바 표시를 거래량단위의 바표시로 바꾸는 수식입니다. 예스랭귀지로 변환해서 사용가능할지 문의드리며, 사용가능하다면 예스랭귀지로 변환하고 싶습니다. //*** Functions changed(x) => x != x[1] //*** Inputs price = input(open, "Price Data") bartype = input("Volume Bar", "Bar Type", options=["Volume Bar","Dollar Bar"]) delta = input(34, "Delta", minval=0., step=.01) //*** Main bar = 0.0 bar := (bartype=="Volume Bar" ? nz(bar) + volume : nz(bar) + volume * price) bar := bar > delta ? 0.0 : bar long = nz(bar) + volume > delta and open < close short = nz(bar) + volume > delta and open > close state = 0 state := long ? 1 : short ? -1 : nz(state[1]) longst = changed(state) and state[1]==-1 shortst = changed(state) and state[1]==1 plotshape(longst ? low : na, location=location.belowbar, style=shape.triangleup, color=color.lime, size=size.tiny, text=" ", textcolor=color.white, transp=0) plotshape(shortst ? high : na, location=location.abovebar, style=shape.triangledown, color=color.red, size=size.tiny, text=" ", textcolor=color.white, transp=0)