Professional Documents
Culture Documents
1112
1112
1112
/////////VWAP
/////////////////////////////////////////////////////
//////////////
///// END VWAP
////////////
//////////////////////////////////////////////////////
/////////PARABOLIC SAR
/////////////////////////////////////////////////////
show_ps = input (false,title="----------Show Parabolic SAR---------")
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = sar(start, increment, maximum)
plot(show_ps? out : na, "ParabolicSAR", style=plot.style_cross, color=#2962FF)
//////////////
///// END PARABOLIC SAR
////////////
//////////////////
// KONCORDE
///////////////////
// Bands Calculation
basisK = sma(tprice, boLength) //Find the 20-day moving average average (n1 +
n2 ... + n20)/20
devK = mult * stdev(tprice, boLength) //Find the standard deviation of the 20-days
upperK = basisK + devK //Upper Band = 20-day Moving Average + (2 x standard
deviation of the 20-days)
lowerK = basisK - devK //Lower Band = 20-day Moving Average - (2 x standard
deviation of the 20-days)
OB1 = (upperK + lowerK) / 2.0
OB2 = upperK - lowerK
buy_cK = crossover(marron,media)
sell_cK = crossunder(marron,media)
plotshape(ShowBuySellArrowsK and buy_cK, "Buy", shape.triangleup,
location.belowbar, color.green, text="Buy", textcolor = color.green)
plotshape(ShowBuySellArrowsK and sell_cK, "Sell", shape.triangledown,
location.abovebar, color.red, text="Sell",textcolor = color.red)
//////////////////
// KONCORDE
///////////////////
//////////////////////////
////BOLLINGER BANDS
////////////////////
show_BB = input(false, title="--------- Show Bollinger ---------")
lengthB = input(20, minval=1)
srcB = input(close, title="Source")
//mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
basis = sma(srcB, lengthB)
dev = mult * stdev(srcB, lengthB)
upper = basis + dev
lower = basis - dev
offsetB = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
plot(show_BB ? basis : na, "Basis", color=#919191, offset = offsetB)
p1 = plot(show_BB ? upper : na , "Upper", color=#ff0059, offset = offsetB)
p2 = plot(show_BB ? lower: na, "Lower", color=#ff0059, offset = offsetB)
fill(p1, p2, title = "Background", color=color.rgb(255, 205, 222, 95))
//////
///
///////
/////////////
////ATR
//////////////
///////////
//////END ATR
//////////////////
//////////////////
//// ICHIMOKU
///////////////////////////
//Input
show_ich = input ( false , title = "--------Show Ichimoku---------")
tenkanIN = input(9, minval= 1, title="Tenkan"),
kijunIN = input(26, minval= 1, title="Kijun")
spanBIN = input(52, minval= 1, title="Span B"),
chikouIN = input(26, minval= 1, title="Chikou")
srcI = input(close, title="Source")
ShowAlert = input(defval = true, title="Show Alert")
//Setting
donchian(len) => avg(lowest(len), highest(len))
tenkan = donchian(tenkanIN)
kijun = donchian(kijunIN)
spanA = avg(tenkan, kijun)
spanB = donchian(spanBIN)
chikou = srcI, offset = -chikouIN
Color00 = #f57f17//Orange
Color02 = #f57f17ff//Orange 100%
Color10 = #006400//Green
Color13 = #388e3c//Light Green
Color20 = #8B0000//Red
Color23 = #b71c1c//Light Red
Color30 = #ffffff//White
//Drawing
plot(show_ich ? tenkan : na, title="Tenkan", color= Color10)
plot(show_ich ? kijun : na, title="Kijun", color= Color20)
plot(show_ich ? srcI : na, offset = -chikouIN + 1, title="Chikou", color= Color00
, linewidth = 2)
kumoA = plot(show_ich ? spanA : na, offset = chikouIN - 1, title="Span A", color=
na)
kumoB = plot(show_ich ? spanB : na , offset = chikouIN - 1, title="Span B", color=
na)
fill(kumoA, kumoB, title="Kumo", color = show_ich ? colorKumo : na,
transp= 75)
//////////////////
///// END ICHIMOKU
///////////////////////////
//////////////////
/////BUYSELLSIGNALS
///////////////////////////
//Momentum
sz = linreg(close - avg(avg(highest(high, 20), lowest(low, 20)), sma(close, 20)),
20, 0)
//ADX
adxlen = 14 //input(14, title = "ADX Smoothing")
dilen = 14 //input(14, title = "DI Length")
keyLevel = 23 //input(23, title = "Key level for ADX")
dirmov(len) =>
up = change(high)
down = -change(low)
truerange = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
[plus, minus]
//FUNCTIONS
plFound(osc) => na(pivotlow(osc, lbL, lbR)) ? false : true
phFound(osc) => na(pivothigh(osc, lbL, lbR)) ? false : true
buy_c=buy_cond1 or buy_cond2
///ALERTAS
if (sell_c or buy_c)
alert = sell_c?"Sell alert ":"Buy alert "
alert( alert + tostring(close), freq = alert.freq_once_per_bar_close )
/////////
///// END SIGNALS
/////
///////////////////////////////////////////////////////////////////////////////////
////////////////
//// INPUTS VOLUME PROFILE by @kv4coins
///////////////////////////////////////////////////////////////////////////////////
////////////////
show_vp1 = input(true,title="-------------Show Voume Profile--------------")
vp_lookback = input(defval = 200,
title = "Volume Lookback Depth/ Velas atras [10-1000]",
type = input.integer,
minval = 10,
maxval = 1000)
vp_bar_width = input(defval = 2,
title = "Bar Width / ancho [1-20]",
type = input.integer,
minval = 1,
maxval = 20)
// As suggested by @NXT2017
vp_delta_type = input(defval = "Both",
title = "Delta Type",
type = input.string,
options = ['Both', 'Bullish', 'Bearish'])
///////////////////////////////////////////////////////////////////////////////////
////////////////
//// VARIABLES
///////////////////////////////////////////////////////////////////////////////////
////////////////
float vp_Vmax = 0.0
int vp_VmaxId = 0
int vp_N_BARS = vp_max_bars
///////////////////////////////////////////////////////////////////////////////////
////////////////
//// CALCULATIONS
///////////////////////////////////////////////////////////////////////////////////
////////////////
float vp_HH = highest(high, vp_lookback)
float vp_LL = lowest(low, vp_lookback)
///////////////////////////////////////////////////////////////////////////////////
////////////////
//// PLOTING
///////////////////////////////////////////////////////////////////////////////////
////////////////
if barstate.isfirst and show_vp1
vp_first := time
vp_change = change(time)
vp_x_loc = timenow + round(vp_change * vp_bar_offset1)
f_setup_bar(n) =>
x1 = ((vp_VmaxId == n) and vp_poc_show) ? max(time[vp_lookback], vp_first) :
(timenow + round(vp_change * (vp_bar_offset1 - array.get(vp_a_W, n))))
ys = array.get(vp_a_P, n)
line.new(x1 = x1,
y1 = ys,
x2 = vp_x_loc,
y2 = ys,
xloc = xloc.bar_time,
extend = extend.none,
color = (vp_VmaxId == n ? vp_poc_color : vp_bar_color),
style = line.style_solid,
width = vp_bar_width)
///////////////////////////////////////////////////////////////////////////////////
////////////////
//// END
///////////////////////////////////////////////////////////////////////////////////
////////////////
/////////////////
/////otro VP by @ LonesomeTheBlue
///////////
top = highest(bbars)
bot = lowest(bbars)
dist = (top - bot) / 500
step = (top - bot) / cnum
maxvol = array.max(totalvols)
for x = 0 to cnum * 2 - 1
array.set(volumes, x, array.get(volumes, x) * bbars / (3 * maxvol))
// Draw VP rows
var vol_bars = array.new_box(cnum * 2, na)
for x = 0 to cnum - 1
box.delete(array.get(vol_bars, x))
box.delete(array.get(vol_bars, x + cnum))
array.set(vol_bars, x, box.new(bar_index - bbars + 1, array.get(levels1, x
+ 1) - dist,
bar_index - bbars + 1 +
round(array.get(volumes, x)), array.get(levels1, x) + dist,
border_width = 0,
bgcolor = x >= down and x <= up ?
vup_color : up_color))
array.set(vol_bars, x + cnum, box.new(bar_index - bbars + 1 +
round(array.get(volumes, x)), array.get(levels1, x + 1) - dist,
bar_index - bbars + 1 +
round(array.get(volumes, x)) + round(array.get(volumes, x + cnum)),
array.get(levels1, x) + dist,
border_width = 0,
bgcolor = x >= down and x <= up ?
vdown_color : down_color))
/////////////////
/////Volume prifle By LUX ALGO //Copyright LuxAlgo
///// https://es.tradingview.com/u/LuxAlgo/
///////////
length = input(300,'Lookback',minval=1,maxval=1000,group='Basic'
,tooltip='Number of most recent bars to use for the calculation of the volume
profile')
row = input(200,'Row Size',minval=1,maxval=500,group='Basic'
,tooltip='Determines the number of rows used for the calculation of the volume
profile')
//---------------------------------------------------------------------------------
--------
var vol_css = array.new_color(na)
var a = array.new_line()
var b = array.new_line()
line.set_xy2(l,n-length+round(length*width/100*mult),array.get(levels,j))
line.set_color(l,grad ? array.get(vol_css,round(mult*99)) : solid)
line.set_width(l,bar_width)
if mult == 1
poc := array.get(b,0)
avg = avg(get,array.get(levels,j+1))
if flip
line.set_xy1(poc,n,avg)
line.set_xy2(poc,n-length+1,avg)
else
line.set_xy1(poc,n-length+1,avg)
line.set_xy2(poc,n,avg)
line.set_color(poc,grad ? #5AB1BB : poc_color)
line.set_style(poc,line.style_dotted)
line.set_width(poc,bar_width)
if show_rpoc and show_vp
Alvl := array.get(levels,array.indexof(sumv,array.max(sumv)))
Blvl := array.get(levels,array.indexof(sumv,array.max(sumv))+1)
plot(show_rpoc and show_vp ? avg(Alvl,Blvl) : na,'Rolling POC',color=#ff1100)
//---------------------------------------------------------------------------------
-------]
//PIVOTES
////////////////////////////////////////////////////////////////////////////////
//
// ====== ABOUT THIS INDICATOR
//
// - All your common Pivot types in one nifty bundle.
//
// � Have up to three pivot sets.
// � Each pivot set has it's own resolution option.
// � Whatever flavour suits your tastes - each pivot set can be of a
// different type if you truly wish.
//
// ====== SOURCES and CREDITS
//
// - All included pivot calcs were sourced from:
//
// � https://www.tradingview.com/support/solutions/43000521824-pivot-points-
standard/
// � Using the new 'time_close()' function, so thankyou Pine dev's <3
//
// ====== REASON FOR STUDY
//
// - To practice making scalable code for working with similar datasets.
//
// � all the reasons
//
// ====== DISCLAIMER
//
// Any trade decisions you make are entirely your own responsibility.
// I've made an effort to squash all the bugs, but you never know!
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// //
// ====== OPTION LIST VARS ====== //
// //
// * Setting up option list variables outside of the actual input can //
// make them much easier to work with if any comparison checks are //
// required, and can help keep subsequent code clean and readable. //
// //
////////////////////////////////////////////////////////////////////////////////
// -- pivot options
i_piv0 = "Traditional", i_piv1 = "Fibonacci"
i_piv2 = "Woodie", i_piv3 = "Classic"
i_piv4 = "Demark", i_piv5 = "Camarilla"
i_piv6 = "Fibonacci Extended"
////////////////////////////////////////////////////////////////////////////////
// //
// ====== VAR and ARRAY PRESET ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// -- Preset INT for maximum amount of S|R levels for any single pivot type.
// NOTE - this variable should only be changed if:
// � you extend a pivot to have more than 5 levels of S|R
// � you add a new pivot type wiith more than 5 levels of S|R
var int i_maxLevels = 5
// -- Preset INT for max length of pivot arrays [PP + S max + R max]
// * NOTE: should not be changed.
var int i_maxLength = 1 + ( i_maxLevels * 2 )
////////////////////////////////////////////////////////////////////////////////
// //
// ====== INPUTS ====== //
// //
// * Using the new 'inline' feature * //
// //
////////////////////////////////////////////////////////////////////////////////
// -- price labels
// -- styling options
////////////////////////////////////////////////////////////////////////////////
// //
// ====== FUNCTIONS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
_return = _array
_return = _array
_return = _array
_return = _array
_return = _array
_return = _array
// set up some temp vars for creating our lines and labels
var line _line = na
var label _labelLeft = na
var label _labelRight = na
var label _labelPrice = na
// clean up old lines and labels before drawing our new set
for i = 1 to array.size( _lines ) // loop and delete 1 by 1
line.delete( array.get( _lines, i - 1 ) )
////////////////////////////////////////////////////////////////////////////////
// //
// ====== SERIES, LINES and LABELS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// -- selected resolutions
string _resolutionA = f_getResolution( INP_resolutionA )
//string _resolutionB = f_getResolution( INP_resolutionB )
//string _resolutionC = f_getResolution( INP_resolutionC )
////////////////////////////////////////////////////////////////////////////////
// //
// ====== DRAWING and PLOTTING ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// -- feed in our settings and data to the render function for set A
f_renderPivotArray( _resolutionA, i_settingsA, _pivotFloatsA, _pivotLinesA,
_pivotLabelsA )
//The volume profile code is by @LuxAlgo all the contributions for him, i just
added Tradinglatino strategy and other indicators
// i got the ma calclation and function from @OskarGallard
// � Lupown
//@version=4
///////////////////////////////////////////////////////////////////////////////////
////////////////
//// STUDY
///////////////////////////////////////////////////////////////////////////////////
////////////////
study(title = "Multiple indicators + TL Alerts [LUPOWN]", shorttitle=
"Multiple Indicators [LPWN]", overlay =
true,max_bars_back=1000,max_lines_count=500,max_boxes_count = 200)
// EMAS
show_Emas = input(true, title="--------- Show EMAS ---------")