NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

1. KOD

//@version=4
//@author=LucF

// Weis Wave Volume with alerts [LucF]
// v2.1, 2019.12.09 16:26 — LucF

// Shows cumulative volume for each price wave.
// Alerts on: wave transitions, breach of last wave's length, breach of last wave's height and breach of average wave height.

// Credits to LazyBear for original Weis Wave code in Pine (a David Weis concept).

// This indicator's TV page: https://www.tradingview.com/script/refensvb-Weis-Wave-Volume-with-alert-LazyBear-LF/

study("Weis Wave Volume with alerts [LucF]", "Weis Wave Volume with alerts")

// ———————————————————— Colors
myGreenRaw = color.new(#00FF00,0), myGreenMedium = color.new(#00FF00,30), myGreenSemiDark = color.new(#00FF00,50), myGreenDark = color.new(#00FF00,70), myGreenDarkDark = color.new(#00FF00,80), myGreenDarkDarkDark = color.new(#00FF00,88)
myRedRaw = color.new(#FF0000,0), myRedMedium = color.new(#FF0000,25), myRedSemiDark = color.new(#FF0000,50), myRedDark = color.new(#FF0000,60), myRedDarkDark = color.new(#FF0000,75), myRedDarkDarkDark = color.new(#FF0000,85)
myOrangeRaw = color.new(#FF9800,0), myOrangeMedium = color.new(#FF9800,30), myOrangeSemiDark = color.new(#FF9800,50), myOrangeDark = color.new(#FF9800,65), myOrangeDarkDark = color.new(#FF9800,80)
myYellowRaw = color.new(color.yellow,0), myYellowMedium = color.new(color.yellow,25), myYellowSemiDark = color.new(color.yellow,50), myYellowDark = color.new(color.yellow,70)
myFuchsiaRaw = color.new(color.fuchsia,0), myFuchsiaMedium = color.new(color.fuchsia,30), myFuchsiaSemiDark = color.new(color.fuchsia,45),myFuchsiaDark = color.new(color.fuchsia,60)
myBlueRaw = color.new(#4985E7,0), myBlueMedium = color.new(#4985E7,20), myBlueDark = color.new(#4985E7,55)
myPurpleRaw = color.new(#6123db, 0), myPurpleMedium = color.new(#6123db,30), myPurpleDark = color.new(#6123db,65)
myGrayRaw = color.new(color.gray, 0), myGrayMedium = color.new(color.gray, 35), myGrayDark = color.new(color.gray, 70)
myGreenBackGround = color.new(#00FF00,91), myRedBackGround = color.new(#FF0000,90), invisible = color.new(color.white, 100)


// ———————————————————— Inputs
TD1 = "1. Both", TD2 = "2. Longs Only", TD3 = "3. Shorts Only"
DP1 = "1. Area", DP2 = "2. Columns", DP3 = "3. Histogram"
displayMode = input(DP2, "Display mode:", options = [DP1, DP2, DP3])
showBearishNeg = input(false, "Show bearish waves below zero")
showAvgWave = input(false, "Show average wave height")
showLastHighestAvg = input(false, "Show last wave's height")
trendReversalLength = input(2, "Trend reversal length", minval=2)
priceSource = input(close, "Price source for trend detection")
colorAvg = input(true, "Average wave volume: show rising/falling state")
colorBars = input(false, "...Color chart bars")
_4 = input(false, "═══════════════ Markers ═══════════════")
tradeDirection = input(TD1, "Trade direction", options=[TD1, TD2, TD3])
showMarker1 = input(false, "Marker 1: Wave change")
showMarker2 = input(false, "Marker 2: First breach of last wave's height")
showMarker2Bg = input(false, "...Show all breaches in background")
showMarker3 = input(false, "Marker 3: First breach of previous wave's length")
showMarker4 = input(false, "Marker 4: First breach of average wave height")
shortsOnly = tradeDirection == TD3
longsOnly = tradeDirection == TD2
displayChoice = displayMode == DP1 ? plot.style_area : displayMode == DP2 ? plot.style_columns : plot.style_histogram
lineWidth = displayMode == DP1 ? 1 : 8


// ———————————————————— Detect Price Waves
var trend = 0
var wave = 0
upOrDn = priceSource > priceSource[1] ? 1 : priceSource < priceSource[1] ? -1 : 0 // Price movement Up->1, Dn->-1, No change->0
trend := (upOrDn != 0) and (upOrDn != upOrDn[1]) ? upOrDn : trend // Trend changes when price reverses direction.
reversalTrend = rising(priceSource, trendReversalLength) or falling(priceSource, trendReversalLength) // Detect reversal condition.
wave := (trend != wave and reversalTrend) ? trend : wave // Stay in wave until a counter trend of trendDetectionLength occurs.
bullWave = wave == 1
bearWave = wave == -1
sameWave = wave == wave[1]


// ———————————————————— Wave calcs
// ————— Build total volume for current wave.
var cumVolume = 0.0
cumVolume := sameWave ? cumVolume + volume : volume
// ————— Number of bars in wave.
var waveBars = 0
var lastWaveBars = 0
waveBars := sameWave ? waveBars + 1 : 1
// ————— Average volume in wave.
averageWaveVolume = cumVolume / waveBars
// ————— Consecutive increasing average volume bars in same wave.
var increasingBars = 0
increasingBars := sameWave ? averageWaveVolume > nz(averageWaveVolume[1]) ? increasingBars + 1 : 0 : 0
// ————— Average end of wave total for all waves in history.
var wavesTot = 0
var wavesTotVol = 0.0
var wavesTotAvg = 0.0
// ————— Saves last wave's high for display.
var lastWaveHi = 0.0
// Update numbers when changing waves.
if not sameWave
// Last wave's bar count.
lastWaveBars := nz(waveBars[1])
// Last wave's high.
lastWaveHi := cumVolume[1]
// Update average of end of wave total.
wavesTot := wavesTot + 1
wavesTotVol := wavesTotVol + nz(cumVolume[1])
wavesTotAvg := wavesTotVol / wavesTot


// ———————————————————— Plots
// ————— Area, columns or histogram, as per user choice.
avgUp = rising(averageWaveVolume, 1)
colorOfAvg = bullWave ? avgUp and colorAvg ? myGreenDark : myGreenDarkDark : avgUp and colorAvg ? myRedDark : myRedDarkDark
colorOfBars = colorBars ? bullWave ? avgUp and close > open ? myGreenRaw : na : avgUp and close < open ? myFuchsiaRaw : na : na
plot(showBearishNeg and bearWave ? -cumVolume : cumVolume, "Wave volume", colorOfAvg, lineWidth, displayChoice)
// ————— Last wave's high.
plot(showLastHighestAvg and not showBearishNeg ? lastWaveHi : na, "Height of last wave", not sameWave ? invisible : bullWave ? myRedMedium : myGreenMedium, 2, plot.style_line, offset = -1)
// ————— Average of wave heights.
plot(showAvgWave ? wavesTotAvg : na, "Average wave height", myOrangeDark)
plot(showAvgWave and showBearishNeg ? -wavesTotAvg : na, "Average wave height (negative)", myOrangeDark)
// ————— Color bars.
barcolor(colorOfBars)


// ———————————————————— Markers
// ————— Marker 1: Wave change.
M1U = showMarker1 and not shortsOnly and bullWave and not bullWave[1]
M1D = showMarker1 and not longsOnly and bearWave and not bearWave[1]
// ————— Marker 2: Breach of last wave's high.
C2U = not shortsOnly and bullWave and cumVolume > lastWaveHi
C2D = not longsOnly and bearWave and cumVolume > lastWaveHi
M2U = showMarker2 and C2U and barssince(not sameWave) < barssince(C2U[1])
M2D = showMarker2 and C2D and barssince(not sameWave) < barssince(C2D[1])
// ————— Marker 3: Waves length surpasses previous wave's length.
C3U = showMarker3 and not shortsOnly and bullWave and waveBars > lastWaveBars
C3D = showMarker3 and not longsOnly and bearWave and waveBars > lastWaveBars
M3U = C3U and barssince(not sameWave) < barssince(C3U[1])
M3D = C3D and barssince(not sameWave) < barssince(C3D[1])
// ————— Marker 4: Wave volume surpasses avg wave volume.
C4U = showMarker4 and not shortsOnly and bullWave and cumVolume > wavesTotAvg
C4D = showMarker4 and not longsOnly and bearWave and cumVolume > wavesTotAvg
M4U = C4U and barssince(not sameWave) < barssince(C4U[1])
M4D = C4D and barssince(not sameWave) < barssince(C4D[1])

plotshape(M1U, "Marker 1 Up", shape.triangleup, location.top, myGreenMedium, size = size.tiny, text = "1")
plotshape(M1D, "Marker 1 Dn", shape.triangledown, location.top, myRedMedium, size = size.tiny, text = "1")
plotshape(M2U, "Marker 2 Up", shape.triangleup, location.top, myGreenMedium, size = size.tiny, text = "2")
plotshape(M2D, "Marker 2 Dn", shape.triangledown, location.top, myRedMedium, size = size.tiny, text = "2")
plotshape(M3U, "Marker 3 Up", shape.triangleup, location.top, myGreenMedium, size = size.tiny, text = "3")
plotshape(M3D, "Marker 3 Dn", shape.triangledown, location.top, myRedMedium, size = size.tiny, text = "3")
plotshape(M4U, "Marker 4 Up", shape.triangleup, location.top, myGreenMedium, size = size.tiny, text = "4")
plotshape(M4D, "Marker 4 Dn", shape.triangledown, location.top, myRedMedium, size = size.tiny, text = "4")
bgcolor(showMarker2Bg ? C2U ? myGreenBackGround : C2D ? myRedBackGround : na : na)

// // ———————————————————— Alert
alertcondition(M1U or M1D or M2U or M2D or M3U or M3D or M4U or M4D, "WW: Configured Markers", "WW Marker")




2. KOD



//Created By ChrisMoody on 8/15/2014
///RSI with ability to change first RSI to a different Timeframe.
//option to Plot 2nd RSI to show different Timeframes on same chart

study(title="CM_Ultimate RSI MTF", shorttitle="CM_Ult_RSI_MTF", precision=0)
src = close
len = input(14, minval=1, title="Length")
upLine = input(70, minval=50, maxval=90, title="Upper Line Value?")
lowLine = input(30, minval=10, maxval=50, title="Lower Line Value?")
sml = input(true, title="Show Mid Line?")
sbh = input(true, title="Show Back Ground Highlights When RSI is Above/Below High/Low Lines?")
sch = input(true, title="Show Back Ground Highlights When RSI Cross?")
sl = input(true, title="Show 'B' and 'S' Letters When RSI Crosses High/Low Line?")
useCurrentRes = input(true, title="Use Current Chart Resolution?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="60")
ssRSI = input(false, title="Show 2nd RSI?")
resCustom2 = input(title="Use 2nd RSI? Check Box Above", type=resolution, defval="D")
useCurrentRes2 = input(false, title="Use 2nd RSI Plot On Samet Timeframe?")
len2 = input(14, minval=1, title="2nd RSI Length")

res = useCurrentRes ? period : resCustom
res2 = useCurrentRes2 ? period : resCustom2

up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
outRSI = security(tickerid, res, rsi)

up2 = rma(max(change(src), 0), len2)
down2 = rma(-min(change(src), 0), len2)
rsi2 = down2 == 0 ? 100 : up2 == 0 ? 0 : 100 - (100 / (1 + up2 / down2))
outRSI2 = security(tickerid, res2, rsi2)

aboveLine = outRSI > upLine ? 1 : 0
belowLine = outRSI < lowLine ? 1 : 0
crossUp = outRSI[1] < lowLine and outRSI > lowLine ? 1 : 0
crossDn = outRSI[1] > upLine and outRSI < upLine ? 1 : 0

bgcolor(sbh and aboveLine ? red : na, transp=70)
bgcolor(sbh and belowLine ? green : na, transp=70)
bgcolor(sch and crossUp ? lime : na, transp=40)
bgcolor(sch and crossDn ? red : na, transp=40)

plot(outRSI, title="RSI", style=line, linewidth=3, color=aqua)
plot(ssRSI and outRSI2 ? outRSI2 : na, title="2nd RSI - Different Time Frame?", style=linebr, linewidth=4, color=orange)
p1 = plot(upLine, title= "Upper Line", style=solid, linewidth=3, color=red)
p2 = plot(lowLine, title= "Lower Line", style=solid, linewidth=3, color=lime)
plot(sml and 50 ? 50 : na, title="Mid Line", style=linebr, linewidth=2, color=gray)
plotchar(sl and crossUp ? crossUp : na, title="Buy Signal", char='B', location=location.bottom, color=lime, transp=0, offset=0)
plotchar(sl and crossDn ? crossDn : na, title="Sell Signal", char='S', location=location.top, color=red, transp=0, offset=0)
fill(p1, p2, color=silver, transp=70)
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.