Tradview Strategy

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

hull suite

//@version=4
//Basic Hull Ma Pack tinkered by InSilico
study("Hull Suite by InSilico", overlay=true)

//INPUT
src = input(close, title="Source")
modeSwitch = input("Hma", title="Hull Variation", options=["Hma", "Thma", "Ehma"])
length = input(55, title="Length(180-200 for floating S/R , 55 for swing entry)")
lengthMult = input(1.0, title="Length multiplier (Used to view higher timeframes
with straight band)")

useHtf = input(false, title="Show Hull MA from X timeframe? (good for scalping)")


htf = input("240", title="Higher timeframe", type=input.resolution)

switchColor = input(true, "Color Hull according to trend?")


candleCol = input(false,title="Color candles based on Hull's Trend?")
visualSwitch = input(true, title="Show as a Band?")
thicknesSwitch = input(1, title="Line Thickness")
transpSwitch = input(40, title="Band Transparency",step=5)

//FUNCTIONS
//HMA
HMA(_src, _length) => wma(2 * wma(_src, _length / 2) - wma(_src, _length),
round(sqrt(_length)))
//EHMA
EHMA(_src, _length) => ema(2 * ema(_src, _length / 2) - ema(_src, _length),
round(sqrt(_length)))
//THMA
THMA(_src, _length) => wma(wma(_src,_length / 3) * 3 - wma(_src, _length / 2) -
wma(_src, _length), _length)

//SWITCH
Mode(modeSwitch, src, len) =>
modeSwitch == "Hma" ? HMA(src, len) :
modeSwitch == "Ehma" ? EHMA(src, len) :
modeSwitch == "Thma" ? THMA(src, len/2) : na

//OUT
_hull = Mode(modeSwitch, src, int(length * lengthMult))
HULL = useHtf ? security(syminfo.ticker, htf, _hull) : _hull
MHULL = HULL[0]
SHULL = HULL[2]

//COLOR
hullColor = switchColor ? (HULL > HULL[2] ? #00ff00 : #ff0000) : #ff9800

//PLOT
///< Frame
Fi1 = plot(MHULL, title="MHULL", color=hullColor, linewidth=thicknesSwitch,
transp=50)
Fi2 = plot(visualSwitch ? SHULL : na, title="SHULL", color=hullColor,
linewidth=thicknesSwitch, transp=50)
alertcondition(crossover(MHULL, SHULL), title="Hull trending up.", message="Hull
trending up.")
alertcondition(crossover(SHULL, MHULL), title="Hull trending down.", message="Hull
trending down.")
///< Ending Filler
fill(Fi1, Fi2, title="Band Filler", color=hullColor, transp=transpSwitch)
///BARCOLOR
barcolor(color = candleCol ? (switchColor ? hullColor : na) : na)

-----------------------------------------------------------------------------------
-----------------------------------------------------

supertrend

//@version=4
study("Supertrend", overlay = true, format=format.price, precision=2,
resolution="")

Periods = input(title="ATR Period", type=input.integer, defval=10)


src = input(hl2, title="Source")
Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
changeATR= input(title="Change ATR Calculation Method ?", type=input.bool,
defval=true)
showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true)
highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
atr2 = sma(tr, Periods)
atr= changeATR ? atr(Periods) : atr2
up=src-(Multiplier*atr)
up1 = nz(up[1],up)
up := close[1] > up1 ? max(up,up1) : up
dn=src+(Multiplier*atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr,
linewidth=2, color=color.green)
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute,
style=shape.circle, size=size.tiny, color=color.green, transp=0)
plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy",
location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green,
textcolor=color.white, transp=0)
dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr,
linewidth=2, color=color.red)
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal ? dn : na, title="DownTrend Begins",
location=location.absolute, style=shape.circle, size=size.tiny, color=color.red,
transp=0)
plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell",
location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red,
textcolor=color.white, transp=0)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
longFillColor = highlighting ? (trend == 1 ? color.green : color.white) :
color.white
shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) :
color.white
fill(mPlot, upPlot, title="UpTrend Highligter", color=longFillColor)
fill(mPlot, dnPlot, title="DownTrend Highligter", color=shortFillColor)
alertcondition(buySignal, title="SuperTrend Buy", message="SuperTrend Buy!")
alertcondition(sellSignal, title="SuperTrend Sell", message="SuperTrend Sell!")
changeCond = trend != trend[1]
alertcondition(changeCond, title="SuperTrend Direction Change", message="SuperTrend
has changed direction!")

-----------------------------------------------------------------------------------
---------------------------------------------------------------------

donchain trend ribbon

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

//@version=4
study("Donchian Trend Ribbon", precision = 0)
dlen = input(defval = 20, title = "Donchian Channel Period", minval = 10)

dchannel(len)=>
float hh = highest(len)
float ll = lowest(len)

int trend = 0
trend := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(trend[1])

dchannelalt(len, maintrend)=>
float hh = highest(len)
float ll = lowest(len)

int trend = 0
trend := close > hh[1] ? 1 : close < ll[1] ? -1 : nz(trend[1])
maintrend == 1 ? trend == 1 ? #00FF00ff : #00FF009f :
maintrend == -1 ? trend == -1 ? #FF0000ff : #FF00009f :
na

maintrend = dchannel(dlen)

plot( 5, color = dchannelalt(dlen - 0, maintrend), style = plot.style_columns,


histbase= 0)
plot(10, color = dchannelalt(dlen - 1, maintrend), style = plot.style_columns,
histbase= 5)
plot(15, color = dchannelalt(dlen - 2, maintrend), style = plot.style_columns,
histbase=10)
plot(20, color = dchannelalt(dlen - 3, maintrend), style = plot.style_columns,
histbase=15)
plot(25, color = dchannelalt(dlen - 4, maintrend), style = plot.style_columns,
histbase=20)
plot(30, color = dchannelalt(dlen - 5, maintrend), style = plot.style_columns,
histbase=25)
plot(35, color = dchannelalt(dlen - 6, maintrend), style = plot.style_columns,
histbase=30)
plot(40, color = dchannelalt(dlen - 7, maintrend), style = plot.style_columns,
histbase=35)
plot(45, color = dchannelalt(dlen - 8, maintrend), style = plot.style_columns,
histbase=40)
plot(50, color = dchannelalt(dlen - 9, maintrend), style = plot.style_columns,
histbase=45)
-----------------------------------------------------------------------------------
-------------------------------------------------
hull suite settings
input
source=close
hull varation=Hma
length=50
length multipler=3
--------------------------------
supertrend settings
atr period=50
source=hl2
atrmultiplier=5.1
---------------------------
donchain settings
channel period=30

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy