Kusama / Tether
Pembelian

Go go

89
//version=4
study(title="OBV Divergence Indicator")

pivot_right = 5
pivot_left = 5
max_range=50
min_range=5

obv_value=obv
plot(obv_value, title="OBV", linewidth=2, color=color.black)


//check if we have pivot low in obv
pivot_low_true = na(pivotlow(obv_value, pivot_left, pivot_right)) ? false : true //returns price of the pivot low point. It returns 'NaN', if there was no pivot low point.

//Create a function that returns true/false
confirm_range(x) =>
bars = barssince(x == true) //Counts the number of bars since the last time the condition was true
min_range <= bars and bars <= max_range // makes ure bars is less than 60 and less than 5 and returns true

//------------------------------------------------------------------------------
// obv higher low check

OBV_HL_check = obv_value[pivot_right] > valuewhen(pivot_low_true, obv_value[pivot_right], 1) and confirm_range(pivot_low_true[1])

// Price Lower Low check

price_ll_check = low[pivot_right] < valuewhen(pivot_low_true, low[pivot_right], 1)

bullCond = price_ll_check and OBV_HL_check and pivot_low_true

//Plot the areas, terneary conditional operator
plot(
pivot_low_true ? obv_value[pivot_right] : na,
offset=-pivot_right,
linewidth=3,
color=(bullCond ? color.green : color.new(color.white, 100)))//colornew applies the specified transparency to the given color

)

plotshape(
bullCond ? obv_value[pivot_right] : na,
offset=-pivot_right,
text=" BUY ",
style=shape.labelup,
location=location.absolute,
color=color.green,
textcolor=color.white

)

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.