커뮤니티

지표변환 및 종목검색식

프로필 이미지
기도니
2026-07-02 09:51:38
238
글번호 232643
답변완료

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

// © veryfid


//@version=4

study("Volatility Oscillator", resolution = "")

length = input(100)

spike = close - open

x = stdev(spike,length)

y = stdev(spike,length) * -1


plot(spike, color = color.white, linewidth = 2, title = "Spike Line")


p1 = plot(x, "Upper Line")

p2 = plot(y, "Lower Line")


plot(0, color= color.gray, title= "Zero Line")


plot(spike, color= color.blue, style=plot.style_area, transp=80, title = "Spike Fill")


osc2 = spike


lbR = 5

lbL = 5

rangeUpper =60

rangeLower = 5

plotBull = input(title="Plot Bullish", defval=true)

plotHiddenBull = input(title="Plot Hidden Bullish", defval=false)

plotBear = input(title="Plot Bearish", defval=true)

plotHiddenBear = input(title="Plot Hidden Bearish", defval=false)

delay_plot_til_closed = input(title="Delay diversion plot until candle is closed (don't repaint)", defval=false)

bearColor = color.red

bullColor = color.green

hiddenBullColor = color.new(color.green, 80)

hiddenBearColor = color.new(color.red, 80)

textColor = color.white

noneColor = color.new(color.white, 100)


repaint = (not(delay_plot_til_closed) or barstate.ishistory or barstate.isconfirmed)


plFound = na(pivotlow(osc2, lbL, lbR)) ? false : true

phFound = na(pivothigh(osc2, lbL, lbR)) ? false : true

_inRange(cond) =>

bars = barssince(cond == true)

rangeLower <= bars and bars <= rangeUpper


//------------------------------------------------------------------------------

// Regular Bullish

// Osc: Higher Low


oscHL = osc2[lbR] > valuewhen(plFound, osc2[lbR], 1) and _inRange(plFound[1])


// Price: Lower Low


priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1)

bullCond = plotBull and priceLL and oscHL and plFound and repaint



plotshape(

bullCond ? osc2[lbR] : na,

offset=-lbR,

title="Regular Bullish Label",

text="R",

style=shape.labelup,

location=location.absolute,

color=bullColor,

textcolor=textColor,

transp=0

)


//------------------------------------------------------------------------------

// Hidden Bullish

// Osc: Lower Low


oscLL = osc2[lbR] < valuewhen(plFound, osc2[lbR], 1) and _inRange(plFound[1])


// Price: Higher Low


priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1)

hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound and repaint




plotshape(

hiddenBullCond ? osc2[lbR] : na,

offset=-lbR,

title="Hidden Bullish Label",

text="H",

style=shape.labelup,

location=location.absolute,

color=bullColor,

textcolor=textColor,

transp=0

)


//------------------------------------------------------------------------------

// Regular Bearish

// Osc: Lower High


oscLH = osc2[lbR] < valuewhen(phFound, osc2[lbR], 1) and _inRange(phFound[1])


// Price: Higher High


priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1)


bearCond = plotBear and priceHH and oscLH and phFound and repaint




plotshape(

bearCond ? osc2[lbR] : na,

offset=-lbR,

title="Regular Bearish Label",

text="R",

style=shape.labeldown,

location=location.absolute,

color=bearColor,

textcolor=textColor,

transp=0

)


//------------------------------------------------------------------------------

// Hidden Bearish

// Osc: Higher High


oscHH = osc2[lbR] > valuewhen(phFound, osc2[lbR], 1) and _inRange(phFound[1])


// Price: Lower High


priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1)


hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound and repaint




plotshape(

hiddenBearCond ? osc2[lbR] : na,

offset=-lbR,

title="Hidden Bearish Label",

text="H",

style=shape.labeldown,

location=location.absolute,

color=bearColor,

textcolor=textColor,

transp=0

)


//barcolor(color = spike > 0 ? color.green : color.red )



트레이딩 뷰 지표의 Volatility Oscillator지표입니다

1. 지표변환

2. 종목검색 : spike Line이 Upper Line 돌파

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-07-02 14:30:20

안녕하세요 예스스탁입니다. 1 종목검색 input : length(100); var : spike(0),x(0),y(0); spike = close - open; x = std(spike,length); y = std(spike,length) * -1; if CrossUp(spike,x) Then Find(1); 2 지표 input : length(100); var : spike(0),x(0),y(0),osc2(0); var : lbr(0),lbl(0),rangeUpper(60),rangeLower(5); input : plotBull(true); input : plotHiddenBull(false); input : plotBear(true); input : plotHiddenBear(false); input : delay_plot_til_closed(false); var : bearColor(Red),bullColor(Green),hiddenBullColor(Green),hiddenBearColor(Green),textColor(White),noneColor(White); var : plFound(False),phFound(False); var : b1(0),o1(0),l1(0); var : oscHL(False),priceLL(False),bullCond(False),tx1(0); var : oscLL(False),priceHL(False),hiddenBullCond(False),tx2(0); var : oscLH(False),priceHH(False),bearCond(False); var : b2(0),o2(0),h2(0),tx3(0); var : oscHH(False),priceLH(False),hiddenBearCond(False),tx4(0); spike = close - open; x = std(spike,length); y = std(spike,length) * -1; plot1(spike,"Spike Line"); plot2(x, "Upper Line"); plot3(y, "Lower Line"); plot4(0, "Zero Line",Gray); osc2 = spike; if SwingLowBar(1,osc2, lbL, lbR,lbL+lbR+1) == -1 Then plFound = false; Else plFound = true; if SwinghighBar(1,osc2, lbL, lbR,lbL+lbR+1) == -1 Then phFound = false; Else phFound = true; if plFound[1] == true Then b1 = 0; Else b1 = b1+1; if plFound == true Then { o1 = osc2[lbr]; l1 = low[lbr]; } oscHL = osc2[lbR] > o1 and rangeLower <= b1 and b1 <= rangeUpper; priceLL = low[lbR] < l1; bullCond = plotBull and priceLL and oscHL and plFound; if bullCond == true Then { tx1 = Text_New_Self(sDate[lbR],sTime[lbR],osc2[lbR],"▲"); Text_SetStyle(tx1,2,0); Text_SetColor(tx1,bullColor); } oscLL = osc2[lbR] < o1 and rangeLower <= b1 and b1 <= rangeUpper; priceHL = low[lbR] > l1; hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound; if hiddenBullCond == true Then { tx2 = Text_New_Self(sDate[lbR],sTime[lbR],osc2[lbR],"▲"); Text_SetStyle(tx2,2,0); Text_SetColor(tx2,bullColor); } if phFound[1] == true Then b2 = 0; Else b2 = b2+1; if phFound == true Then { o2 = osc2[lbR]; h2 = high[lbR]; } oscLH = osc2[lbR] < o2 and rangeLower <= b2 and b2 <= rangeUpper; priceHH = high[lbR] > h2; bearCond = plotBear and priceHH and oscLH and phFound; if hiddenBullCond == true Then { tx3 = Text_New_Self(sDate[lbR],sTime[lbR],osc2[lbR],"▼"); Text_SetStyle(tx3,2,1); Text_SetColor(tx3,bearColor); } oscHH = osc2[lbR] > o2 and rangeLower <= b2 and b2 <= rangeUpper; priceLH = high[lbR] < h2; hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound; if hiddenBullCond == true Then { tx4 = Text_New_Self(sDate[lbR],sTime[lbR],osc2[lbR],"▼"); Text_SetStyle(tx4,2,1); Text_SetColor(tx4,bearColor); } 즐거운 하루되세요