name
stringlengths
1
64
url
stringlengths
44
135
author
stringlengths
3
30
author_url
stringlengths
34
61
likes_count
int64
0
33.2k
kind
stringclasses
3 values
pine_version
int64
1
5
license
stringclasses
3 values
source
stringlengths
177
279k
More than three Candles in a roww
https://www.tradingview.com/script/F9St16W9-More-than-three-Candles-in-a-roww/
aishshams
https://www.tradingview.com/u/aishshams/
55
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© aishshamaishshams //@version=4 study("Candles", overlay=true) i_candles = input(3,"Consecutive candles", input.integer) candle_direction = close >= open ? 1 : -1 sum_direction = sum(candle_direction, i_candles) all_up = sum_direction == i_candles all_down = sum_direction == -i_candles barcolor(all_up ? color.purple : na , offset = -2) barcolor(all_up ? color.purple : na , offset=-1) barcolor (all_up ? color.purple : na ) barcolor (all_down ? color.yellow : na , offset = -2) barcolor (all_down ? color.yellow : na , offset = -1) barcolor (all_down ? color.yellow : na )
Know your Monthly, Weekly, Daily Levels
https://www.tradingview.com/script/1T65Pg3f-Know-your-Monthly-Weekly-Daily-Levels/
schroederjoa
https://www.tradingview.com/u/schroederjoa/
80
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© schroederjoa //@version=5 indicator("Know your Monthly, Weekly, Daily Levels", shorttitle="MWD Levels", overlay=true, max_lines_count=500) ticker = ticker.new(syminfo.prefix, syminfo.ticker, session.regular) var int max_lines = input.int(500, title="Max number of lines to draw", tooltip="TradingView limits the number of drawing objects per chart to 500. To make sure the most relevant levels are shown, values are sorted based on the latest close value before levels > 500 are cut off.\n\nPlease also note that the max lookback history is limited by the currently chosen timeframe. E.g. on a 5min timeframe, 20000 bars (Premium Plan) result in approx. 5 months of lookback period, meaning you may want to have a 30 min or higher chart open to get a complete picture of levels, while trading on a lower timeframe. ", minval=1, maxval=500) var GRP1 = "Monthly Line Settings" var bool show_monthly = input.bool(true, title="Show Monthly", group=GRP1, inline = "01_1") var int monthly_line_width = input.int(5, title="Line Width", group=GRP1, inline = "01_2") var color monthly_color = input.color(color.new(color.aqua,40), title="", group=GRP1, inline = "01_2") var bool show_monthly_high = input.bool(true, title="High", group=GRP1, inline = "01_3") var bool show_monthly_low = input.bool(true, title="Low", group=GRP1, inline = "01_3") var bool show_monthly_close = input.bool(true, title="Close", group=GRP1, inline = "01_3", tooltip="Select whether High, Low and Close value of monthly candles should be included in charts.") var GRP2 = "Weekly Line Settings" var bool show_weekly = input.bool(true, title="Show Weekly", group=GRP2, inline = "02_1") var int weekly_line_width = input.int(3, title="Line Width", group=GRP2, inline = "02_2") var color weekly_color = input.color(color.new(color.fuchsia,40), title="", group=GRP2, inline = "02_2") var bool show_weekly_high = input.bool(true, title="High", group=GRP2, inline = "02_3") var bool show_weekly_low = input.bool(true, title="Low", group=GRP2, inline = "02_3") var bool show_weekly_close = input.bool(true, title="Close", group=GRP2, inline = "02_3") var GRP3 = "Daily Line Settings" var bool show_daily = input.bool(true, title="Show Daily", group=GRP3, inline = "03_1") var int daily_line_width = input.int(1, title="Line Width", group=GRP3, inline = "03_2") var color daily_color = input.color(color.new(color.white,40), title="", group=GRP3, inline = "03_2") var bool show_daily_high = input.bool(true, title="High", group=GRP3, inline = "03_3") var bool show_daily_low = input.bool(true, title="Low", group=GRP3, inline = "03_3") var bool show_daily_close = input.bool(true, title="Close", group=GRP3, inline = "03_3") var bool show_daily_pre_high = input.bool(false, title="Pre Market High", group=GRP3, inline = "03_4") var bool show_daily_pre_low = input.bool(false, title="Pre Market Low", group=GRP3, inline = "03_4") //max_bars_back(time,20000) // global array to hold level information var arr_levels_val_temp = array.new_float(0) var arr_levels_time_temp = array.new_int(0) var arr_levels_timeframe_temp = array.new_int(0) // function to add (or modify) level add_level(val, t, timeframe) => found = false for i = 0 to (array.size(arr_levels_val_temp) == 0 ? na : array.size(arr_levels_val_temp) - 1) v = array.get(arr_levels_val_temp,i) if v == val found := true tf = array.get(arr_levels_timeframe_temp,i) // change only level meta data to higher timeframe if level value already exists if timeframe >= tf array.set(arr_levels_time_temp,i, t) array.set(arr_levels_timeframe_temp,i, timeframe) // add new level if it does not exist yet if not found array.push(arr_levels_val_temp, val) array.push(arr_levels_time_temp, t) array.push(arr_levels_timeframe_temp, timeframe) [ddh,ddl,ddc,ddt] = request.security(ticker, timeframe.period, [high,low,close,time],gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) price_lowest = 0 price_highest = 9999999 var float pre_high_current = price_lowest var float pre_low_current = price_highest var float m_high = price_lowest var float m_low = price_highest var float w_high = price_lowest var float w_low = price_highest var float d_high = price_lowest var float d_low = price_highest var float d_pre_high = price_lowest var float d_pre_low = price_highest m_high := math.max(m_high, ddh) m_low := math.min(m_low, ddl) w_high := math.max(w_high, ddh) w_low := math.min(w_low, ddl) d_high := math.max(d_high, ddh) d_low := math.min(d_low, ddl) if not session.ismarket d_pre_high := math.max(d_pre_high, high) d_pre_low := math.min(d_pre_low, low) new_m = month(ddt) != month(ddt[1]) new_w = weekofyear(ddt) != weekofyear(ddt[1]) new_d = dayofmonth(ddt) != dayofmonth(ddt[1]) new_d_pre = session.ismarket and not session.ismarket[1] if new_m and show_monthly if show_monthly_high add_level(m_high[1], ddt[1], 3) if show_monthly_low add_level(m_low[1], ddt[1], 3) if show_monthly_close add_level(ddc[1], ddt[1], 3) m_high := ddh m_low := ddl if new_w and show_weekly if show_weekly_high add_level(w_high[1], ddt[1], 2) if show_weekly_low add_level(w_low[1], ddt[1], 2) if show_weekly_close add_level(ddc[1], ddt[1], 2) w_high := ddh w_low := ddl if new_d and show_daily if show_daily_high add_level(d_high[1], ddt[1], 1) if show_daily_low add_level(d_low[1], ddt[1], 1) if show_daily_close add_level(ddc[1], ddt[1], 1) d_high := ddh d_low := ddl if new_d_pre and show_daily if show_daily_pre_high add_level(d_pre_high, time, 0) if show_daily_pre_low add_level(d_pre_low, time, 0) d_pre_high := price_lowest d_pre_low := price_highest color line_color = na int line_width = na string line_style = na if barstate.islastconfirmedhistory // calculate distances to latest close price arr_dist = array.new_float(0) for i = 0 to (array.size(arr_levels_val_temp) == 0 ? na : array.size(arr_levels_val_temp) - 1) array.push(arr_dist, math.abs(close - array.get(arr_levels_val_temp,i))) // sort according to smallest values and slice array to keep indexes of x closest values only arr_dist_indexes = array.sort_indices(arr_dist) arr_dist_indexes := array.slice(arr_dist_indexes,0,math.min(max_lines, array.size(arr_dist_indexes) == 0 ? na : array.size(arr_dist_indexes) - 1)) // populate final arrays, based on filtered indexes of closest values var arr_levels_val = array.new_float(0) var arr_levels_time = array.new_int(0) var arr_levels_timeframe = array.new_int(0) for i = 0 to (array.size(arr_dist_indexes) == 0 ? na : array.size(arr_dist_indexes) - 1) index = array.get(arr_dist_indexes,i) array.push(arr_levels_val, array.get(arr_levels_val_temp,index)) array.push(arr_levels_time, array.get(arr_levels_time_temp,index)) array.push(arr_levels_timeframe, array.get(arr_levels_timeframe_temp,index)) for i = 0 to (array.size(arr_levels_val) == 0 ? na : array.size(arr_levels_val) - 1) val = array.get(arr_levels_val,i) t = array.get(arr_levels_time,i) tf = array.get(arr_levels_timeframe,i) line_color := tf == 3 ? monthly_color : tf == 2 ? weekly_color : daily_color line_width := tf == 3 ? monthly_line_width : tf == 2 ? weekly_line_width : daily_line_width line_style := tf == 0 ? line.style_dashed : line.style_solid line.new(t, val, t+1, val, xloc.bar_time, color=line_color, style=line_style, width=line_width, extend=extend.right)
Realtime Divergence for Any Indicator
https://www.tradingview.com/script/myEwkFqr-Realtime-Divergence-for-Any-Indicator/
JohnBartlesAccount
https://www.tradingview.com/u/JohnBartlesAccount/
356
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© JohnBartlesAccount //@version=5 indicator("Realtime Divergence for Any Indicator", overlay=true, max_lines_count=300, max_bars_back=300) overlayChart = input(false, "Overlay Chart", tooltip="Display addon on chart instead of oscillator. Also you must set the Source Input to the desired oscillator plot.") osc = input.source(close, "Source Input") lbR = input( 5, "Pivot Lookback Right") lbL = input( 5, "Pivot Lookback Left") rangeUpper = input( 60, "Max of Lookback Range", tooltip="The longest allowed length of divergence lines found") rangeLower = input( 5, "Min of Lookback Range", tooltip="The shortest allowed length of divergence lines found") plotBull = input( true, "Bull Lines", group="Display Plots") plotHiddenBull = input( true, "Hidden Bull Lines", group="Display Plots") plotBear = input( true, "Bear Lines", group="Display Plots") plotHiddenBear = input( true, "Hidden Bear Lines", group="Display Plots") plotBullFlags = input( true, "Bull Flags") plotHidBullFlags = input( true, "Hidden Bull Flags") plotBearFlags = input( true, "Bear Flags") plotHidBearFlags = input( true, "Hidden Bear Flags") bearColor = input.color(color.rgb(255, 0, 0, 0), "Bearish Color") bullColor = input.color(color.rgb(0, 255, 0, 0), "Bullish Color") hiddenBullColor = input.color(color.rgb(0, 255, 0, 80), "Hidden Bullish Color") hiddenBearColor = input.color(color.rgb(255, 0, 0, 80), "Hidden Bearish Color") textColor = input.color(color.rgb(255, 255, 255, 0), "Text Color") noneColor = color.new(color.white, 100) totallyInterBars = input.int(title="Bars Allowing Total Oscillator and Price Intersection", defval=0, minval=0, tooltip="Starting from both the beginning and ending of the divergence lines, the number of bars allowed to intersect those divergence lines to any degree") interAllowanceOsc = input.float(title="Allowance for Oscillator Intersection", defval=2.00, minval=0.0, step=0.01, tooltip="The percentage that the oscillator is allowed to intersect the divergence line. My code is buggy, so experiment to find what works for you. Daily timeframes will probably require higher allowances than minute timeframes. High oscillator values may require smaller allowances than low oscillator values") interAllowanceOsc := interAllowanceOsc / 100.0 interAllowancePrice = input.float(title="Allowance for Price Intersection", defval=2.00, minval=0.0, step=0.01, tooltip="The percentage that the price is allowed to intersect the divergence line. My code is buggy, so experiment to find what works for you. Daily timeframes will probably require higher allowances than minute timeframes. High price stocks should require smaller allowances than cheaper stocks.") interAllowancePrice := interAllowancePrice / 100.0 deviation = input.int(title="Allowance for Misalignment Between Price and Oscillator", defval=1, minval=0, step=1, tooltip="The number of bars allowed to be misaligned between the price and oscillator. Right side pivots between price and oscillator are sometimes slightly misaligned, but SOME should still possibly be considered a valid divergence.") numPriorLines = input(title="Number of Prior RT Lines", defval=1, tooltip="The number of prior realtime lines you want visible before their deletion.") //FINISH: This currently does nothing at all //minLength = input(title="Minimum Ratio Between Price and Oscillator Lines", defval=1, tooltip="Decide the minimum length of price compared to oscillator lines. Some divergence lines should be considered legit even if the price and oscillator divergence lines are radically different sizes, and sometimes they shouldn't.") doRealtime = input(defval=true, title="Real Time Potential Divergences", tooltip="Show potential divergences as pivots are forming") doRealtimeAlerts = input(defval=true, title="Real Time Potential Divergence Alerts", tooltip="Recieveee alerted to potential divergences") useBestSlope = input(defval=true, title="Use Only the Best Slope", tooltip="Depending on the type of divergence line, only the slope closest to 0 or the slope farthest from 0 will be used") plFound_Osc = na(ta.pivotlow(osc, lbL, lbR)) ? false : true plFound_Price = na(ta.pivotlow(low, lbL, lbR)) ? false : true phFound_Osc = na(ta.pivothigh(osc, lbL, lbR)) ? false : true phFound_Price = na(ta.pivothigh(high, lbL, lbR)) ? false : true lbR_rt = 0 //What makes realtime potential divergences realtime is that their right side pivot's have 0 right side bars plFound_Osc_rt = na(ta.pivotlow(osc, lbL, lbR_rt)) ? false : true plFound_Price_rt = na(ta.pivotlow(low, lbL, lbR_rt)) ? false : true phFound_Osc_rt = na(ta.pivothigh(osc, lbL, lbR_rt)) ? false : true phFound_Price_rt = na(ta.pivothigh(high, lbL, lbR_rt)) ? false : true x1_osc = 0 x2_osc = array.new_int() y1_osc = 0.0 y2_osc = array.new_float() x1_price = 0 x2_price = array.new_int() y1_price = 0.0 y2_price = array.new_float() rightPivotsFound = false rightPivotsFound_rt = false devOscPivBar = 0 devPricePivBar = 0 devOscPivBar_rt = 0 devPricePivBar_rt = 0 i_POsc = 0 i_PPrice = 0 oscDivLineBarTotal = 0 priceDivLineBarTotal = 0 oscDiverLine = 0.0 priceDiverLine = 0.0 cancel_line = false bullLineOsc = array.new_line() bullLabelOsc = array.new_label() hidBullLineOsc = array.new_line() hidBullLabelOsc = array.new_label() bearLineOsc = array.new_line() bearLabelOsc = array.new_label() hidBearLineOsc = array.new_line() hidBearLabelOsc = array.new_label() bullLinePrice = array.new_line() bullLabelPrice = array.new_label() hidBullLinePrice = array.new_line() hidBullLabelPrice = array.new_label() bearLinePrice = array.new_line() bearLabelPrice = array.new_label() hidBearLinePrice = array.new_line() hidBearLabelPrice = array.new_label() pricePivBar = 0 oscPivBar = 0 loopTotal_rt = doRealtime ? 2 : 1 slope1 = 0.0 slope2 = 0.0 ///// /////-----Search for rightside pivot //Price and Oscilator pivots are sometimes slightly misaligned. So test for any pivots from price and oscillator within "deviation" range while i_POsc <= deviation and rightPivotsFound == false while i_PPrice <= deviation and rightPivotsFound == false if plFound_Osc[i_POsc] and plFound_Price[i_PPrice] rightPivotsFound := true devOscPivBar := i_POsc + lbR devPricePivBar := i_PPrice + lbR i_PPrice := i_PPrice + 1 i_PPrice := 0 i_POsc := i_POsc + 1 i_POsc := 0 i_PPrice := 0 if doRealtime //Price and Oscillator pivots are sometimes slightly misaligned. So test for any pivots from price and oscillator within "deviation" range while i_POsc <= deviation and rightPivotsFound_rt == false while i_PPrice <= deviation and rightPivotsFound_rt == false if plFound_Osc_rt[i_POsc] and plFound_Price_rt[i_PPrice] rightPivotsFound_rt := true devOscPivBar_rt := i_POsc + lbR_rt devPricePivBar_rt := i_PPrice + lbR_rt i_PPrice := i_PPrice + 1 i_PPrice := 0 i_POsc := i_POsc + 1 i_POsc := 0 i_PPrice := 0 ////////////------------------------------------------------------------------------------ ////// Regular Bullish----- size = 0 i_delArray = 0 for count_rt = 1 to loopTotal_rt if doRealtime and count_rt == 1 pricePivBar := devPricePivBar_rt oscPivBar := devOscPivBar_rt else pricePivBar := devPricePivBar oscPivBar := devOscPivBar //If right side pivots are found - test for all left side HL pivots of oscillator then LL pivots of price. //I don't think left side pivots need to be aligned at ALL to be considered a divergence if ((rightPivotsFound and doRealtime and count_rt == 2) or (rightPivotsFound and doRealtime == false and count_rt == 1) or (rightPivotsFound_rt and doRealtime and count_rt == 1)) and (oscPivBar + 1) <= rangeUpper and (pricePivBar + 1) <= rangeUpper i_POsc := ((oscPivBar + 1 < rangeLower) ? rangeLower : (oscPivBar + 1)) //start the search after first found pivot, and don't search before rangeLower ///// ////// -- Osc: Higher Low while (i_POsc+lbR) <= rangeUpper if plFound_Osc[i_POsc] == true if osc[i_POsc+lbR] < osc[oscPivBar] oscDivLineBarTotal := (i_POsc+lbR) - oscPivBar + 1 //I think I'm supposed to add 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula //FIX: This is supposed to exlude totallyInterBars from being tested, but it's not working exactly if totallyInterBars <= math.floor((i_POsc+lbR )/2)//FIX: this doesn't account for the middle bar for i_OscDivLine = totallyInterBars to (i_POsc+lbR )- totallyInterBars oscDiverLine := osc[oscPivBar] + (i_OscDivLine / oscDivLineBarTotal) * (osc[i_POsc+lbR] - osc[oscPivBar])//This is the line segmentation formula for just y if osc[i_OscDivLine + oscPivBar] < oscDiverLine - (interAllowanceOsc * math.abs(oscDiverLine))//If oscillator crosses below divergence line (minus allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_osc) == 1 and cancel_line == false //Only keep oscillator divergence lines with slope farthest from 0 slope1 := math.abs((osc[oscPivBar] - osc[i_POsc+lbR]) / (oscPivBar - (i_POsc+lbR))) slope2 := math.abs((y1_osc - array.get(y2_osc, 0)) / (x1_osc - array.get(x2_osc, 0))) if slope1 < slope2 cancel_line := true else array.remove(x2_osc, 0) array.remove(y2_osc, 0) if cancel_line == false x1_osc := oscPivBar array.push(x2_osc, i_POsc+lbR) y1_osc := osc[oscPivBar] array.push(y2_osc, osc[i_POsc+lbR]) cancel_line := false i_POsc := i_POsc + 1 ///// ////// -- Price: Lower Low i_PPrice := ((pricePivBar + 1 < rangeLower) ? rangeLower : (pricePivBar + 1)) cancel_line := false while (i_PPrice+lbR )<= rangeUpper if plFound_Price[i_PPrice] == true if low[i_PPrice+lbR] > low[pricePivBar] priceDivLineBarTotal := (i_PPrice+lbR) - pricePivBar + 1//I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_PPrice+lbR) / 2)//FIX: this doesn't account for the middle bar for i_PriceDivLine = totallyInterBars to (i_PPrice+lbR) - totallyInterBars priceDiverLine := low[pricePivBar] + (i_PriceDivLine / priceDivLineBarTotal) * (low[i_PPrice+lbR] - low[pricePivBar])//This is the line segmentation formula for just y if low[i_PriceDivLine + pricePivBar] < priceDiverLine - (interAllowancePrice * math.abs(priceDiverLine))//If oscillator crosses below (divergence line - allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_price) == 1 and cancel_line == false //Only keep price divergences lines with slope near 0 slope1 := math.abs((low[pricePivBar] - low[i_PPrice+lbR]) / (pricePivBar - (i_PPrice+lbR))) slope2 := math.abs((y1_price - array.get(y2_price, 0)) / (x1_price - array.get(x2_price, 0))) if slope1 > slope2 cancel_line := true else array.remove(x2_price, 0) array.remove(y2_price, 0) if cancel_line == false x1_price := pricePivBar array.push(x2_price, i_PPrice+lbR) y1_price := low[pricePivBar] array.push(y2_price, low[i_PPrice+lbR]) cancel_line := false i_PPrice := i_PPrice + 1 if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotBull //Draw oscillator divergences if overlayChart == false for i_print_lines = 0 to array.size(x2_osc) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 350 is arbitrary. size := 0 i_delArray := 1 if na(bullLineOsc[i_del]) == false size := array.size(bullLineOsc[i_del]) while i_delArray <= size line.delete( array.get(bullLineOsc[i_del], array.size(bullLineOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bullLineOsc, line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=bullColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=bullColor, width=2) //Draw price divergences else for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(bullLinePrice[i_del]) == false size := array.size(bullLinePrice[i_del]) while i_delArray <= size line.delete( array.get(bullLinePrice[i_del], array.size(bullLinePrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bullLinePrice, line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=bullColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=bullColor, width=2) if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotBullFlags //Draw oscillator divergence labels and create alert if overlayChart == false for i_print_lines = 0 to array.size(x2_osc) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 350 is arbitrary. size := 0 i_delArray := 1 if na(bullLabelOsc[i_del]) == false size := array.size(bullLabelOsc[i_del]) while i_delArray <= size label.delete( array.get(bullLabelOsc[i_del], array.size(bullLabelOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bullLabelOsc, label.new(bar_index - x1_osc, y1_osc, text="B", yloc=yloc.price, color=bullColor, style=label.style_label_up, textcolor = color.white, size = size.normal) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Regular Bull", alert.freq_once_per_bar) //Draw price divergence labels and create alert else for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(bullLabelPrice[i_del]) == false size := array.size(bullLabelPrice[i_del]) while i_delArray <= size label.delete( array.get(bullLabelPrice[i_del], array.size(bullLabelPrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bullLabelPrice, label.new(bar_index - x1_price, y1_price, text="B", yloc=yloc.price, color=bullColor, style=label.style_label_up, textcolor = color.white, size = size.normal) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Regular Bull", alert.freq_once_per_bar) //I can only delete the realtime arrays here and the historical arrays below because plotshape() can't be inside a loop if doRealtime and count_rt == 1 i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 isBullFlagReady = false if plotBullFlags and array.size(x2_osc) > 0 and array.size(x2_price) > 0 isBullFlagReady := true plotshape( (isBullFlagReady[1] == false and isBullFlagReady == true) ? (overlayChart ? y1_price : y1_osc) : na, offset= (overlayChart ? -(x1_price+lbR): -(x1_osc+lbR)), title="Bullish Label", text="B", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor, transp=0 ) i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 ////////////------------------------------------------------------------------------------ ////// Hidden Bullish----- for count_rt = 1 to loopTotal_rt if doRealtime and count_rt == 1 pricePivBar := devPricePivBar_rt oscPivBar := devOscPivBar_rt else pricePivBar := devPricePivBar oscPivBar := devOscPivBar if ((rightPivotsFound and doRealtime and count_rt == 2) or (rightPivotsFound and doRealtime == false and count_rt == 1) or (rightPivotsFound_rt and doRealtime and count_rt == 1)) and (oscPivBar + 1) <= rangeUpper and (pricePivBar + 1) <= rangeUpper i_POsc := ((oscPivBar + 1 < rangeLower) ? rangeLower : (oscPivBar + 1)) //start the search after first found pivot, and don't search before rangeLower ///// ////// -- Osc: Lower Low while (i_POsc+lbR) <= rangeUpper if plFound_Osc[i_POsc] == true if osc[i_POsc+lbR] > osc[oscPivBar] oscDivLineBarTotal := (i_POsc+lbR) - oscPivBar + 1 //I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_POsc+lbR)/2)//FIX: this doesn't account for the middle bar for i_OscDivLine = totallyInterBars to (i_POsc+lbR )- totallyInterBars oscDiverLine := osc[oscPivBar] + (i_OscDivLine / oscDivLineBarTotal) * (osc[i_POsc+lbR] - osc[oscPivBar])//This is the line segmentation formula for just y if osc[i_OscDivLine + oscPivBar] < oscDiverLine - (interAllowanceOsc * math.abs(oscDiverLine))//If oscillator crosses below divergence line (minus allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_osc) == 1 and cancel_line == false //If useBestSlope is true then only keep oscillator divergence lines with slope closest to 0 slope1 := math.abs((osc[oscPivBar] - osc[i_POsc+lbR]) / (oscPivBar - (i_POsc+lbR))) slope2 := math.abs((y1_osc - array.get(y2_osc, 0)) / (x1_osc - array.get(x2_osc, 0))) if slope1 > slope2 cancel_line := true else array.remove(x2_osc, 0) array.remove(y2_osc, 0) if cancel_line == false x1_osc := oscPivBar array.push(x2_osc, i_POsc+lbR) y1_osc := osc[oscPivBar] array.push(y2_osc, osc[i_POsc+lbR]) cancel_line := false i_POsc := i_POsc + 1 ///// ////// -- Price: Higher Low i_PPrice := ((pricePivBar + 1 < rangeLower) ? rangeLower : (pricePivBar + 1)) cancel_line := false while (i_PPrice+lbR )<= rangeUpper if plFound_Price[i_PPrice] == true if low[i_PPrice+lbR] < low[pricePivBar] priceDivLineBarTotal := (i_PPrice+lbR) - pricePivBar + 1 //I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_PPrice+lbR) / 2)//FIX: this doesn't account for the middle bar for i_PriceDivLine = totallyInterBars to (i_PPrice+lbR) - totallyInterBars priceDiverLine := low[pricePivBar] + (i_PriceDivLine / priceDivLineBarTotal) * (low[i_PPrice+lbR] - low[pricePivBar])//This is the line segmentation formula for just y if low[i_PriceDivLine + pricePivBar] < priceDiverLine - (interAllowancePrice * math.abs(priceDiverLine))//If oscillator crosses below (divergence line - allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_price) == 1 and cancel_line == false //Only keep price divergence lines with slope farthest from 0 slope1 := math.abs((low[pricePivBar] - low[i_PPrice+lbR]) / (pricePivBar - (i_PPrice+lbR))) slope2 := math.abs((y1_price - array.get(y2_price, 0)) / (x1_price - array.get(x2_price, 0))) if slope1 < slope2 cancel_line := true else array.remove(x2_price, 0) array.remove(y2_price, 0) if cancel_line == false x1_price := pricePivBar array.push(x2_price, i_PPrice+lbR) y1_price := low[pricePivBar] array.push(y2_price, low[i_PPrice+lbR]) cancel_line := false i_PPrice := i_PPrice + 1 if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotHiddenBull if overlayChart == false for i_print_lines = 0 to array.size(x2_osc) - 1 //Draw oscillator divergences if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(hidBullLineOsc[i_del]) == false size := array.size(hidBullLineOsc[i_del]) while i_delArray <= size line.delete( array.get(hidBullLineOsc[i_del], array.size(hidBullLineOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBullLineOsc, line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=hiddenBullColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=hiddenBullColor, width=2) else //Draw price divergences for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(hidBullLinePrice[i_del]) == false size := array.size(hidBullLinePrice[i_del]) while i_delArray <= size line.delete( array.get(hidBullLinePrice[i_del], array.size(hidBullLinePrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBullLinePrice, line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=hiddenBullColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=hiddenBullColor, width=2) if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotHidBullFlags if overlayChart == false for i_print_lines = 0 to array.size(x2_osc) - 1 //Draw oscillator divergences and create alert if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(hidBullLabelOsc[i_del]) == false size := array.size(hidBullLabelOsc[i_del]) while i_delArray <= size label.delete( array.get(hidBullLabelOsc[i_del], array.size(hidBullLabelOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBullLabelOsc, label.new(bar_index - x1_osc, y1_osc, text="HB", yloc=yloc.price, color=hiddenBullColor, style=label.style_label_up, textcolor = color.white, size = size.small) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Hidden Bull", alert.freq_once_per_bar) else //Draw price divergence labels and create alert for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(hidBullLabelPrice[i_del]) == false size := array.size(hidBullLabelPrice[i_del]) while i_delArray <= size label.delete( array.get(hidBullLabelPrice[i_del], array.size(hidBullLabelPrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBullLabelPrice, label.new(bar_index - x1_price, y1_price, text="HB", yloc=yloc.price, color=hiddenBullColor, style=label.style_label_up, textcolor = color.white, size = size.small) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Hidden Bull", alert.freq_once_per_bar) //delete if doRealtime and count_rt == 1 i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 isHidBullFlagReady = false if plotHidBullFlags and array.size(x2_osc) > 0 and array.size(x2_price) > 0 isHidBullFlagReady := true plotshape( (isHidBullFlagReady[1] == false and isHidBullFlagReady == true) ? (overlayChart ? y1_price : y1_osc) : na, offset= (overlayChart ? -(x1_price+lbR): -(x1_osc+lbR)), title="Hidden Bullish Label", text="HB", style=shape.labelup, location=location.absolute, color=hiddenBullColor, textcolor=textColor, transp=0 ) i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 ///// /////-----Search for rightside pivot rightPivotsFound := false i_POsc := 0 i_PPrice := 0 //Price and Oscillator pivots are sometimes slightly misaligned. So test for any pivots from price and oscillator within "deviation" range while i_POsc <= deviation and rightPivotsFound == false while i_PPrice <= deviation and rightPivotsFound == false if phFound_Osc[i_POsc] and phFound_Price[i_PPrice] rightPivotsFound := true devOscPivBar := i_POsc + lbR devPricePivBar := i_PPrice + lbR i_PPrice := i_PPrice + 1 i_PPrice := 0 i_POsc := i_POsc + 1 rightPivotsFound_rt := false i_POsc := 0 i_PPrice := 0 if doRealtime //Price and Oscillator pivots are sometimes slightly misaligned. So test for any pivots from price and oscillator within "deviation" range while i_POsc <= deviation and rightPivotsFound_rt == false while i_PPrice <= deviation and rightPivotsFound_rt == false if phFound_Osc_rt[i_POsc] and phFound_Price_rt[i_PPrice] rightPivotsFound_rt := true devOscPivBar_rt := i_POsc + lbR_rt devPricePivBar_rt := i_PPrice + lbR_rt i_PPrice := i_PPrice + 1 i_PPrice := 0 i_POsc := i_POsc + 1 ////////////------------------------------------------------------------------------------ ////// Regular Bearish cancel_line := false for count_rt = 1 to loopTotal_rt if doRealtime and count_rt == 1 pricePivBar := devPricePivBar_rt oscPivBar := devOscPivBar_rt else pricePivBar := devPricePivBar oscPivBar := devOscPivBar if ((rightPivotsFound and doRealtime and count_rt == 2) or (rightPivotsFound and doRealtime == false and count_rt == 1) or (rightPivotsFound_rt and doRealtime and count_rt == 1)) and (oscPivBar + 1) <= rangeUpper and (pricePivBar + 1) <= rangeUpper i_POsc := ((oscPivBar + 1 < rangeLower) ? rangeLower : (oscPivBar + 1)) //start the search after first found pivot, and don't search before rangeLower ////// -- Osc: Lower High while (i_POsc+lbR) <= rangeUpper if phFound_Osc[i_POsc] == true if osc[i_POsc+lbR] > osc[oscPivBar] oscDivLineBarTotal := (i_POsc+lbR) - oscPivBar + 1 //I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_POsc+lbR)/2)//FIX: this doesn't account for the middle bar for i_OscDivLine = totallyInterBars to (i_POsc+lbR )- totallyInterBars oscDiverLine := osc[oscPivBar] + (i_OscDivLine / oscDivLineBarTotal) * (osc[i_POsc+lbR] - osc[oscPivBar])//This is the line segmentation formula for just y if osc[i_OscDivLine + oscPivBar] > oscDiverLine + (interAllowanceOsc * math.abs(oscDiverLine))//If oscillator crosses above divergence line (minus allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_osc) == 1 and cancel_line == false //Only keep oscillator divergence line with slope farthest from 0 slope1 := math.abs((osc[oscPivBar] - osc[i_POsc+lbR]) / (oscPivBar - (i_POsc+lbR))) slope2 := math.abs((y1_osc - array.get(y2_osc, 0)) / (x1_osc - array.get(x2_osc, 0))) if slope1 < slope2 cancel_line := true else array.remove(x2_osc, 0) array.remove(y2_osc, 0) if cancel_line == false x1_osc := oscPivBar array.push(x2_osc, i_POsc+lbR) y1_osc := osc[oscPivBar] array.push(y2_osc, osc[i_POsc+lbR]) cancel_line := false i_POsc := i_POsc + 1 ////// -- Price: Higher High i_PPrice := ((pricePivBar + 1 < rangeLower) ? rangeLower : (pricePivBar + 1)) cancel_line := false while (i_PPrice+lbR )<= rangeUpper if phFound_Price[i_PPrice] == true if high[i_PPrice+lbR] < high[pricePivBar] priceDivLineBarTotal := (i_PPrice+lbR) - pricePivBar + 1 //I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_PPrice+lbR) / 2)//FIX: this doesn't account for the middle bar for i_PriceDivLine = totallyInterBars to (i_PPrice+lbR) - totallyInterBars priceDiverLine := high[pricePivBar] + (i_PriceDivLine / priceDivLineBarTotal) * (high[i_PPrice+lbR] - high[pricePivBar])//This is the line segmentation formula for just y if high[i_PriceDivLine + pricePivBar] > priceDiverLine + (interAllowancePrice * math.abs(priceDiverLine))//If oscillator crosses below (divergence line - allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_price) == 1 and cancel_line == false //Only keep price divergence line with slope nearest 0 slope1 := math.abs((high[pricePivBar] - high[i_PPrice+lbR]) / (pricePivBar - (i_PPrice+lbR))) slope2 := math.abs((y1_price - array.get(y2_price, 0)) / (x1_price - array.get(x2_price, 0))) if slope1 > slope2 cancel_line := true else array.remove(x2_price, 0) array.remove(y2_price, 0) if cancel_line == false x1_price := pricePivBar array.push(x2_price, i_PPrice+lbR) y1_price := high[pricePivBar] array.push(y2_price, high[i_PPrice+lbR]) cancel_line := false i_PPrice := i_PPrice + 1 if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotBear if overlayChart == false //Draw oscillator divergences for i_print_lines = 0 to array.size(x2_osc) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(bearLineOsc[i_del]) == false size := array.size(bearLineOsc[i_del]) while i_delArray <= size line.delete( array.get(bearLineOsc[i_del], array.size(bearLineOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bearLineOsc, line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=bearColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=bearColor, width=2) else //Draw price divergences for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(bearLinePrice[i_del]) == false size := array.size(bearLinePrice[i_del]) while i_delArray <= size line.delete( array.get(bearLinePrice[i_del], array.size(bearLinePrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bearLinePrice, line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=bearColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=bearColor, width=2) if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotBearFlags if overlayChart == false //Draw REALTIME oscillator divergence labels and create alert for i_print_lines = 0 to array.size(x2_osc) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(bearLabelOsc[i_del]) == false size := array.size(bearLabelOsc[i_del]) while i_delArray <= size label.delete( array.get(bearLabelOsc[i_del], array.size(bearLabelOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bearLabelOsc, label.new(bar_index - x1_osc, y1_osc, "Br", yloc=yloc.price, color=bearColor, style=label.style_label_down, textcolor = color.white, size = size.small) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Regular Bear", alert.freq_once_per_bar) else //Draw REALTIME price divergence labels and create alert for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(bearLabelPrice[i_del]) == false size := array.size(bearLabelPrice[i_del]) while i_delArray <= size label.delete( array.get(bearLabelPrice[i_del], array.size(bearLabelPrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(bearLabelPrice, label.new(bar_index - x1_price, y1_price, "Br", yloc=yloc.price, color=bearColor, style=label.style_label_down, textcolor = color.white, size = size.small) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Regular Bear", alert.freq_once_per_bar) //delete if doRealtime and count_rt == 1 i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 isBearFlagReady = false if plotBearFlags and array.size(x2_osc) > 0 and array.size(x2_price) > 0 isBearFlagReady := true plotshape( (isBearFlagReady[1] == false and isBearFlagReady == true) ? (overlayChart ? y1_price : y1_osc) : na, offset= (overlayChart ? -(x1_price+lbR): -(x1_osc+lbR)), title="Bearish Label", text="Br", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor, transp=0 ) i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 ////////////------------------------------------------------------------------------------ ////// Hidden Bearish cancel_line := false for count_rt = 1 to loopTotal_rt if doRealtime and count_rt == 1 pricePivBar := devPricePivBar_rt oscPivBar := devOscPivBar_rt else pricePivBar := devPricePivBar oscPivBar := devOscPivBar //If right side pivots are found - test for all left side HL pivots of oscillator then LL pivots of price. //I don't think left side pivots need to be aligned at ALL to be considered a divergence if ((rightPivotsFound and doRealtime and count_rt == 2) or (rightPivotsFound and doRealtime == false and count_rt == 1) or (rightPivotsFound_rt and doRealtime and count_rt == 1)) and (oscPivBar + 1) <= rangeUpper and (pricePivBar + 1) <= rangeUpper i_POsc := ((oscPivBar + 1 < rangeLower) ? rangeLower : (oscPivBar + 1)) //start the search after first found pivot, and don't search before rangeLower ////// -- Osc: Higher High while (i_POsc+lbR) <= rangeUpper if phFound_Osc[i_POsc] == true if osc[i_POsc+lbR] < osc[oscPivBar] oscDivLineBarTotal := (i_POsc+lbR) - oscPivBar + 1 //I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_POsc+lbR)/2)//FIX: this doesn't account for the middle bar for i_OscDivLine = totallyInterBars to (i_POsc+lbR )- totallyInterBars oscDiverLine := osc[oscPivBar] + (i_OscDivLine / oscDivLineBarTotal) * (osc[i_POsc+lbR] - osc[oscPivBar])//This is the line segmentation formula for just y if osc[i_OscDivLine + oscPivBar] > oscDiverLine + (interAllowanceOsc * math.abs(oscDiverLine))//If oscillator crosses above divergence line (minus allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_osc) == 1 and cancel_line == false //Only keep oscillator divergence lines with slope nearest 0 slope1 := math.abs((osc[oscPivBar] - osc[i_POsc+lbR]) / (oscPivBar - (i_POsc+lbR))) slope2 := math.abs((y1_osc - array.get(y2_osc, 0)) / (x1_osc - array.get(x2_osc, 0))) if slope1 > slope2 cancel_line := true else array.remove(x2_osc, 0) array.remove(y2_osc, 0) if cancel_line == false x1_osc := oscPivBar array.push(x2_osc, i_POsc+lbR) y1_osc := osc[oscPivBar] array.push(y2_osc, osc[i_POsc+lbR]) cancel_line := false i_POsc := i_POsc + 1 ////// -- Price: Lower High i_PPrice := ((pricePivBar + 1 < rangeLower) ? rangeLower : (pricePivBar + 1)) cancel_line := false while (i_PPrice+lbR )<= rangeUpper if phFound_Price[i_PPrice] == true if high[i_PPrice+lbR] > high[pricePivBar] priceDivLineBarTotal := (i_PPrice+lbR) - pricePivBar + 1 //I added 1 because you must include all bars from beginning to end of (possible)divergence line for line segmentation formula if totallyInterBars <= math.floor((i_PPrice+lbR) / 2)//FIX: this doesn't account for the middle bar for i_PriceDivLine = totallyInterBars to (i_PPrice+lbR) - totallyInterBars priceDiverLine := high[pricePivBar] + (i_PriceDivLine / priceDivLineBarTotal) * (high[i_PPrice+lbR] - high[pricePivBar])//This is the line segmentation formula for just y if high[i_PriceDivLine + pricePivBar] > priceDiverLine + (interAllowancePrice * math.abs(priceDiverLine))//If oscillator crosses below (divergence line - allowance) then cancel divergence cancel_line := true if useBestSlope and array.size(x2_price) == 1 and cancel_line == false //Only keep price divergence lines with slope farthest from 0 slope1 := math.abs((high[pricePivBar] - high[i_PPrice+lbR]) / (pricePivBar - (i_PPrice+lbR))) slope2 := math.abs((y1_price - array.get(y2_price, 0)) / (x1_price - array.get(x2_price, 0))) if slope1 < slope2 cancel_line := true else array.remove(x2_price, 0) array.remove(y2_price, 0) if cancel_line == false x1_price := pricePivBar array.push(x2_price, i_PPrice+lbR) y1_price := high[pricePivBar] array.push(y2_price, high[i_PPrice+lbR]) cancel_line := false i_PPrice := i_PPrice + 1 if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotHiddenBear if overlayChart == false //Draw oscillator divergences for i_print_lines = 0 to array.size(x2_osc) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(hidBearLineOsc[i_del]) == false size := array.size(hidBearLineOsc[i_del]) while i_delArray <= size line.delete( array.get(hidBearLineOsc[i_del], array.size(hidBearLineOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBearLineOsc, line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=hiddenBearColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_osc, i_print_lines), array.get(y2_osc, i_print_lines), bar_index - x1_osc, y1_osc, color=hiddenBearColor, width=2) else for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 350 is arbitrary. size := 0 i_delArray := 1 if na(hidBearLinePrice[i_del]) == false size := array.size(hidBearLinePrice[i_del]) while i_delArray <= size line.delete( array.get(hidBearLinePrice[i_del], array.size(hidBearLinePrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBearLinePrice, line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=hiddenBearColor, width=2, style=line.style_dashed) ) else line.new(bar_index - array.get(x2_price, i_print_lines), array.get(y2_price, i_print_lines), bar_index - x1_price, y1_price, color=hiddenBearColor, width=2) if array.size(x2_osc) > 0 and array.size(x2_price) > 0 and plotHidBearFlags if overlayChart == false //Draw REALTIME oscillator divergence labels and create alert for i_print_lines = 0 to array.size(x2_osc) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 150 is arbitrary. size := 0 i_delArray := 1 if na(hidBearLabelOsc[i_del]) == false size := array.size(hidBearLabelOsc[i_del]) while i_delArray <= size label.delete( array.get(hidBearLabelOsc[i_del], array.size(hidBearLabelOsc[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBearLabelOsc, label.new(bar_index - x1_osc, y1_osc, "HBr", yloc=yloc.price, color=hiddenBearColor, style=label.style_label_down, textcolor = color.white, size = size.small) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Hidden Bear", alert.freq_once_per_bar) else //Draw REALTIME price divergence labels and create alert for i_print_lines = 0 to array.size(x2_price) - 1 if doRealtime and count_rt == 1 for i_del = numPriorLines to 350//FIX: 350 is arbitrary. size := 0 i_delArray := 1 if na(hidBearLabelPrice[i_del]) == false size := array.size(hidBearLabelPrice[i_del]) while i_delArray <= size label.delete( array.get(hidBearLabelPrice[i_del], array.size(hidBearLabelPrice[i_del]) - i_delArray)) i_delArray := i_delArray + 1 array.push(hidBearLabelPrice, label.new(bar_index - x1_price, y1_price, "HBr", yloc=yloc.price, color=hiddenBearColor, style=label.style_label_down, textcolor = color.white, size = size.small) ) if i_print_lines == 0 and doRealtimeAlerts alert("Potential Hidden Bear", alert.freq_once_per_bar) //delete if doRealtime and count_rt == 1 i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1 isHidBearFlagReady = false if plotHidBearFlags and array.size(x2_osc) > 0 and array.size(x2_price) > 0 isHidBearFlagReady := true plotshape( (isHidBearFlagReady[1] == false and isHidBearFlagReady == true) ? (overlayChart ? y1_price : y1_osc) : na, offset= (overlayChart ? -(x1_price+lbR): -(x1_osc+lbR)), title="Hidden Bearish Label", text="HBr", style=shape.labeldown, location=location.absolute, color=hiddenBearColor, textcolor=textColor, transp=0 ) i_delArray := 0 size := array.size(x2_osc) while i_delArray < size array.pop(x2_osc) array.pop(y2_osc) i_delArray := i_delArray + 1 i_delArray := 0 size := array.size(x2_price) while i_delArray < size array.pop(x2_price) array.pop(y2_price) i_delArray := i_delArray + 1
JCFBaux Volatility [Loxx]
https://www.tradingview.com/script/fSTqdHYh-JCFBaux-Volatility-Loxx/
loxx
https://www.tradingview.com/u/loxx/
163
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("JCFBaux Volatility [Loxx]", shorttitle = "JCFBV [Loxx]", timeframe="", timeframe_gaps=true, overlay = false) greencolor = #2DD204 import loxx/loxxjuriktools/1 as jf src = input.source(close, "Source", group = "Basic Settings") depth = input.int(15, "Depth", group = "Basic Settings") phase = input.float(0, "Signal - Juirk Smoothing Phase", group = "Basic Settings") lensmdd = input.int(300, "Signal - Period", group = "Basic Settings") colorbars = input.bool(true, "Color bars?", group = "UI Options") showSigs = input.bool(true, "Show signals?", group= "UI Options") jcfbaux = jf.jcfbaux(src, depth) signal = jf.jurik_filt(jcfbaux, lensmdd, phase) plot(signal, color = color.white) plot(jcfbaux, color = jcfbaux >= signal ? greencolor : color.gray, linewidth = 2) barcolor(colorbars ? jcfbaux >= signal ? greencolor : color.gray : na) goVol = ta.crossover(jcfbaux, signal) plotshape(showSigs and goVol, title = "Volatility Rising", color = color.yellow, textcolor = color.yellow, text = "V", style = shape.triangleup, location = location.bottom, size = size.auto) alertcondition(goVol, title = "Volatility Rising", message = "JCFBaux Volatility [Loxx]: Long\nSymbol: {{ticker}}\nPrice: {{close}}")
VIX: Backwardation Vs Contango
https://www.tradingview.com/script/3Os9fVrt-VIX-Backwardation-Vs-Contango/
twingall
https://www.tradingview.com/u/twingall/
37
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 // VIX: Backwardation Vs Contango // Quickly visualize Contango vs Backwardation in the VIX by plotting the price of the next 18months of futures contracts. // Note: indicator does not map to time axis in the same way as price; it simply plots the progression of contract months out into the future; left to right; so timeframe doesn't matter for this plot // There's likely some more efficient way to write this; e.g. when plotting for ZW; 15 of the security requests are redundant; but they are still made; and can make this slower to load // TO UPDATE(every year recommended): in REQUEST CONTRACTS section, delete old contracts (top) and add new ones (bottom). Then in PLOTTING section, Delete old [expired] contract labels (bottom); add new [distant future] contract labels (top); adjust the X in 'bar_index-(X+_historical)' numbers accordingly // This is one of several similar indicators: Meats | Metals | Grains | VIX // Tips: // -Right click and reset chart if you can't see the plot; or if you have trouble with the scaling. // -Right click and add to new scale if you prefer this not to overlay directly on price. Or move to new pane below. // --Added historical input: input days back in time; to see the historical shape of the Futures curve via selecting 'days back' snapshot // updated contracts 30th Jan 2023 // Β© twingall indicator("VIX: Backwardation Vs Contango", overlay = true, scale = scale.right) _historical = input(0, "time travel back; days") _adr = ta.atr(5) colorNone= color.new(color.white, 100) //Function to test if contract is expired int oneWeek = 5*24*60*60*1000 // 5 or more days since last reported closing price => expired isExp (int _timeClose)=> expired = _timeClose <= (last_bar_time-oneWeek) ///REQUEST CONTRACTS--- [jun22,jun22t]=request.security(syminfo.root + "M2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jul22,jul22t]= request.security(syminfo.root + "N2022", "D", [close[_historical], time_close], ignore_invalid_symbol=true) [aug22,aug22t]=request.security(syminfo.root + "Q2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [sept22,sept22t] =request.security(syminfo.root + "U2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [oct22,oct22t] = request.security(syminfo.root + "V2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [nov22,nov22t] =request.security(syminfo.root + "X2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [dec22,dec22t] =request.security(syminfo.root + "Z2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jan23,jan23t] =request.security(syminfo.root + "F2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [feb23,feb23t]=request.security(syminfo.root + "G2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [mar23,mar23t]=request.security(syminfo.root + "H2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [apr23,apr23t] = request.security(syminfo.root + "J2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [may23,may23t]=request.security(syminfo.root + "K2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jun23,jun23t]=request.security(syminfo.root + "M2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jul23,jul23t]= request.security(syminfo.root + "N2023", "D", [close[_historical], time_close], ignore_invalid_symbol=true) [aug23,aug23t]=request.security(syminfo.root + "Q2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [sept23,sept23t] = request.security(syminfo.root + "U2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [oct23,oct23t] = request.security(syminfo.root + "V2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) //VX plotting if barstate.islast and (syminfo.root=='VX' or syminfo.root== 'VIX') //also display on Volatility S&P 500 index: VIX label.new(bar_index-(_historical), close[_historical]+ 2*_adr, text = 'S\nN\nA\nP\nS\nH\nO\nT', textcolor = color.red, style=label.style_arrowdown, color= color.red, size = size.tiny) label.new(bar_index-(2+_historical), isExp(oct23t)?0:oct23, text = 'Oct23', textcolor =isExp(oct23t)?colorNone: color.red, style=isExp(oct23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(4+_historical), isExp(sept23t)?0:sept23, text ='Sept23',textcolor =isExp(sept23t)?colorNone:color.red, style=isExp(sept23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(6+_historical), isExp(aug23t)?0:aug23, text = 'Aug23', textcolor = isExp(aug23t)?colorNone: color.red, style=isExp(aug23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(8+_historical), isExp(jul23t)?0:jul23, text = 'Jul23', textcolor = isExp(jul23t)?colorNone: color.red, style=isExp(jul23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(10+_historical), isExp(jun23t)?0:jun23, text = 'Jun23', textcolor = isExp(jun23t)?colorNone:color.red, style=isExp(jun23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(12+_historical), isExp(may23t)?0:may23, text = 'May23', textcolor =isExp(may23t)?colorNone: color.red, style=isExp(may23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(14+_historical), isExp(apr23t)?0:apr23, text = 'Apr23', textcolor =isExp(apr23t)?colorNone: color.red, style=isExp(apr23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(16+_historical), isExp(mar23t)?0:mar23, text = 'Mar23', textcolor =isExp(mar23t)?colorNone: color.red, style=isExp(mar23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(18+_historical), isExp(feb23t)?0:feb23, text = 'Feb23', textcolor =isExp(feb23t)?colorNone: color.red, style=isExp(feb23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(20+_historical), isExp(jan23t)?0:jan23, text = 'Jan23', textcolor =isExp(jan23t)?colorNone: color.red, style=isExp(jan23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(22+_historical), isExp(dec22t)?0:dec22, text = 'Dec22', textcolor =isExp(dec22t)?colorNone: color.red, style=isExp(dec22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(24+_historical), isExp(nov22t)?0:nov22, text = 'Nov22', textcolor =isExp(nov22t)?colorNone: color.red, style=isExp(nov22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(26+_historical), isExp(oct22t)?0:oct22, text = 'Oct22', textcolor =isExp(oct22t)?colorNone: color.red, style=isExp(oct22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(28+_historical), isExp(sept22t)?0:sept22,text='Sept22', textcolor=isExp(sept22t)?colorNone: color.red,style=isExp(sept22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(30+_historical), isExp(aug22t)?0:aug22, text = 'Aug22', textcolor =isExp(aug22t)?colorNone: color.red, style=isExp(aug22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(32+_historical), isExp(jul22t)?0:jul22, text = 'Jul22', textcolor =isExp(jul22t)?colorNone: color.red, style=isExp(jul22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(34+_historical), isExp(jun22t)?0:jun22, text = 'Jun22', textcolor =isExp(jun22t)?colorNone: color.red, style=isExp(jun22t)?label.style_none:label.style_diamond, size = size.tiny)
Wolf EMA & OHL & SIGNALS
https://www.tradingview.com/script/5SrQoAYA/
WoLf4EvEr
https://www.tradingview.com/u/WoLf4EvEr/
100
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© WoLf4EvEr // //@version=4 study(title="Wolf EMA & OHL & SIGNALS", overlay=true) EMASMA = input(defval="EMA", title = 'Type MA', inline="01", options=["EMA", "SMA"]) var GRP1 = "EMA/SMA Value & Style" ShowMA1 = input(true, title='Show     ', type = input.bool, inline="01", group=GRP1) EMA1 = input( 5, title = 'MA 1', type = input.integer, inline="01", group = GRP1) colEMA1 = input( #FC3A4B, title = '    Color', type = input.color, inline="01", group = GRP1) ShowMA2 = input(true, title='Show     ', type = input.bool, inline="02", group=GRP1) EMA2 = input( 10, title = 'MA 2', type = input.integer, inline="02", group = GRP1) colEMA2 = input( #FFED5E, title = '    Color', type = input.color, inline="02", group = GRP1) ShowMA3 = input(true, title='Show     ', type = input.bool, inline="03", group=GRP1) EMA3 = input( 50, title = 'MA 3', type = input.integer, inline="03", group = GRP1) colEMA3 = input( #579AF3, title = '    Color', type = input.color, inline="03", group = GRP1) ShowMA4 = input(true, title='Show     ', type = input.bool, inline="04", group=GRP1) EMA4 = input( 100, title = 'MA 4', type = input.integer, inline="04", group = GRP1) colEMA4 = input( #673AB7, title = '    Color', type = input.color, inline="04", group = GRP1) ShowMA5 = input(true, title='Show     ', type = input.bool, inline="05", group=GRP1) EMA5 = input( 200, title = 'MA 5', type = input.integer, inline="05", group = GRP1) colEMA5 = input( #A022AD, title = '    Color', type = input.color, inline="05", group = GRP1) var GRP22 = "EMA/SMA Style Day" ShowMAD = input(true, title='Show    ', type = input.bool, inline="01", group=GRP22) styleOption = input("dashed (β•Œ)", type=input.string, title="Style", inline="01", group = GRP22, options=["solid (─)", "dotted (β”ˆ)", "dashed (β•Œ)","arrow left (←)", "arrow right (β†’)", "arrows both (↔)"]) lineStyle = styleOption == "dotted (β”ˆ)" ? line.style_dotted : styleOption == "dashed (β•Œ)" ? line.style_dashed : styleOption == "arrow left (←)" ? line.style_arrow_left : styleOption == "arrow right (β†’)" ? line.style_arrow_right : styleOption == "arrows both (↔)" ? line.style_arrow_both : line.style_solid lineWidht = input( 1, title = '    Width', type = input.integer, inline="01",group = GRP22) var GRP3 = 'Open High Low Label' WEEK = input(false, title='Show Week Open-High-Low', type = input.bool, inline="01", group=GRP3) c_High = input(#00CB84, title='HIGH_ ', type = input.color, inline="02", group=GRP3) c_Open = input(#FFFFFF, title='OPEN ', type = input.color, inline="03", group=GRP3) c_Low = input(#FF0000, title='LOW_ ', type = input.color, inline="04",group=GRP3) c_High1 = input(#00CB84, title='HIGH -1', type = input.color, inline="02", group=GRP3) c_Open1 = input(#FFFFFF, title='OPEN -1', type = input.color, inline="03", group=GRP3) c_Low1 = input(#FF0000, title='LOW_ -1', type = input.color, inline="04",group=GRP3) OFFSET = input(10, title='Margin Label', type = input.integer, inline="05", group=GRP3) var GRP9 = "Alert EMA" alertEMA1 = input(false, "Alert MA 1", inline="01", group = GRP9) alertEMA2 = input(false, "Alert MA 2", inline="01", group = GRP9) alertEMA3 = input(false, "Alert MA 3", inline="01", group = GRP9) alertEMA4 = input(false, "Alert MA 4", inline="01", group = GRP9) alertEMA5 = input(false, "Alert MA 5", inline="01", group = GRP9) alertEMA6 = input(false, "Alert MA 1D", inline="02", group = GRP9) alertEMA7 = input(false, "Alert MA 2D", inline="02", group = GRP9) alertEMA8 = input(false, "Alert MA 3D", inline="02", group = GRP9) alertEMA9 = input(false, "Alert MA 4D", inline="02", group = GRP9) //alertEMA10 = input(false, "Alert EMA 10", inline="04", group = GRP1) var GRP4 = "Shimano" alertShimano = input(false, "Alert Shimano", inline="01", group = GRP4) ShimanoLength = input(10, title = '  Shimano Length', type = input.integer, inline="01", group = GRP4) var GRP5 = "Viagra" alertViagra = input(false, "Alert Viagra", inline="01", group = GRP5) ViagraLength = input(20, title = '  Viagra Length', type = input.integer, inline="01", group = GRP5) var GRP6 = "Anti-crossing" alertTrend = input(false, "Alert Anti-crossing", inline="01", group = GRP6) //TrendLength = input(30, title = '  Trend Length', type = input.integer, inline="01", group = GRP6) var GRP7 = "Cross" alertCross = input(false, "Alert Crossing", inline="01", group = GRP7) //CrossLength = input(30, title = '  Cross Length', type = input.integer, inline="01", group = GRP7) var GRP8 = "BUD" alertBud = input(false, "Alert BUD", group = GRP8) // Var EMA valEMA1 = EMASMA=="EMA" ? ema(close,EMA1):sma(close,EMA1) valEMA2 = EMASMA=="EMA" ? ema(close,EMA2):sma(close,EMA2) //ema(close,EMA2) valEMA3 = EMASMA=="EMA" ? ema(close,EMA3):sma(close,EMA3) valEMA4 = EMASMA=="EMA" ? ema(close,EMA4):sma(close,EMA4) valEMA5 = EMASMA=="EMA" ? ema(close,EMA5):sma(close,EMA5) // Draw EMA plotEMA1 = plot(ShowMA1?valEMA1:na, title = 'MA 1', color = colEMA1, linewidth=1) plotEMA2 = plot(ShowMA2?valEMA2:na, title = 'MA 2', color = colEMA2, linewidth=1) plotEMA3 = plot(ShowMA3?valEMA3:na, title = 'MA 3', color = colEMA3, linewidth=2) plotEMA4 = plot(ShowMA4?valEMA4:na, title = 'MA 4', color = colEMA4, linewidth=2) //display=display.none plotEMA5 = plot(ShowMA5?valEMA5:na, title = 'MA 5', color = colEMA5, linewidth=3) var ltime = " [D]" isNewDay = time("D") != time("D")[1] isNewWeek = time("W") != time("W")[1] valEMA6 =security(syminfo.tickerid, "D", EMASMA=="EMA" ? ema(close, EMA1):sma(close, EMA1), barmerge.gaps_off, barmerge.lookahead_on) valEMA7 =security(syminfo.tickerid, "D", EMASMA=="EMA" ? ema(close, EMA2):sma(close, EMA2), barmerge.gaps_off, barmerge.lookahead_on) valEMA8 =security(syminfo.tickerid, "D", EMASMA=="EMA" ? ema(close, EMA3):sma(close, EMA3), barmerge.gaps_off, barmerge.lookahead_on) valEMA9 =security(syminfo.tickerid, "D", EMASMA=="EMA" ? ema(close, EMA4):sma(close, EMA4), barmerge.gaps_off, barmerge.lookahead_on) valEMA10=security(syminfo.tickerid, "D", EMASMA=="EMA" ? ema(close, EMA5):sma(close, EMA5), barmerge.gaps_off, barmerge.lookahead_on) valEMA6W =security(syminfo.tickerid, "W", EMASMA=="EMA" ? ema(close, EMA1):sma(close, EMA1), barmerge.gaps_off, barmerge.lookahead_on) valEMA7W =security(syminfo.tickerid, "W", EMASMA=="EMA" ? ema(close, EMA2):sma(close, EMA2), barmerge.gaps_off, barmerge.lookahead_on) valEMA8W =security(syminfo.tickerid, "W", EMASMA=="EMA" ? ema(close, EMA3):sma(close, EMA3), barmerge.gaps_off, barmerge.lookahead_on) valEMA9W =security(syminfo.tickerid, "W", EMASMA=="EMA" ? ema(close, EMA4):sma(close, EMA4), barmerge.gaps_off, barmerge.lookahead_on) valEMA10W=security(syminfo.tickerid, "W", EMASMA=="EMA" ? ema(close, EMA5):sma(close, EMA5), barmerge.gaps_off, barmerge.lookahead_on) if timeframe.isintraday and ShowMAD var line L_EMA6 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA1, style=lineStyle, width=lineWidht) var line L_EMA7 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA2, style=lineStyle, width=lineWidht) var line L_EMA8 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA3, style=lineStyle, width=lineWidht) var line L_EMA9 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA4, style=lineStyle, width=lineWidht) var line L_EMA10= line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA5, style=lineStyle, width=lineWidht) if isNewDay L_EMA6 := line.new(bar_index, valEMA6[1], bar_index+1, valEMA6[1], extend=extend.none, color=colEMA1, style=lineStyle, width=lineWidht) L_EMA7 := line.new(bar_index, valEMA7[1], bar_index+1, valEMA7[1], extend=extend.none, color=colEMA2, style=lineStyle, width=lineWidht) L_EMA8 := line.new(bar_index, valEMA8[1], bar_index+1, valEMA8[1], extend=extend.none, color=colEMA3, style=lineStyle, width=lineWidht) L_EMA9 := line.new(bar_index, valEMA9[1], bar_index+1, valEMA9[1], extend=extend.none, color=colEMA4, style=lineStyle, width=lineWidht) L_EMA10:= line.new(bar_index,valEMA10[1], bar_index+1,valEMA10[1], extend=extend.none, color=colEMA5, style=lineStyle, width=lineWidht) if not isNewDay line.set_x2(L_EMA6, bar_index) line.set_y2(L_EMA6, valEMA6[0]) line.set_x2(L_EMA7, bar_index) line.set_y2(L_EMA7, valEMA7[0]) line.set_x2(L_EMA8, bar_index) line.set_y2(L_EMA8, valEMA8[0]) line.set_x2(L_EMA9, bar_index) line.set_y2(L_EMA9, valEMA9[0]) line.set_x2(L_EMA10, bar_index) line.set_y2(L_EMA10, valEMA10[0]) labelEMA6 = label.new( bar_index+2, valEMA6, EMASMA+tostring(EMA1)+ltime, textcolor=colEMA1, size=size.small, style=label.style_none) label.delete(labelEMA6[1]) labelEMA7 = label.new( bar_index+2, valEMA7, EMASMA+tostring(EMA2)+ltime, textcolor=colEMA2, size=size.small, style=label.style_none) label.delete(labelEMA7[1]) labelEMA8 = label.new( bar_index+2, valEMA8, EMASMA+tostring(EMA3)+ltime, textcolor=colEMA3, size=size.small, style=label.style_none) label.delete(labelEMA8[1]) labelEMA9 = label.new( bar_index+2, valEMA9, EMASMA+tostring(EMA4)+ltime, textcolor=colEMA4, size=size.small, style=label.style_none) label.delete(labelEMA9[1]) labelEMA10= label.new( bar_index+2, valEMA10, EMASMA+tostring(EMA5)+ltime, textcolor=colEMA5, size=size.small, style=label.style_none) label.delete(labelEMA10[1]) if not timeframe.isintraday and ShowMAD and timeframe.isdaily ltime := " [W]" var line L_EMA6 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA1, style=lineStyle, width=lineWidht) var line L_EMA7 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA2, style=lineStyle, width=lineWidht) var line L_EMA8 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA3, style=lineStyle, width=lineWidht) var line L_EMA9 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA4, style=lineStyle, width=lineWidht) var line L_EMA10= line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.none, color=colEMA5, style=lineStyle, width=lineWidht) if isNewWeek L_EMA6 := line.new(bar_index, valEMA6W[1], bar_index+1, valEMA6W[1], extend=extend.none, color=colEMA1, style=lineStyle, width=lineWidht) L_EMA7 := line.new(bar_index, valEMA7W[1], bar_index+1, valEMA7W[1], extend=extend.none, color=colEMA2, style=lineStyle, width=lineWidht) L_EMA8 := line.new(bar_index, valEMA8W[1], bar_index+1, valEMA8W[1], extend=extend.none, color=colEMA3, style=lineStyle, width=lineWidht) L_EMA9 := line.new(bar_index, valEMA9W[1], bar_index+1, valEMA9W[1], extend=extend.none, color=colEMA4, style=lineStyle, width=lineWidht) L_EMA10:= line.new(bar_index,valEMA10W[1], bar_index+1,valEMA10W[1], extend=extend.none, color=colEMA5, style=lineStyle, width=lineWidht) if not isNewWeek line.set_x2(L_EMA6, bar_index) line.set_y2(L_EMA6, valEMA6W[0]) line.set_x2(L_EMA7, bar_index) line.set_y2(L_EMA7, valEMA7W[0]) line.set_x2(L_EMA8, bar_index) line.set_y2(L_EMA8, valEMA8W[0]) line.set_x2(L_EMA9, bar_index) line.set_y2(L_EMA9, valEMA9W[0]) line.set_x2(L_EMA10, bar_index) line.set_y2(L_EMA10, valEMA10W[0]) labelEMA6 = label.new( bar_index+2, valEMA6W, EMASMA+tostring(EMA1)+ltime, textcolor=colEMA1, size=size.small, style=label.style_none) label.delete(labelEMA6[1]) labelEMA7 = label.new( bar_index+2, valEMA7W, EMASMA+tostring(EMA2)+ltime, textcolor=colEMA2, size=size.small, style=label.style_none) label.delete(labelEMA7[1]) labelEMA8 = label.new( bar_index+2, valEMA8W, EMASMA+tostring(EMA3)+ltime, textcolor=colEMA3, size=size.small, style=label.style_none) label.delete(labelEMA8[1]) labelEMA9 = label.new( bar_index+2, valEMA9W, EMASMA+tostring(EMA4)+ltime, textcolor=colEMA4, size=size.small, style=label.style_none) label.delete(labelEMA9[1]) labelEMA10= label.new( bar_index+2, valEMA10W, EMASMA+tostring(EMA5)+ltime, textcolor=colEMA5, size=size.small, style=label.style_none) label.delete(labelEMA10[1]) //----------- Allerts EMA ----------------- if crossover(close, valEMA1) and alertEMA1 alert("OVER "+EMASMA+tostring(EMA1)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA1) and alertEMA1 alert("UNDER "+EMASMA+tostring(EMA1)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA2) and alertEMA2 alert("OVER "+EMASMA+tostring(EMA2)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA2) and alertEMA2 alert("UNDER "+EMASMA+tostring(EMA2)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA3) and alertEMA3 alert("OVER "+EMASMA+tostring(EMA3)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA3) and alertEMA3 alert("UNDER "+EMASMA+tostring(EMA3)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA4) and alertEMA4 alert("OVER "+EMASMA+tostring(EMA4)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA4) and alertEMA4 alert("UNDER "+EMASMA+tostring(EMA4)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA5) and alertEMA5 alert("OVER "+EMASMA+tostring(EMA5)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA5) and alertEMA5 alert("UNDER "+EMASMA+tostring(EMA5)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA6) and alertEMA6 alert("OVER "+EMASMA+tostring(EMA1)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA6) and alertEMA6 alert("UNDER "+EMASMA+tostring(EMA1)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA7) and alertEMA7 alert("OVER "+EMASMA+tostring(EMA2)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA7) and alertEMA7 alert("UNDER "+EMASMA+tostring(EMA2)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA8) and alertEMA8 alert("OVER "+EMASMA+tostring(EMA3)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA8) and alertEMA8 alert("UNDER "+EMASMA+tostring(EMA3)+ltime, alert.freq_once_per_bar_close) if crossover(close, valEMA9) and alertEMA9 alert("OVER "+EMASMA+tostring(EMA4)+ltime, alert.freq_once_per_bar_close) if crossunder(close, valEMA9) and alertEMA9 alert("UNDER "+EMASMA+tostring(EMA4)+ltime, alert.freq_once_per_bar_close) //if crossover(close, valEMA10) and alertEMA10 // alert("OVER EMA"+tostring(EMA10)+ltime, alert.freq_once_per_bar_close) //if crossunder(close, valEMA10) and alertEMA10 // alert("UNDER EMA"+tostring(EMA10)+ltime, alert.freq_once_per_bar_close) //--------- Set Type Label ------------------- var label myLabelH = label.new(na, na, "____________ HIGH [D] ___________", textcolor=c_High, style=label.style_none, textalign = text.align_right ) var label myLabelO = label.new(na, na, "____________ OPEN [D] ___________", textcolor=c_Open, style=label.style_none, textalign = text.align_right ) var label myLabelL = label.new(na, na, "_____________ LOW [D] ___________", textcolor=c_Low, style=label.style_none, textalign = text.align_right ) var label myLabelH1 = label.new(na, na, "_____________________ HIGH [D-1] ", textcolor=c_High1, style=label.style_none, textalign = text.align_left ) var label myLabelO1 = label.new(na, na, "_____________________ OPEN [D-1] ", textcolor=c_Open1, style=label.style_none, textalign = text.align_right ) var label myLabelL1 = label.new(na, na, "______________________ LOW [D-1] ", textcolor=c_Low1, style=label.style_none, textalign = text.align_right ) var label myLabelWH = label.new(na, na, "_ _ _ _ _ _ _ _ _ _ _ HIGH [W]", textcolor=c_High, style=label.style_none, textalign = text.align_left ) var label myLabelWO = label.new(na, na, "_ _ _ _ _ _ _ _ _ _ _ OPEN [W]", textcolor=c_Open, style=label.style_none, textalign = text.align_left ) var label myLabelWL = label.new(na, na, "_ _ _ _ _ _ _ _ _ _ _ _LOW [W]", textcolor=c_Low, style=label.style_none, textalign = text.align_left ) var label myLabelWH1 = label.new(na, na, "_ _ _ _ _ _ _ _ _ _ _ HIGH [W-1]", textcolor=c_High1, style=label.style_none, textalign = text.align_left ) var label myLabelWO1 = label.new(na, na, "_ _ _ _ _ _ _ _ _ _ _ OPEN [W-1]", textcolor=c_Open1, style=label.style_none, textalign = text.align_left ) var label myLabelWL1 = label.new(na, na, "_ _ _ _ _ _ _ _ _ _ _ _LOW [W-1]", textcolor=c_Low1, style=label.style_none, textalign = text.align_left ) var line myLineH = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.both, color=#00000000, style=line.style_solid, width=1) var line myLineO = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.both, color=#00000000, style=line.style_solid, width=1) var line myLineL = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.both, color=#00000000, style=line.style_solid, width=1) var line myLineH1 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.both, color=#00000000, style=line.style_solid, width=1) var line myLineO1 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.both, color=#00000000, style=line.style_solid, width=1) var line myLineL1 = line.new(na, na, na, na, xloc=xloc.bar_time, extend=extend.both, color=#00000000, style=line.style_solid, width=1) // Var OHL day_high = security(syminfo.tickerid, 'D', high[0]) day_open = security(syminfo.tickerid, 'D', open[0]) day_low = security(syminfo.tickerid, 'D', low[0] ) day_high1 = security(syminfo.tickerid, 'D', high[1]) day_open1 = security(syminfo.tickerid, 'D', open[1]) day_low1 = security(syminfo.tickerid, 'D', low[1] ) week_high = security(syminfo.tickerid, 'W', high[0]) week_open = security(syminfo.tickerid, 'W', open[0]) week_low = security(syminfo.tickerid, 'W', low[0] ) week_high1 = security(syminfo.tickerid, 'W', high[1]) week_open1 = security(syminfo.tickerid, 'W', open[1]) week_low1 = security(syminfo.tickerid, 'W', low[1] ) dt = time - time[1] F_Line(_line, _y) => line.set_xy1(_line, time_close , _y) line.set_xy2(_line, time_close + 5, _y) F_Label(_lab, _y, _set) => label.set_y(_lab, _y) label.set_xloc(_lab, time + _set * dt, xloc.bar_time) label.set_size(_lab, size.small) // Draw Line & Label if timeframe.isintraday F_Line(myLineH, day_high) line.set_color(myLineH,abs(((close[0] - day_high)/day_high)*100) < 2 ? c_High : #00000000) F_Line(myLineO, day_open) line.set_color(myLineO,abs(((close[0] - day_open)/day_open)*100) < 2 ? c_Open : #00000000) F_Line(myLineL, day_low) line.set_color(myLineL,abs(((close[0] - day_low)/day_low)*100) < 2 ? c_Low : #00000000) F_Line(myLineH1, day_high1) line.set_color(myLineH1,abs(((close[0] - day_high1)/day_high1)*100) < 2 ? c_High1 : #00000000) F_Line(myLineO1, day_open1) line.set_color(myLineO1,abs(((close[0] - day_open1)/day_open1)*100) < 2 ? c_Open1 : #00000000) F_Line(myLineL1, day_low1) line.set_color(myLineL1,abs(((close[0] - day_low1)/day_low1)*100) < 2 ? c_Low1 : #00000000) F_Label( myLabelH, day_high, OFFSET ) F_Label( myLabelO, day_open, OFFSET ) F_Label( myLabelL, day_low, OFFSET ) F_Label( myLabelH1, day_high1, OFFSET ) F_Label( myLabelO1, day_open1, OFFSET ) F_Label( myLabelL1, day_low1, OFFSET ) if WEEK F_Label( myLabelWH, week_high, OFFSET ) F_Label( myLabelWO, week_open, OFFSET ) F_Label( myLabelWL, week_low, OFFSET ) F_Label( myLabelWH1, week_high1, OFFSET ) F_Label( myLabelWO1, week_open1, OFFSET ) F_Label( myLabelWL1, week_low1, OFFSET ) //-------------------------------------------------------- //| SIGNALS | //-------------------------------------------------------- //---------------------- Shimano ------------------------- var shimano_count = 0 go_shimano_long = false go_shimano_short = false var is_shimano_long = false var is_shimano_short = false if (close[0] < valEMA5[0] and close[0] > valEMA3[0]) or (close[0] > valEMA5[0] and close[0] < valEMA3[0]) shimano_count := shimano_count + 1 if shimano_count > ShimanoLength if close > valEMA5 and close > valEMA3 and not is_shimano_long go_shimano_long := true is_shimano_long := true if close < valEMA3 and close < valEMA5 and not is_shimano_short go_shimano_short := true is_shimano_short := true if (valEMA1[0] > valEMA5[0] and valEMA1[0] > valEMA3[0]) or (valEMA1[0] < valEMA5[0] and valEMA1[0] < valEMA3[0]) shimano_count := 0 is_shimano_long := false is_shimano_short := false plotshape(go_shimano_long,"Shimano Long", style=shape.arrowup, location=location.abovebar, text="β–² S", textcolor=#FFFFFF, color=#FFFFFF00) if go_shimano_long and alertShimano alert("Shimano Long", alert.freq_once_per_bar_close) plotshape(go_shimano_short,"Shimano Short", style=shape.arrowdown, location=location.belowbar, text="β–Ό S", textcolor=#FFFFFF, color=#FFFFFF00) if go_shimano_short and alertShimano alert("Shimano Short", alert.freq_once_per_bar_close) //---------------------- Viagra ------------------------- var viagra_long = 0 var viagra_short = 0 go_viagra_long = false go_viagra_short = false // viagra LONG if close[0] < valEMA2[0] viagra_long := viagra_long + 1 if viagra_long > ViagraLength if close[0] > valEMA2[0] go_viagra_long := true if close[0] > valEMA2[0] viagra_long := 0 // viagra SHORT if close[0] > valEMA2[0] viagra_short := viagra_short + 1 if viagra_short > ViagraLength if close[0] < valEMA2[0] go_viagra_short := true if close[0] < valEMA2[0] viagra_short := 0 plotshape(go_viagra_long,"Viagra Long", style=shape.arrowup, location=location.abovebar, text="β–² V", textcolor=#FFFFFF, color=#FFFFFF00) if go_viagra_long and alertViagra alert("viagra Long", alert.freq_once_per_bar_close) plotshape(go_viagra_short,"Viagra Short", style=shape.arrowdown, location=location.belowbar, text="β–Ό V", textcolor=#FFFFFF, color=#FFFFFF00) if go_viagra_short and alertViagra alert("Viagra Short", alert.freq_once_per_bar_close) //---------------------- Cross ------------------------- go_cross_long = false go_cross_short = false var is_cross_long = false var is_cross_short = false if crossover(valEMA1[0], valEMA3[0]) and valEMA5[0] > valEMA3[0] is_cross_long := true if crossunder(valEMA1[0], valEMA3[0]) and is_cross_long is_cross_long := false if crossover(valEMA1[0], valEMA5[0]) and valEMA5[0] > valEMA3[0] and is_cross_long go_cross_long := true if crossunder(valEMA1[0], valEMA3[0]) and valEMA5[0] < valEMA3[0] is_cross_short := true if crossover(valEMA1[0], valEMA3[0]) and is_cross_short is_cross_short := false if crossunder(valEMA1[0], valEMA5[0]) and valEMA5[0] < valEMA3[0] and is_cross_short go_cross_short := true plotshape(go_cross_long,"Cross Long", style=shape.arrowup, location=location.belowbar, text="β–² C", textcolor=#FFFFFF, color=#00FF0099) if go_cross_long and alertCross alert("Cross Long", alert.freq_once_per_bar_close) plotshape(go_cross_short,"Cross Short", style=shape.arrowdown, location=location.abovebar, text="β–Ό C", textcolor=#FFFFFF, color=#FF000099) if go_cross_short and alertCross alert("Cross Short", alert.freq_once_per_bar_close) //---------------------- Trend ------------------------- go_trend_long = false go_trend_short = false var is_trend_long = false var is_trend_short = false if crossover(valEMA1[0], valEMA5[0]) and valEMA5[0] < valEMA3[0] is_trend_long := true if crossunder(valEMA1[0], valEMA5[0]) and is_trend_long is_trend_long := false if crossover(valEMA1[0], valEMA3[0]) and valEMA5[0] < valEMA3[0] and is_trend_long go_trend_long := true if crossunder(valEMA1[0], valEMA5[0]) and valEMA5[0] > valEMA3[0] is_trend_short := true if crossover(valEMA1[0], valEMA5[0]) and is_trend_short is_trend_short := false if crossunder(valEMA1[0], valEMA3[0]) and valEMA5[0] > valEMA3[0] and is_trend_short go_trend_short := true plotshape(go_trend_long,"Anti-crossing Long", style=shape.arrowup, location=location.belowbar, text="β–² AC", textcolor=#FFFFFF, color=#00FF0099) if go_trend_long and alertTrend alert("Anti-crossing Long", alert.freq_once_per_bar_close) plotshape(go_trend_short,"Anti-crossing Short", style=shape.arrowdown, location=location.abovebar, text="β–Ό AC", textcolor=#FFFFFF, color=#FF000099) if go_trend_short and alertTrend alert("Anti-crossing Short", alert.freq_once_per_bar_close) //-------------- Bud ---------------------- go_bud_long = false var pclose = 0.0 var popen = 0.0 var phigh = 0.0 var plow = 0.0 var startUp = 0 var onBudUp = 0 var countBudUp = 0 myLineBUD = line.new(na, na, na, na, color=#FFFFFF, width=2, style=line.style_dotted) labelBud = label.new(na, na, style=label.style_none, textcolor=#FFFFFF, text="BUD ?") //---- BUD UP ------ if (close > open and countBudUp == 0) pclose := close popen := open phigh := high plow := low startUp:= bar_index onBudUp:= 1 if ((close < pclose and close > popen) or (high < phigh and low > plow)) and onBudUp == 1 countBudUp := countBudUp + 1 if countBudUp >= 2 if startUp > 0 myLineBUD = line.new(startUp, phigh, bar_index, phigh, color=#FFFFFF, width=2, style=line.style_dotted) line.delete(id=myLineBUD[1]) //labelBud = label.new(bar_index - 1, phigh, style=label.style_none, textcolor=#FFFFFF, text="BUD ?") //label.delete(id=labelBud[1]) if close > phigh and countBudUp >= 2 go_bud_long := true line.new(startUp, phigh, bar_index, phigh, color=#FFFFFF, width=2, style=line.style_dotted) label.new(bar_index-(countBudUp/2), phigh, style=label.style_none, textcolor=#FFFFFF, size=size.normal, text="β–² "+tostring(countBudUp)) line.delete(id=myLineBUD[1]) label.delete(id=labelBud[1]) if (high > phigh or low < plow or close > phigh or close < plow) and onBudUp == 1 countBudUp := 0 onBudUp := 0 if (close > open and countBudUp == 0) pclose := close popen := open phigh := high plow := low startUp:= bar_index onBudUp:= 1 //---- BUD DOWN ------ var pcloseD = 0.0 var popenD = 0.0 var phighD = 0.0 var plowD = 0.0 var startDown = 0 var onBudDown = 0 var countBudDown = -1 myLineBUDDown = line.new(na, na, na, na, color=#FFFFFF, width=2, style=line.style_dotted) labelBudDown = label.new(na, na, style=label.style_none, textcolor=#FFFFFF, text="BUD ?") if (close < open and countBudDown < 0) pcloseD := close popenD := open phighD := high plowD := low startDown := bar_index onBudDown := 1 countBudDown := 0 if (high < phighD and low > plowD) and onBudDown == 1 countBudDown := countBudDown + 1 if countBudDown >= 2 and startDown > 0 myLineBUDDown = line.new(startDown, plowD, bar_index, plowD, color=#FFFFFF, width=2, style=line.style_dotted) line.delete(id=myLineBUDDown[1]) if close < plowD and countBudDown >= 2 go_bud_long := true line.new(startDown, plowD, bar_index, plowD, color=#FFFFFF, width=2, style=line.style_dotted) label.new(bar_index-countBudDown, plowD, style=label.style_none, textcolor=#FFFFFF, size=size.normal, text="β–Ό "+tostring(countBudDown)) line.delete(id=myLineBUDDown[1]) label.delete(id=labelBudDown[1]) if (high > phighD or low < plowD or close > phighD or close < plowD) and onBudDown == 1 countBudDown := -1 onBudDown := 0 if (close < open and countBudDown == 0) pcloseD := close popenD := open phighD := high plowD := low startDown := bar_index onBudDown := 1 plotshape(go_bud_long,"BUD", style=shape.arrowup, location=location.abovebar, text="", color=#FFFFFF00) if go_bud_long and alertBud alert("BUD", alert.freq_once_per_bar_close)
Metals:Backwardation/Contango
https://www.tradingview.com/script/U6EnK0BF-Metals-Backwardation-Contango/
twingall
https://www.tradingview.com/u/twingall/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 //Metals: Gold, Silver, Copper (GC, SI, HG) // Quickly visualize carrying charge market vs backwardized market by comparing the price of the next 2 years of futures contracts. // Carrying charge (contract prices increasing into the future) = normal, representing the costs of carrying/storage of a commodity. When this is flipped to Backwardation (contract prices decreasing into the future): its a bullish sign: Buyers want this commodity, and they want it NOW. // Note: indicator does not map to time axis in the same way as price; it simply plots the progression of contract months out into the future; left to right; so timeframe doesn't matter for this plot // There's likely some more efficient way to write this; e.g. when plotting for Gold (GC); 21 of the security requests are redundant; but they are still made; and can make this slower to load // TO UPDATE: in REQUEST CONTRACTS section, delete old contracts (top) and add new ones (bottom). Then in PLOTTING section, Delete old [expired] contract labels (bottom); add new [distant future] contract labels (top); adjust the X in 'bar_index-(X+_historical)' numbers accordingly // This is one of three similar indicators: Meats | Metals | Grains // -If you want to build from this; to work on other commodities; be aware that Tradingview limits the number of contract calls to 40 (hence the 3 seperate indicators) // Tips: // -Right click and reset chart if you can't see the plot; or if you have trouble with the scaling. // -Right click and add to new scale if you prefer this not to overlay directly on price. Or move to new pane below. // --Added historical input: input days back in time; to see the historical shape of the Futures curve via selecting 'days back' snapshot // updated contracts 30th Jan 2023 // Β© twingall indicator("Metals:Backwardation/Contango", overlay = true, scale = scale.right) _historical = input(0, "time travel back; days") _adr = ta.atr(5) colorNone= color.new(color.white, 100) //Function to test if contract is expired int oneWeek = 5*24*60*60*1000 // 5 or more days since last reported closing price => expired isExp (int _timeClose)=> expired = _timeClose <= (last_bar_time-oneWeek) ///REQUEST CONTRACTS--- //shared contracts and/or All Gold contracts. Use of "COMEX:" so we don't mistakenly call Russian Ruble // [jun22,jun22t]= request.security("COMEX:" + syminfo.root + "M2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) // [jul22,jul22t] = request.security("COMEX:" + syminfo.root + "N2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [aug22,aug22t] = request.security("COMEX:" + syminfo.root + "Q2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [oct22,oct22t]= request.security("COMEX:" + syminfo.root + "V2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [dec22, dec22t]= request.security("COMEX:" + syminfo.root + "Z2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [feb23,feb23t]= request.security("COMEX:" + syminfo.root + "G2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [mar23,mar23t]=request.security("COMEX:" + syminfo.root + "H2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [apr23,apr23t]= request.security("COMEX:" + syminfo.root + "J2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jun23,jun23t]= request.security("COMEX:" + syminfo.root + "M2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [aug23,aug23t]=request.security("COMEX:" + syminfo.root + "Q2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [oct23,oct23t]=request.security("COMEX:" + syminfo.root + "V2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [dec23,dec23t]=request.security("COMEX:" + syminfo.root + "Z2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [feb24,feb24t] = request.security("COMEX:" + syminfo.root + "G2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [apr24,apr24t]= request.security("COMEX:" + syminfo.root + "J2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jun24,jun24t]= request.security("COMEX:" + syminfo.root + "M2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [dec24,dec24t]= request.security("COMEX:" + syminfo.root + "Z2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jun25,jun25t]= request.security("COMEX:" + syminfo.root + "M2025", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [dec25,dec25t]= request.security("COMEX:" + syminfo.root + "Z2025", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jun26,jun26t]=request.security("COMEX:" + syminfo.root + "M2026", "D",[close[_historical], time_close], ignore_invalid_symbol=true) //additional contracts for Silver // [sept22,sept22t]=request.security("COMEX:" + syminfo.root + "U2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jan23,jan23t]=request.security("COMEX:" + syminfo.root + "F2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [may23,may23t]=request.security("COMEX:" + syminfo.root + "K2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jul23,jul23t]=request.security("COMEX:" + syminfo.root + "N2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [sept23,sept23t]=request.security("COMEX:" + syminfo.root + "U2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jan24,jan24t]=request.security("COMEX:" + syminfo.root + "F2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [mar24,mar24t]=request.security("COMEX:" + syminfo.root + "H2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jul24,jul24t]=request.security("COMEX:" + syminfo.root + "N2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jul25,jul25t]=request.security("COMEX:" + syminfo.root + "N2025", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [jul26,jul26t]=request.security("COMEX:" + syminfo.root + "N2026", "D",[close[_historical], time_close], ignore_invalid_symbol=true) //additional contracts for Copper // [nov22,nov22t]= request.security("COMEX:" + syminfo.root + "X2022", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [nov23,nov23t]=request.security("COMEX:" + syminfo.root + "X2023", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [may24,may24t]=request.security("COMEX:" + syminfo.root + "K2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [sept24,sept24t]=request.security("COMEX:" + syminfo.root + "U2024", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [mar25,mar25t]= request.security("COMEX:" + syminfo.root + "H2025", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [may25,may25t]=request.security("COMEX:" + syminfo.root + "K2025", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [sept25,sept25t]=request.security("COMEX:" + syminfo.root + "U2025", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [mar26,mar26t]=request.security("COMEX:" + syminfo.root + "H2026", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [may26,may26t]=request.security("COMEX:" + syminfo.root + "K2026", "D",[close[_historical], time_close], ignore_invalid_symbol=true) [sept26,sept26t]=request.security("COMEX:" + syminfo.root + "U2026", "D",[close[_historical], time_close], ignore_invalid_symbol=true) //PLOTTING---- // //Gold plotting if barstate.islast and syminfo.root=='GC' label.new(bar_index-(_historical), close[_historical]+ 2*_adr, text = 'S\nN\nA\nP\nS\nH\nO\nT', textcolor = color.red, style=label.style_arrowdown, color= color.red, size = size.tiny) label.new(bar_index-(2+_historical), isExp(jun26t)?0:jun26, text = 'Jun26', textcolor =isExp(jun26t)?colorNone: color.red, style=isExp(jun26t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(4+_historical), isExp(dec25t)?0:dec25, text = 'Dec25', textcolor =isExp(dec25t)?colorNone: color.red, style=isExp(dec25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(6+_historical), isExp(jun25t)?0:jun25, text = 'Jun25', textcolor =isExp(jun25t)?colorNone: color.red, style=isExp(jun25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(8+_historical), isExp(dec24t)?0:dec24, text = 'Dec24', textcolor =isExp(dec24t)?colorNone: color.red, style=isExp(dec24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(10+_historical), isExp(jun24t)?0:jun24, text = 'Jun24', textcolor =isExp(jun24t)?colorNone: color.red, style=isExp(jun24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(12+_historical), isExp(apr24t)?0:apr24, text = 'Apr24', textcolor =isExp(apr24t)?colorNone: color.red, style=isExp(apr24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(14+_historical), isExp(feb24t)?0:feb24, text = 'Feb24', textcolor =isExp(feb24t)?colorNone: color.red, style=isExp(feb24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(16+_historical), isExp(dec23t)?0:dec23, text = 'Dec23', textcolor =isExp(dec23t)?colorNone: color.red, style=isExp(dec23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(18+_historical), isExp(oct23t)?0:oct23, text = 'Oct23', textcolor =isExp(oct23t)?colorNone: color.red, style=isExp(oct23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(20+_historical), isExp(aug23t)?0:aug23, text = 'Aug23', textcolor =isExp(aug23t)?colorNone: color.red, style=isExp(aug23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(22+_historical), isExp(jun23t)?0:jun23, text = 'Jun23', textcolor =isExp(jun23t)?colorNone: color.red, style=isExp(jun23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(24+_historical), isExp(apr23t)?0:apr23, text = 'Apr23', textcolor =isExp(apr23t)?colorNone: color.red, style=isExp(apr23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(26+_historical), isExp(feb23t)?0:feb23, text = 'Feb23', textcolor =isExp(feb23t)?colorNone: color.red, style=isExp(feb23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(28+_historical), isExp(dec22t)?0:dec22, text = 'Dec22', textcolor =isExp(dec22t)?colorNone: color.red, style=isExp(dec22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(30+_historical), isExp(oct22t)?0:oct22, text = 'Oct22', textcolor =isExp(oct22t)?colorNone: color.red, style=isExp(oct22t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(32+_historical), isExp(aug22t)?0:aug22, text = 'Aug22', textcolor =isExp(aug22t)?colorNone: color.red, style=isExp(aug22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(34+_historical), isExp(jul22t)?0:jul22, text = 'Jul22', textcolor = isExp(jul22t)?colorNone:color.red, style=isExp(jul22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(36+_historical), isExp(jun22t)?0:jun22, text = 'Jun22', textcolor = isExp(jun22t)?colorNone:color.red, style=isExp(jun22t)?label.style_none:label.style_diamond, size = size.tiny) //Silver plotting if barstate.islast and syminfo.root == 'SI' label.new(bar_index-(_historical), close[_historical]+ 2*_adr, text = 'S\nN\nA\nP\nS\nH\nO\nT', textcolor = color.red, style=label.style_arrowdown, color= color.red, size = size.tiny) label.new(bar_index-(2+_historical), isExp(jul26t)?0:jul26, text = 'Jul26', textcolor =isExp(jul26t)?colorNone: color.red, style=isExp(jul26t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(4+_historical), isExp(dec25t)?0:dec25, text = 'Dec25', textcolor =isExp(dec25t)?colorNone: color.red, style=isExp(dec25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(6+_historical), isExp(jul25t)?0:jul25, text = 'Jul25', textcolor =isExp(jul25t)?colorNone: color.red, style=isExp(jul25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(8+_historical), isExp(dec24t)?0:dec24, text = 'Dec24', textcolor =isExp(dec24t)?colorNone: color.red, style=isExp(dec24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(10+_historical), isExp(jul24t)?0:jul24, text = 'Jul24', textcolor = isExp(jul24t)?colorNone: color.red, style= isExp(jul24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(12+_historical), isExp(mar24t)?0:mar24, text = 'Mar24', textcolor = isExp(mar24t)?colorNone:color.red, style=isExp(mar24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(14+_historical), isExp(jan24t)?0:jan24, text = 'Jan24', textcolor = isExp(jan24t)?colorNone:color.red, style=isExp(jan24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(16+_historical), isExp(dec23t)?0:dec23, text = 'Dec23', textcolor = isExp(dec23t)?colorNone:color.red, style=isExp(dec23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(18+_historical), isExp(sept23t)?0:sept23, text = 'Sept23', textcolor =isExp(sept23t)?colorNone: color.red, style=isExp(sept23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(20+_historical), isExp(jul23t)?0:jul23, text = 'Jul23', textcolor =isExp(jul23t)?colorNone: color.red, style=isExp(jul23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(22+_historical), isExp(may23t)?0:may23, text = 'May23', textcolor =isExp(may23t)?colorNone: color.red, style=isExp(may23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(24+_historical), isExp(mar23t)?0:mar23, text = 'Mar23', textcolor =isExp(mar23t)?colorNone: color.red, style=isExp(mar23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(26+_historical), isExp(jan23t)?0:jan23, text = 'Jan23', textcolor =isExp(jan23t)?colorNone: color.red, style=isExp(jan23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(28+_historical), isExp(dec22t)?0:dec22, text = 'Dec22', textcolor =isExp(dec22t)?colorNone: color.red, style=isExp(dec22t)?label.style_none:label.style_diamond, size = size.tiny) //label.new(bar_index-(30+_historical), isExp(sept22t)?0:sept22, text = 'Sept22', textcolor =isExp(sept22t)?colorNone: color.red, style=isExp(sept22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(32+_historical), isExp(aug22t)?0:aug22, text = 'Aug22', textcolor =isExp(aug22t)?colorNone: color.red, style=isExp(aug22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(34+_historical), isExp(jul22t)?0:jul22, text = 'Jul22', textcolor =isExp(jul22t)?colorNone: color.red, style=isExp(jul22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(36+_historical), isExp(jun22t)?0:jun22, text = 'Jun22', textcolor =isExp(jun22t)?colorNone: color.red, style=isExp(jun22t)?label.style_none:label.style_diamond, size = size.tiny) //Copper plotting (37) if barstate.islast and syminfo.root == 'HG' label.new(bar_index-(_historical), close[_historical]+ 2*_adr, text = 'S\nN\nA\nP\nS\nH\nO\nT', textcolor = color.red, style=label.style_arrowdown, color= color.red, size = size.tiny) label.new(bar_index-(2+_historical), isExp(sept26t)?0:sept26 , text = 'Sept26', textcolor =isExp(sept26t)?colorNone: color.red, style=isExp(sept26t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(4+_historical), isExp(jul26t)?0:jul26, text = 'Jul26', textcolor =isExp(jul26t)?colorNone: color.red, style=isExp(jul26t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(6+_historical), isExp(may26t)?0:may26, text = 'May26', textcolor =isExp(may26t)?colorNone: color.red, style=isExp(may26t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(8+_historical), isExp(mar26t)?0:mar26, text = 'Mar26', textcolor =isExp(mar26t)?colorNone: color.red, style=isExp(mar26t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(10+_historical), isExp(dec25t)?0:dec25, text = 'Dec25', textcolor =isExp(dec25t)?colorNone: color.red, style=isExp(dec25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(12+_historical), isExp(sept25t)?0:sept25,text ='Sept25',textcolor =isExp(sept25t)?colorNone: color.red, style=isExp(sept25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(14+_historical), isExp(jul25t)?0:jul25, text = 'Jul25', textcolor =isExp(jul25t)?colorNone: color.red, style=isExp(jul25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(16+_historical), isExp(may25t)?0:may25, text = 'May25', textcolor =isExp(may25t)?colorNone: color.red, style=isExp(may25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(18+_historical), isExp(mar25t)?0:mar25, text = 'Mar25', textcolor =isExp(mar25t)?colorNone: color.red, style=isExp(mar25t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(20+_historical), isExp(dec24t)?0:dec24, text = 'Dec24', textcolor =isExp(dec24t)?colorNone: color.red, style=isExp(dec24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(22+_historical), isExp(sept24t)?0:sept24,text= 'Sept24',textcolor =isExp(sept24t)?colorNone: color.red, style=isExp(sept24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(24+_historical), isExp(jul24t)?0:jul24, text = 'Jul24', textcolor =isExp(jul24t)?colorNone: color.red, style=isExp(jul24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(26+_historical), isExp(may24t)?0:may24, text = 'May24', textcolor =isExp(may24t)?colorNone: color.red, style=isExp(may24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(28+_historical), isExp(apr24t)?0:apr24, text = 'Apr24', textcolor =isExp(apr24t)?colorNone: color.red, style=isExp(apr24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(30+_historical), isExp(mar24t)?0:mar24 ,text = 'Mar24', textcolor =isExp(mar24t)?colorNone: color.red, style=isExp(mar24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(32+_historical), isExp(feb24t)?0:feb24, text = 'Feb24', textcolor =isExp(feb24t)?colorNone: color.red, style=isExp(feb24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(34+_historical), isExp(jan24t)?0:jan24, text = 'Jan24', textcolor =isExp(jan24t)?colorNone: color.red, style=isExp(jan24t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(36+_historical), isExp(dec23t)?0:dec23, text = 'Dec23', textcolor =isExp(dec23t)?colorNone: color.red, style=isExp(dec23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(38+_historical), isExp(nov23t)?0:nov23, text = 'Nov23', textcolor =isExp(nov23t)?colorNone: color.red, style=isExp(nov23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(40+_historical), isExp(oct23t)?0:oct23, text = 'Oct23', textcolor =isExp(oct23t)?colorNone: color.red, style=isExp(oct23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(42+_historical), isExp(sept23t)?0:sept23,text= 'Sept23',textcolor =isExp(sept23t)?colorNone: color.red, style=isExp(sept23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(44+_historical), isExp(aug23t)?0:aug23, text = 'Aug23', textcolor =isExp(aug23t)?colorNone: color.red, style=isExp(aug23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(46+_historical), isExp(jul23t)?0:jul23, text = 'Jul23', textcolor =isExp(jul23t)?colorNone: color.red, style=isExp(jul23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(48+_historical), isExp(jun23t)?0:jun23, text = 'Jun23', textcolor =isExp(jun23t)?colorNone: color.red, style=isExp(jun23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(50+_historical), isExp(may23t)?0:may23, text = 'May23', textcolor =isExp(may23t)?colorNone: color.red, style=isExp(may23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(52+_historical), isExp(apr23t)?0:apr23, text = 'Apr23', textcolor =isExp(apr23t)?colorNone: color.red, style=isExp(apr23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(54+_historical), isExp(mar23t)?0:mar23, text = 'Mar23', textcolor =isExp(mar23t)?colorNone: color.red, style=isExp(mar23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(56+_historical), isExp(feb23t)?0:feb23, text = 'Feb23', textcolor =isExp(feb23t)?colorNone: color.red, style=isExp(feb23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(58+_historical), isExp(jan23t)?0:jan23, text = 'Jan23', textcolor =isExp(jan23t)?colorNone: color.red, style=isExp(jan23t)?label.style_none:label.style_diamond, size = size.tiny) label.new(bar_index-(60+_historical), isExp(dec22t)?0:dec22, text = 'Dec22', textcolor =isExp(dec22t)?colorNone: color.red, style=isExp(dec22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(62+_historical), isExp(nov22t)?0:nov22, text = 'Nov22', textcolor =isExp(nov22t)?colorNone: color.red, style=isExp(nov22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(64+_historical), isExp(oct22t)?0:oct22, text = 'Oct22', textcolor =isExp(oct22t)?colorNone: color.red, style=isExp(oct22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(66+_historical), isExp(sept22t)?0:sept22,text ='Sept22',textcolor =isExp(sept22t)?colorNone: color.red, style=isExp(sept22t)?label.style_none:label.style_diamond,size = size.tiny) // label.new(bar_index-(68+_historical), isExp(aug22t)?0:aug22, text = 'Aug22', textcolor =isExp(aug22t)?colorNone: color.red, style=isExp(aug22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(70+_historical), isExp(jul22t)?0:jul22, text = 'Jul22', textcolor =isExp(jul22t)?colorNone: color.red, style=isExp(jul22t)?label.style_none:label.style_diamond, size = size.tiny) // label.new(bar_index-(72+_historical), isExp(jan22t)?0:jun22, text = 'Jun22', textcolor =isExp(jan22t)?colorNone: color.red, style=isExp(jan22t)?label.style_none:label.style_diamond, size = size.tiny)
Zero Lag Detrended Price Oscillator (ZL DPO)
https://www.tradingview.com/script/wiVkjjnX-Zero-Lag-Detrended-Price-Oscillator-ZL-DPO/
mdenson
https://www.tradingview.com/u/mdenson/
121
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© mdenson //@version=5 //This code is a modified version of the ZLMA indicator by alexgrover and the Detrended Price Oscillator indicator('ZL DPO', overlay=false) //===================================================================================================================== //ZLMA //===================================================================================================================== length = 50 lag = 1.4 src = close a = 0. b = 0. a := nz(lag * src + (1 - lag) * b[length / 2] + a[1], src) b := ta.change(a, length) / length //===================================================================================================================== //DPO //===================================================================================================================== period_ = input.int(21, title="Length", minval=1) maperiod = input.int(5, title = "MA DPO Length", minval = 1) isCentered = input(true, title="Centered") barsback = period_/2 + 1 ma = ta.change(close, period_)/length dpo = isCentered ? close[barsback] - ma : close - ma[barsback] avg = ta.sma(dpo, maperiod) //===================================================================================================================== //Plots //===================================================================================================================== plot(dpo, offset = isCentered ? -barsback : 0, title="Zero Lag DPO", color=color.green,linewidth = 1) plot(avg, title = "MA of ZL DPO", color = color.red, linewidth =2)
Intra-variety Timeframe Floating Fibonacci Levels [Loxx]
https://www.tradingview.com/script/Nnp7e1Js-Intra-variety-Timeframe-Floating-Fibonacci-Levels-Loxx/
loxx
https://www.tradingview.com/u/loxx/
325
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public license 2.0 at https://mozilla.org/MPl/2.0/ // Β© loxx //@version=5 indicator("Intra-variety Timeframe Floating Fibonacci Levels [Loxx]", shorttitle = "IVTFFL [Loxx]", overlay = true, max_bars_back = 2000) greencolor = #2DD204 redcolor = #D2042D darkGreenColor = #1B7E02 darkRedColor = #93021F f_tickFormat() => _s = str.tostring(syminfo.mintick) _s := str.replace_all(_s, '25', '00') _s := str.replace_all(_s, '5', '0') _s := str.replace_all(_s, '1', '0') _s tfInMinutes(simple string tf = "") => float chartTf = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf) float chartTFInMinutes = tfInMinutes() sday = "Intraday" sweek = "Intraweek" smonth = "Intramonth" tfstyle = input.string(sday, "Higher Timeframe Style", options = [sday, sweek, smonth]) level1 = input.float(0.236, "Fibonacci Level 1", minval = 0.0, step = 0.01) level2 = input.float(0.382, "Fibonacci Level 2", minval = 0.0, step = 0.01) level3 = input.float(0.5, "Fibonacci Level 3", minval = 0.0, step = 0.01) level4 = input.float(0.618, "Fibonacci Level 4", minval = 0.0, step = 0.01) level5 = input.float(0.764, "Fibonacci Level 5", minval = 0.0, step = 0.01) if chartTFInMinutes > 60 and tfstyle == sday runtime.error("Error: Invalid timefame for Intradaily. You must select a timeframe less than or equal to 1 hour.") if chartTFInMinutes > 120 and tfstyle == sweek runtime.error("Error: Invalid timefame for Intraweekly. You must select a timeframe less than or equal to 2 hours.") if chartTFInMinutes > 240 and tfstyle == smonth runtime.error("Error: Invalid timefame for Intramonthly. You must select a timeframe less than or equal to 4 hours.") tf_in = tfstyle == sday ? "D" : tfstyle == sweek ? "W" : "M" daily_timestamp = request.security(syminfo.tickerid, tf_in, last_bar_time, barmerge.gaps_off, barmerge.lookahead_on) timeout = ta.barssince(time("") == daily_timestamp) timeout0 = timeout timeout := nz(timeout) timeout := timeout < 1 ? 1 : timeout H = ta.highest(high, timeout) L = ta.lowest(low, timeout) W = H-L Fib1 =H-(W*level1) Fib2 =H-(W*level2) Fib3 =H-(W*level3) Fib4 =H-(W*level4) Fib5 =H-(W*level5) rest = timeout0 > 0 plot(rest ? Fib1 : na, "Fibonacci Level 1", color = greencolor, linewidth = 1, style = plot.style_circles) plot(rest ? Fib2 : na, "Fibonacci Level 2", color = greencolor, linewidth = 1, style = plot.style_circles) mid = plot(rest ? Fib3 : na, "Fibonacci Level 3", color = color.white, linewidth = 1, style = plot.style_circles) plot(rest ? Fib4 : na, "Fibonacci Level 4", color = redcolor, linewidth = 1, style = plot.style_circles) plot(rest ? Fib5 : na, "Fibonacci Level 5", color = redcolor, linewidth = 1, style = plot.style_circles) hplot = plot(rest ? H : na,"Intraday High", color = greencolor, linewidth = 3, style = plot.style_stepline) lplot = plot(rest ? L : na,"Intraday Low", color = redcolor, linewidth = 3, style = plot.style_stepline) fill(mid, hplot, color.new(greencolor, 95)) fill(mid, lplot, color.new(redcolor, 95)) l1Bufferlabel = label.new(x=bar_index[1] + 5, y = Fib1, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= str.tostring(level1 * 100, "#.#") + "% " + str.tostring(Fib1, f_tickFormat()), size=size.normal, style=label.style_label_left) l2Bufferlabel = label.new(x=bar_index[1] + 5, y = Fib2, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= str.tostring(level2 * 100, "#.#") + "% " + str.tostring(Fib2, f_tickFormat()), size=size.normal, style=label.style_label_left) l3Bufferlabel = label.new(x=bar_index[1] + 5, y = Fib3, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= str.tostring(level3* 100, "#.#") + "% " + str.tostring(Fib1, f_tickFormat()), size=size.normal, style=label.style_label_left) l4Bufferlabel = label.new(x=bar_index[1] + 5, y = Fib4, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= str.tostring(level4 * 100, "#.#") + "% " + str.tostring(Fib4, f_tickFormat()), size=size.normal, style=label.style_label_left) l5Bufferlabel = label.new(x=bar_index[1] + 5, y = Fib5, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= str.tostring(level5 * 100, "#.#") + "% " + str.tostring(Fib5, f_tickFormat()), size=size.normal, style=label.style_label_left) highBufferlabel = label.new(x=bar_index[1] + 5, y = H, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "100% " + str.tostring(Fib2, f_tickFormat()), size=size.normal, style=label.style_label_left) lowBufferlabel = label.new(x=bar_index[1] + 5, y = L, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "0% " + str.tostring(Fib2, f_tickFormat()), size=size.normal, style=label.style_label_left) //delete label.delete(l1Bufferlabel[1]) label.delete(l2Bufferlabel[1]) label.delete(l3Bufferlabel[1]) label.delete(l4Bufferlabel[1]) label.delete(l5Bufferlabel[1]) label.delete(highBufferlabel[1]) label.delete(lowBufferlabel[1])
Waddah Attar Weekly Camarilla Pivots [Loxx]
https://www.tradingview.com/script/rZs49rdi-Waddah-Attar-Weekly-Camarilla-Pivots-Loxx/
loxx
https://www.tradingview.com/u/loxx/
206
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public license 2.0 at https://mozilla.org/MPl/2.0/ // Β© loxx //@version=5 indicator("Waddah Attar Weekly CAMARILLA Pivots [Loxx]", shorttitle = "WAWCP [Loxx]", overlay = true) greencolor = #2DD204 redcolor = #D2042D bluecolor = #042dd2 lightgreencolor = #96E881 lightredcolor = #DF4F6C lightbluecolor = #4f6cdf darkGreenColor = #1B7E02 darkRedColor = #93021F darkBlueColor = #021f93 f_tickFormat() => _s = str.tostring(syminfo.mintick) _s := str.replace_all(_s, '25', '00') _s := str.replace_all(_s, '5', '0') _s := str.replace_all(_s, '1', '0') _s tfInMinutes(simple string tf = "") => float chartTf = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf) float chartTFInMinutes = tfInMinutes() if chartTFInMinutes > 240 runtime.error("Error: Invalid timerame. This indicaator only works on timeframes 1 hour and below.") level1 = input.float(0.09, "Fibonacci Level 1", step = 0.01, minval = 0.0) level2 = input.float(0.18, "Fibonacci Level 2", step = 0.01, minval = 0.0) level3 = input.float(0.27, "Fibonacci Level 3", step = 0.01, minval = 0.0) level4 = input.float(0.55, "Fibonacci Level 4", step = 0.01, minval = 0.0) _close0 = request.security(syminfo.tickerid, "W", close, barmerge.gaps_off, barmerge.lookahead_on) _close1 = request.security(syminfo.tickerid, "W", close[1], barmerge.gaps_off, barmerge.lookahead_on) _close2 = request.security(syminfo.tickerid, "W", close[2], barmerge.gaps_off, barmerge.lookahead_on) _close3 = request.security(syminfo.tickerid, "W", close[3], barmerge.gaps_off, barmerge.lookahead_on) _open1 = request.security(syminfo.tickerid, "W", open[1], barmerge.gaps_off, barmerge.lookahead_on) _high1 = request.security(syminfo.tickerid, "W", high[1], barmerge.gaps_off, barmerge.lookahead_on) _low1 = request.security(syminfo.tickerid, "W", low[1], barmerge.gaps_off, barmerge.lookahead_on) int kRSIDayPeriod= 5 Q = _high1 - _low1 H1 = _close1 + (Q * level1) L1 = _close1 - (Q * level1) H2 = _close1 + (Q * level2) L2 = _close1 - (Q * level2) H3 = _close1 + (Q * level3) L3 = _close1 - (Q * level3) H4 = _close1 + (Q * level4) L4 = _close1 - (Q * level4) hlUp = plot(H1, color = greencolor, style = plot.style_stepline, linewidth = 2) llDn = plot(L1, color = redcolor, style = plot.style_stepline, linewidth = 2) plot(H2, color = greencolor, style = plot.style_stepline, linewidth = 2) plot(L2, color = redcolor, style = plot.style_stepline, linewidth = 2) plot(H3, color = greencolor, style = plot.style_stepline, linewidth = 2) plot(L3, color = redcolor, style = plot.style_stepline, linewidth = 2) upH = plot(H4, color = greencolor, style = plot.style_stepline, linewidth = 5) dnL = plot(L4, color = redcolor, style = plot.style_stepline, linewidth = 5) fill(hlUp, upH, color.new(greencolor, 95)) fill(dnL, llDn, color.new(redcolor, 95)) h1Bufferlabel = label.new(x=bar_index[1] + 5, y = H1, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "H1: " + str.tostring(H1, f_tickFormat()), size=size.normal, style=label.style_label_left) h2Bufferlabel = label.new(x=bar_index[1] + 5, y = H2, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "H2: " + str.tostring(H2, f_tickFormat()), size=size.normal, style=label.style_label_left) h3Bufferlabel = label.new(x=bar_index[1] + 5, y = H3, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "H3: " + str.tostring(H3, f_tickFormat()), size=size.normal, style=label.style_label_left) h4Bufferlabel = label.new(x=bar_index[1] + 5, y = H4, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "H4: " + str.tostring(H4, f_tickFormat()), size=size.normal, style=label.style_label_left) l1Bufferlabel = label.new(x=bar_index[1] + 5, y = L1, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "L1: " + str.tostring(L1, f_tickFormat()), size=size.normal, style=label.style_label_left) l2Bufferlabel = label.new(x=bar_index[1] + 5, y = L2, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "L2: " + str.tostring(L2, f_tickFormat()), size=size.normal, style=label.style_label_left) l3Bufferlabel = label.new(x=bar_index[1] + 5, y = L3, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "L3: " + str.tostring(L3, f_tickFormat()), size=size.normal, style=label.style_label_left) l4Bufferlabel = label.new(x=bar_index[1] + 5, y = L4, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "L4: " + str.tostring(L4, f_tickFormat()), size=size.normal, style=label.style_label_left) label.delete(h1Bufferlabel[1]) label.delete(h2Bufferlabel[1]) label.delete(h3Bufferlabel[1]) label.delete(h4Bufferlabel[1]) label.delete(l1Bufferlabel[1]) label.delete(l2Bufferlabel[1]) label.delete(l3Bufferlabel[1]) label.delete(l4Bufferlabel[1])
Multi-timeframe Moving Average with Summary Table
https://www.tradingview.com/script/7gQJUdWz-Multi-timeframe-Moving-Average-with-Summary-Table/
john_everist
https://www.tradingview.com/u/john_everist/
36
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© john_everist //@version=5 indicator("Multi-timeframe Moving Average with Summary Table", overlay = true) get_colour(ave_tr1, tolerance, price_close, ma, ma_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_flat_below)=> ave_tr = (ave_tr1/2)*tolerance a = 1-ma / ma_back b = 1-ma_back/ma compare = a<0?b: b<0?a: 1 if syminfo.ticker == "NZDJPY" or syminfo.ticker == "AUDJPY" or syminfo.ticker == "EURJPY" or syminfo.ticker == "CHFJPY" or syminfo.ticker == "GBPJPY" or syminfo.ticker == "CADJPY" or syminfo.ticker == "USDJPY" compare := compare * 100 color colour_text = col_text_flat color colour = col_flat //flat ma if compare<ave_tr if price_close > ma colour_text := col_text_flat_above else if price_close < ma colour_text := col_text_flat_below //ma up else if ma > ma_back colour := col_up_above if price_close < ma colour_text := col_down_below //ma down else if ma < ma_back colour := col_down_below if price_close > ma colour_text := col_up_above [colour, colour_text] make_sma_ema(type, length, tf) => sma = request.security(syminfo.tickerid, tf, ta.sma(close, length)) ema = request.security(syminfo.tickerid, tf, ta.ema(close, length)) ma = type == 'SMA' ? sma : ema ma draw_line(ma_value, line_colour, line_width, line_style,line_ex_type) => ex_line = line.new(x1=bar_index[0], x2=bar_index[1], y1=ma_value, y2=ma_value, style=line_style, color=line_colour, width=line_width, extend=line_ex_type) line.set_xloc(id=ex_line, x1=time, x2=time + 1, xloc=xloc.bar_time) line.delete(ex_line[1]) recalc = input.bool(false, "Recalc") john = recalc?1:0 var include_override = "Inclusion Overrides" show_ma_curr = input.bool(false, 'Show ONLY Current timeframe Moving Average', group=include_override) show_all_ma = input.bool(true, 'Show Moving average from ALL timeframes', group=include_override) show_hl_curr = input.bool(false, 'Show ONLY Current Moving Average horizontal line', group=include_override) show_all_hline = input.bool(true, "Show ALL ma horizontal lines", group=include_override) show_tables = input.bool(true, "Show the summary tables of the options selected below") var core = 'MA Specifications' ma_type = input.string(title='Moving Average Type', options=['EMA', 'SMA'], defval='SMA', group=core) ma_len = input.int(title='Moving Average Length', step=10, defval=20, group=core) bars_back = input.int(10, title = "Bars back to compare for trend", group=core, tooltip = "How many bars back to compare the current MA level to define a trend on the summary table ") tolerance = input.float(.4,title = "Tolerance to define 'flat' MA", step = .05, maxval = 100, group=core, tooltip = "A lower tolerance will require a steeper MA to show a trend on the summary table.\n\nWhether the MA is trending or not is defined by comparing the difference between the current level and level at the defined bars back against the average true range") var line_options = 'MA Line Inclusion' show_ma_3 = input.bool(title='Show 3M MA Line', defval=false, group=line_options) show_ma_15 = input.bool(title='Show 15M MA Line', defval=false, group=line_options) show_ma_60 = input.bool(title='Show 60M MA Line', defval=false, group=line_options) show_ma_240 = input.bool(title='Show 240M MA Line', defval=false, group=line_options) show_ma_D = input.bool(title='Show D MA Line', defval=false, group=line_options) show_ma_W = input.bool(title='Show W MA Line', defval=false, group=line_options) show_ma_M = input.bool(title='Show M MA Line', defval=false, group=line_options) var hor_line_options = 'Horizontal Line Inclusion' show_hl_3 = input.bool(title='Show 3M MA Line', defval=false, group=hor_line_options) show_hl_15 = input.bool(title='Show 15M MA Line', defval=false, group=hor_line_options) show_hl_60 = input.bool(title='Show 60M MA Line', defval=false, group=hor_line_options) show_hl_240 = input.bool(title='Show 240M MA Line', defval=false, group=hor_line_options) show_hl_D = input.bool(title='Show D MA Line', defval=false, group=hor_line_options) show_hl_W = input.bool(title='Show W MA Line', defval=false, group=hor_line_options) show_hl_M = input.bool(title='Show M MA Line', defval=false, group=hor_line_options) var table_options = 'MA Table Inclusion' show_ma_3_table = input.bool(title='Show 3M MA Table', defval=true, group=table_options) show_ma_15_table = input.bool(title='Show 15M MA Table', defval=true, group=table_options) show_ma_60_table = input.bool(title='Show 60M MA Table', defval=true, group=table_options) show_ma_240_table = input.bool(title='Show 240M MA Table', defval=true, group=table_options) show_ma_D_table = input.bool(title='Show D MA Table', defval=true, group=table_options) show_ma_W_table = input.bool(title='Show W MA Table', defval=false, group=table_options) show_ma_M_table = input.bool(title='Show M MA Table', defval=false, group=table_options) var table_format = "Table Format" color boarder_col = na color col_text_flat = input.color(color.new(#000000,0), title = "Text Colour", group = table_format) col_down_below1 = input.color(color.new(#FF0000, 0), title = "Colour for MA down", group = table_format) col_up_above1 = input.color(color.new(#00FF00, 0), title = "Colour for MA up", group = table_format) col_flat1 = input.color(color.gray, title = "Colour for MA when MA is 'flat'", group = table_format, tooltip = "The definition of a flat MA is controlled with the tolerance") var spacing_d = 'Table Shuffle Down' spacer_down_1 = input.bool(true, "Add Down Spacer", group = spacing_d, tooltip = "Use to move the table") spacer_down_2 = input.bool(false, "Add Down Spacer", group = spacing_d) spacer_down_3 = input.bool(false, "Add Down Spacer", group = spacing_d) spacer_down_4 = input.bool(false, "Add Down Spacer", group = spacing_d) var spacing_a = 'Table Shuffle Across' spacer_across_1 = input.bool(false, "Add Across Spacer", group = spacing_a) spacer_across_2 = input.bool(false, "Add Across Spacer", group = spacing_a) spacer_across_3 = input.bool(false, "Add Across Spacer", group = spacing_a) spacer_across_4 = input.bool(false, "Add Across Spacer", group = spacing_a) transp = input.int(30, title = "Summary Table Transparency", step = 5, group = table_format) cell_height = input.int(5, title = "Summary Table Cell Height", group = table_format) cell_width = input.int(3, title = "Summary Table Cell Width", group = table_format) col_down_below = color.new(col_down_below1, transp) col_up_above = color.new(col_up_above1, transp) col_flat = color.new(col_flat1, transp) color col_text_flat_above = col_up_above color col_text_below = col_down_below t_size_temp = input.string('normal', title='Text Size', options=['tiny', 'small', 'normal', 'large', 'huge'], group = table_format) t_size = t_size_temp == 'tiny' ? size.tiny : t_size_temp == 'small' ? size.small : t_size_temp == 'normal' ? size.normal : t_size_temp == 'large' ? size.large : t_size_temp == 'huge' ? size.huge : size.normal b_width = 0 h_align = text.align_center v_align = text.align_center show_ma_len = input.bool(false, "Show MA Length", group = table_format) var ma_line = 'MA Format' ma_color1 = input.color(title='Moving Average Colour', defval=color.new(color.yellow, 50), group=ma_line) ma_transp = input.int(50, title = "Moving Average Transparency", step = 5, group = ma_line) ma_color = color.new(ma_color1, ma_transp) ma_width = input.int(title='Moving Average Width', defval=1, step = 1, group=ma_line) line_width = input.int(title='MA Line Width', defval=1, group=ma_line) var ma_ex_line = 'Horizontal Line Format' line_style_temp = input.string("dashed", title='Horizontsal line style', options=['solid', 'dashed', 'dotted'], group=ma_ex_line) line_style = line_style_temp == 'solid' ? line.style_solid : line_style_temp == 'dashed' ? line.style_dashed : line_style_temp == 'dotted' ? line.style_dotted : na line_ex_type_temp= input.string("Both", title = "MA line extention type", options = ["Left", "Right", "Both"], group=ma_ex_line) line_ex_type =line_ex_type_temp == "Left" ? extend.left : line_ex_type_temp == "Right" ? extend.right : line_ex_type_temp == "Both" ? extend.both :extend.none ex_line_width = input.int(title='horizontal line Width', defval=1, step = 1, group=ma_ex_line) var label = 'labels' show_ma_lab = input.bool(title='Show Moving Average Labels', defval=true, group=label) lab_descrip = input.bool(false, title = "Include Description on label") lab_size_ma_temp = input.string('small', title='Moving Average Label Size', options=['tiny', 'small', 'normal', 'large', 'huge'], group=label) lab_size_ma = lab_size_ma_temp == 'tiny' ? size.tiny : lab_size_ma_temp == 'small' ? size.small : lab_size_ma_temp == 'normal' ? size.normal : lab_size_ma_temp == 'large' ? size.large : lab_size_ma_temp == 'huge' ? size.huge : size.normal text_shift = input.int(0, title='Label Distance from MA', group=label, tooltip = "Increase the distance of the label from the MA", step = 1) var check = 'Check trend definition' check_trend = input.bool(false, "Check trend definition", group = check, tooltip = "This will highlight the background based on the trend definition of the current timeframe. Its clearest if you high the bars and only show the ma") ave_tr_length = 20 [close_3, sma_3, sma_3_back, ema_3, ema_3_back, atr_3] = request.security("","3", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) [close_15, sma_15, sma_15_back, ema_15, ema_15_back, atr_15] = request.security("","15", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) [close_60, sma_60, sma_60_back, ema_60, ema_60_back, atr_60] = request.security("","60", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) [close_240, sma_240, sma_240_back, ema_240, ema_240_back, atr_240] = request.security("","240", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) [close_D, sma_D, sma_D_back, ema_D, ema_D_back, atr_D] = request.security("","D", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) [close_W, sma_W, sma_W_back, ema_W, ema_W_back, atr_W] = request.security("","W", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) [close_M, sma_M, sma_M_back, ema_M, ema_M_back, atr_M] = request.security("","M", [close, ta.sma(close, ma_len), ta.sma(close[bars_back], ma_len), ta.ema(close, ma_len), ta.ema(close[bars_back], ma_len), ta.sma(ta.tr(true), ave_tr_length)]) ma_3 = ma_type == "SMA" ? sma_3 : ema_3 ma_15 = ma_type == "SMA" ? sma_15 : ema_15 ma_60 = ma_type == "SMA" ? sma_60 : ema_60 ma_240 = ma_type == "SMA" ? sma_240 : ema_240 ma_D = ma_type == "SMA" ? sma_D : ema_D ma_W = ma_type == "SMA" ? sma_W : ema_W ma_M = ma_type == "SMA" ? sma_M : ema_M ma_3_back = ma_type == "SMA" ? sma_3_back : ema_3_back ma_15_back = ma_type == "SMA" ? sma_15_back : ema_15_back ma_60_back = ma_type == "SMA" ? sma_60_back : ema_60_back ma_240_back = ma_type == "SMA" ? sma_240_back : ema_240_back ma_D_back = ma_type == "SMA" ? sma_D_back : ema_D_back ma_W_back = ma_type == "SMA" ? sma_W_back : ema_W_back ma_M_back = ma_type == "SMA" ? sma_M_back : ema_M_back [ma_3_col, ma_3_col_text] = get_colour(atr_3, tolerance, close_3, ma_3, ma_3_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) [ma_15_col, ma_15_col_text] = get_colour(atr_15, tolerance, close_15, ma_15, ma_15_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) [ma_60_col, ma_60_col_text] = get_colour(atr_60, tolerance, close_60, ma_60, ma_60_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) [ma_240_col, ma_240_col_text] = get_colour(atr_240, tolerance, close_240, ma_240, ma_240_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) [ma_D_col, ma_D_col_text] = get_colour(atr_D, tolerance, close_D, ma_D, ma_D_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) [ma_W_col, ma_W_col_text] = get_colour(atr_W, tolerance, close_W, ma_W, ma_W_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) [ma_M_col, ma_M_col_text] = get_colour(atr_M, tolerance, close_M, ma_M, ma_M_back, col_up_above,col_down_below,col_flat, col_text_flat, col_text_flat_above, col_text_below) color curr_colour = na if not show_tables show_ma_3_table := false show_ma_15_table := false show_ma_60_table := false show_ma_240_table := false show_ma_D_table := false show_ma_W_table := false show_ma_M_table := false if check_trend show_ma_curr := true show_ma_3_table := false show_ma_15_table := false show_ma_60_table := false show_ma_240_table := false show_ma_D_table := false show_ma_W_table := false show_ma_M_table := true if show_all_ma show_ma_3 := true show_ma_15 := true show_ma_60 := true show_ma_240 := true show_ma_D := true show_ma_W := true show_ma_M := true if show_all_hline show_hl_3 := true show_hl_15 := true show_hl_60 := true show_hl_240 := true show_hl_D := true show_hl_W := true show_hl_M := true ///------ if show_ma_curr show_ma_3 := false show_ma_15 := false show_ma_60 := false show_ma_240 := false show_ma_D := false show_ma_W := false show_ma_M := false if timeframe.multiplier == 3 show_ma_3 := true curr_colour := ma_3_col if timeframe.multiplier == 15 show_ma_15 := true curr_colour := ma_15_col if timeframe.multiplier == 60 show_ma_60 := true curr_colour := ma_60_col if timeframe.multiplier == 240 show_ma_240 := true curr_colour := ma_240_col if timeframe.isdaily show_ma_D := true if timeframe.isweekly show_ma_W := true curr_colour := ma_W_col if timeframe.ismonthly show_ma_M := true curr_colour := ma_M_col if show_hl_curr show_hl_3 := false show_hl_15 := false show_hl_60 := false show_hl_240 := false show_hl_D := false show_hl_W := false show_hl_M := false if timeframe.multiplier == 3 show_hl_3 := true if timeframe.multiplier == 15 show_hl_15 := true if timeframe.multiplier == 60 show_hl_60 := true if timeframe.multiplier == 240 show_hl_240 := true if timeframe.isdaily show_hl_D := true if timeframe.isweekly show_hl_W := true if timeframe.ismonthly show_hl_M := true bgcolor(check_trend?color.new(curr_colour, 85):na) ma_table = table.new(position = position.top_left, columns = 5, rows = 11, bgcolor = na, border_color = boarder_col, border_width = 1) int across = 0 int down = 0 if spacer_down_1 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") down+=1 if spacer_down_2 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") down+=1 if spacer_down_3 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") down+=1 if spacer_down_4 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") down+=1 if spacer_across_1 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") across+=1 if spacer_across_2 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") across+=1 if spacer_across_3 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") across+=1 if spacer_across_4 table.cell(table_id = ma_table, height = cell_height, width = cell_width, column = across, row = down, bgcolor = na, text = "") across+=1 if show_ma_len table.cell(table_id = ma_table, text_color = col_text_flat, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = na, text = str.tostring(ma_len), text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_3_table if timeframe.isintraday and timeframe.multiplier<=3 table.cell(table_id = ma_table, text_color = ma_3_col_text, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = ma_3_col, text = "3", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_15_table if timeframe.isintraday and timeframe.multiplier<=15 table.cell(table_id = ma_table, text_color = ma_15_col_text, height = cell_height, width = cell_width,column = across+0, row = down+0, bgcolor = ma_15_col, text = "15", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_60_table if timeframe.isintraday and timeframe.multiplier<=60 table.cell(table_id = ma_table, text_color = ma_60_col_text, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = ma_60_col, text = "1H", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_240_table if timeframe.isintraday and timeframe.multiplier<=240 table.cell(table_id = ma_table, text_color = ma_240_col_text, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = ma_240_col, text = "4H", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_D_table if not timeframe.isweekly and not timeframe.ismonthly table.cell(table_id = ma_table, text_color = ma_D_col_text, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = ma_D_col, text = "D", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_W_table if not timeframe.ismonthly table.cell(table_id = ma_table, text_color = ma_W_col_text, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = ma_W_col, text = "W", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 if show_ma_M_table table.cell(table_id = ma_table, text_color = ma_M_col_text, height = cell_height, width = cell_width, column = across+0, row = down+0, bgcolor = ma_M_col, text = "M", text_halign = h_align, text_valign = v_align, text_size = t_size) down+=1 //================================== bool show_lab_3 = false bool show_lab_15 = false bool show_lab_60 = false bool show_lab_240 = false bool show_lab_D = false bool show_lab_W = false bool show_lab_M = false if show_ma_3 if timeframe.isintraday and timeframe.multiplier<=3 show_lab_3 := true if show_ma_15 if timeframe.isintraday and timeframe.multiplier<=15 show_lab_15 := true if show_ma_60 if timeframe.isintraday and timeframe.multiplier<=60 show_lab_60 := true if show_ma_240 if timeframe.isintraday and timeframe.multiplier<=240 show_lab_240 := true if show_ma_D if not timeframe.isweekly and not timeframe.ismonthly show_lab_D := true if show_ma_W if not timeframe.ismonthly show_lab_W := true if show_ma_M show_lab_M := true if show_hl_3 draw_line(ma_3, ma_color, ex_line_width, line_style, line_ex_type) show_lab_3:=true if show_hl_15 draw_line(ma_15, ma_color, ex_line_width, line_style, line_ex_type) show_lab_15:=true if show_hl_60 draw_line(ma_60, ma_color, ex_line_width, line_style, line_ex_type) show_lab_60:=true if show_hl_240 draw_line(ma_240, ma_color, ex_line_width, line_style, line_ex_type) show_lab_240:=true if show_hl_D draw_line(ma_D, ma_color, ex_line_width, line_style, line_ex_type) show_lab_D:=true if show_hl_W draw_line(ma_W, ma_color, ex_line_width, line_style, line_ex_type) show_lab_W:=true if show_hl_M draw_line(ma_M, ma_color, ex_line_width, line_style, line_ex_type) show_lab_M:=true if show_ma_lab invisible = color.new(color.gray, 100) lab_style = label.style_label_left label lab_ma_3 = na label lab_ma_15 = na label lab_ma_60 = na label lab_ma_240 = na label lab_ma_D = na label lab_ma_W = na label lab_ma_M = na if lab_descrip lab_ma_3 := label.new(bar_index + text_shift, ma_3, text= '3 ('+ str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_3 ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_15 := label.new(bar_index + text_shift, ma_15, text= '15 ('+ str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_15 ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_60 := label.new(bar_index + text_shift, ma_60, text= '60 ('+ str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_60 ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_240 := label.new(bar_index + text_shift, ma_240, text= '240 ('+ str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_240 ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_D := label.new(bar_index + text_shift, ma_D, text= 'D ('+ str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_D ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_W := label.new(bar_index + text_shift, ma_W, text= "W ("+str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_W ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_M := label.new(bar_index + text_shift, ma_M, text= 'M ('+ str.tostring(ma_len) + " "+ ma_type +")", textcolor=show_lab_M ? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) else lab_ma_3 := label.new(bar_index + text_shift, ma_3, text= "3", textcolor= show_lab_3? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_15 := label.new(bar_index + text_shift, ma_15, text= "15", textcolor= show_lab_15? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_60 := label.new(bar_index + text_shift, ma_60, text= "60", textcolor= show_lab_60? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_240 := label.new(bar_index + text_shift, ma_240, text= "240", textcolor= show_lab_240? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_D := label.new(bar_index + text_shift, ma_D, text= "D", textcolor= show_lab_D? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_W := label.new(bar_index + text_shift, ma_W, text= "W", textcolor= show_lab_W? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) lab_ma_M := label.new(bar_index + text_shift, ma_M, text= "M", textcolor= show_lab_M? ma_color : invisible, color=invisible, style=lab_style, size=lab_size_ma) label.delete(lab_ma_3[1]) label.delete(lab_ma_15[1]) label.delete(lab_ma_60[1]) label.delete(lab_ma_240[1]) label.delete(lab_ma_D[1]) label.delete(lab_ma_W[1]) label.delete(lab_ma_M[1]) //plot(ma_curr, title='current', color=ma_color, linewidth=ma_width) plot(ma_3, title='3', color=show_ma_3?ma_color:na, linewidth=ma_width) plot(ma_15, title='15', color=show_ma_15?ma_color:na, linewidth=ma_width) plot(ma_60, title='60', color=show_ma_60?ma_color:na, linewidth=ma_width) plot(ma_240, title='240', color=show_ma_240?ma_color:na, linewidth=ma_width) plot(ma_D, title='d', color=show_ma_D?ma_color:na, linewidth=ma_width) plot(ma_W, title='w', color=show_ma_W?ma_color:na, linewidth=ma_width) plot(ma_M, title='m', color=show_ma_M?ma_color:na, linewidth=ma_width)
Waddah Attar RSI Levels [Loxx]
https://www.tradingview.com/script/SrR5aMD2-Waddah-Attar-RSI-Levels-Loxx/
loxx
https://www.tradingview.com/u/loxx/
227
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public license 2.0 at https://mozilla.org/MPl/2.0/ // Β© loxx //@version=5 indicator("Waddah Attar RSI levels [Loxx]", shorttitle = "WARSIlVlS [Loxx]", overlay = true) greencolor = #2DD204 redcolor = #D2042D bluecolor = #042dd2 lightgreencolor = #96E881 lightredcolor = #DF4F6C lightbluecolor = #4f6cdf darkGreenColor = #1B7E02 darkRedColor = #93021F darkBlueColor = #021f93 _wilders_rsi(x, y) => res = ta.rsi(x, y) res _rapid_rsi(src, len)=> upSum = math.sum(math.max(ta.change(src), 0), len) dnSum = math.sum(math.max(-ta.change(src), 0), len) rrsi = dnSum == 0 ? 100 : upSum == 0 ? 0 : 100 - 100 / (1 + upSum / dnSum) rrsi f_tickFormat() => _s = str.tostring(syminfo.mintick) _s := str.replace_all(_s, '25', '00') _s := str.replace_all(_s, '5', '0') _s := str.replace_all(_s, '1', '0') _s tfInMinutes(simple string tf = "") => float chartTf = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf) float chartTFInMinutes = tfInMinutes() if chartTFInMinutes > 60 runtime.error("Error: Invalid timerame. This indicaator only works on timeframes 1 hour and below.") rsiType = input.string("Wilders", "RSI Type", options =["Wilders", "Rapid"], group = "Basic Settings") _close0 = request.security(syminfo.tickerid, "D", close, barmerge.gaps_off, barmerge.lookahead_on) _close1 = request.security(syminfo.tickerid, "D", close[1], barmerge.gaps_off, barmerge.lookahead_on) _close2 = request.security(syminfo.tickerid, "D", close[2], barmerge.gaps_off, barmerge.lookahead_on) _close3 = request.security(syminfo.tickerid, "D", close[3], barmerge.gaps_off, barmerge.lookahead_on) _open1 = request.security(syminfo.tickerid, "D", open[1], barmerge.gaps_off, barmerge.lookahead_on) _high1 = request.security(syminfo.tickerid, "D", high[1], barmerge.gaps_off, barmerge.lookahead_on) _low1 = request.security(syminfo.tickerid, "D", low[1], barmerge.gaps_off, barmerge.lookahead_on) int kRSIDayPeriod= 5 wrsi0 = request.security(syminfo.tickerid, "D", _wilders_rsi(close, kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) wrsi1 = request.security(syminfo.tickerid, "D", _wilders_rsi(close[1], kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) wrsi2 = request.security(syminfo.tickerid, "D", _wilders_rsi(close[2], kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) wrsi3 = request.security(syminfo.tickerid, "D", _wilders_rsi(close[3], kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) raprsi0 = request.security(syminfo.tickerid, "D", _rapid_rsi(close, kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) raprsi1 = request.security(syminfo.tickerid, "D", _rapid_rsi(close[1], kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) raprsi2 = request.security(syminfo.tickerid, "D", _rapid_rsi(close[2], kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) raprsi3 = request.security(syminfo.tickerid, "D", _rapid_rsi(close[3], kRSIDayPeriod), barmerge.gaps_off, barmerge.lookahead_on) rsi0 = rsiType == "Wilders" ? wrsi0 : raprsi0 rsi1 = rsiType == "Wilders" ? wrsi1 : raprsi1 rsi2 = rsiType == "Wilders" ? wrsi2 : raprsi2 rsi3 = rsiType == "Wilders" ? wrsi3 : raprsi3 c1 = nz(_close1) c2 = nz(_close2) drsi = rsi1 - rsi2 trsi = rsi3 if(drsi == 0) rsi2 := trsi drsi := rsi1 - rsi2 if(drsi == 0) drsi := rsi1 dc = c1 - c2 if(dc == 0) c2 := nz(_close3) dc := c1 - c2 if(dc == 0) dc := c1 l10 = (((10 - rsi1) * dc) / drsi) + c1 lvl10Buffer = l10 l20 = (((20 - rsi1) * dc) / drsi) + c1 lvl20Buffer = l20 l30 = (((30 - rsi1) * dc) / drsi) + c1 lvl30Buffer = l30 l40 = (((40 - rsi1) * dc) / drsi) + c1 lvl40Buffer = l40 l50 = (((50 - rsi1) * dc) / drsi) + c1 lvl50Buffer = l50 l60 = (((60 - rsi1) * dc) / drsi) + c1 lvl60Buffer = l60 l70 = (((70 - rsi1) * dc) / drsi) + c1 lvl70Buffer = l70 l80 = (((80 - rsi1) * dc) / drsi) + c1 lvl80Buffer = l80 l90 = (((90 - rsi1) * dc) / drsi) + c1 lvl90Buffer = l90 dn = plot(lvl10Buffer, "RSI level 10", color = redcolor, style = plot.style_stepline, linewidth = 4) plot(lvl20Buffer, "RSI level 20", color = redcolor, style = plot.style_stepline, linewidth = 1) plot(lvl30Buffer, "RSI level 30", color = redcolor, style = plot.style_stepline, linewidth = 1) plot(lvl40Buffer, "RSI level 40", color = redcolor, style = plot.style_stepline, linewidth = 1) mid = plot(lvl50Buffer, "RSI level 50", color = color.white, style = plot.style_stepline, linewidth = 2) plot(lvl60Buffer, "RSI level 60", color = greencolor, style = plot.style_stepline, linewidth = 1) plot(lvl70Buffer, "RSI level 70", color = greencolor, style = plot.style_stepline, linewidth = 1) plot(lvl80Buffer, "RSI level 80", color = greencolor, style = plot.style_stepline, linewidth = 1) up = plot(lvl90Buffer, "RSI level 90", color = greencolor, style = plot.style_stepline, linewidth = 4) fill(dn, mid, title = "Fill down", color = color.new(redcolor, 90)) fill(up, mid, title = "Fill top", color = color.new(greencolor, 90)) l10Bufferlabel = label.new(x=bar_index[1] + 5, y = l10, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "RSI 10: " + str.tostring(l10, f_tickFormat()), size=size.normal, style=label.style_label_left) l20Bufferlabel = label.new(x=bar_index[1] + 5, y = l20, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "RSI 20: " + str.tostring(l20, f_tickFormat()), size=size.normal, style=label.style_label_left) l30Bufferlabel = label.new(x=bar_index[1] + 5, y = l30, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "RSI 30: " + str.tostring(l30, f_tickFormat()), size=size.normal, style=label.style_label_left) l40Bufferlabel = label.new(x=bar_index[1] + 5, y = l40, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= "RSI 40: " + str.tostring(l40, f_tickFormat()), size=size.normal, style=label.style_label_left) l50Bufferlabel = label.new(x=bar_index[1] + 5, y = l50, textalign = text.align_center, color = color.gray, textcolor = color.white, text= "RSI 50: " + str.tostring(l50, f_tickFormat()), size=size.normal, style=label.style_label_left) l60Bufferlabel = label.new(x=bar_index[1] + 5, y = l60, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "RSI 60: " + str.tostring(l60, f_tickFormat()), size=size.normal, style=label.style_label_left) l70Bufferlabel = label.new(x=bar_index[1] + 5, y = l70, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "RSI 70: " + str.tostring(l70, f_tickFormat()), size=size.normal, style=label.style_label_left) l80Bufferlabel = label.new(x=bar_index[1] + 5, y = l80, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "RSI 80: " + str.tostring(l80, f_tickFormat()), size=size.normal, style=label.style_label_left) l90Bufferlabel = label.new(x=bar_index[1] + 5, y = l90, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= "RSI 90: " + str.tostring(l90, f_tickFormat()), size=size.normal, style=label.style_label_left) label.delete(l10Bufferlabel[1]) label.delete(l20Bufferlabel[1]) label.delete(l30Bufferlabel[1]) label.delete(l40Bufferlabel[1]) label.delete(l50Bufferlabel[1]) label.delete(l60Bufferlabel[1]) label.delete(l70Bufferlabel[1]) label.delete(l80Bufferlabel[1]) label.delete(l90Bufferlabel[1])
MM SIGMA STC+ADX
https://www.tradingview.com/script/bbOCky7B-MM-SIGMA-STC-ADX/
MoneyMovesInvestments
https://www.tradingview.com/u/MoneyMovesInvestments/
440
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© thealgorithmictrader //@version=5 indicator("MM SIGMA STC+ADX") var user_consensus = input.string(defval="", title="TYPE 'agree' TO ADD TO CHART. \nTrading involves a risk of loss, and may not be appropriate for every one. Please consider carefully if trading is appropriate for you. Past performance is not indicative of future results. Any and all indicator signals provided by 'MM SIGMA STC+ADX' are for educational purposes only. Is your responsibility knowing that by typing 'agree' you are accepting that the AI would trade on your behalf at your own risk. \nRELEASE INFORMATION 2021 Β© Money Moves Investments", confirm = true, group="consensus") var icc = false if user_consensus == "agree" icc := true else icc := false var label lbl_agree_err = na if not icc label.delete(lbl_agree_err) lbl_agree_err := label.new(bar_index + 5, close, color = color.red, style=label.style_label_left, textcolor = color.white, text="Type 'agree' first in order to show the algo!") //MM SIGMA ALGO OSC //{ g_sigma = "MM SIGMA ALGO OSC Stricts" stc_entry = input.bool(true, "Entries", group = g_sigma, inline = "gen0") stc_exits = input.bool(true, "Exits <- STC", group = g_sigma, inline = "gen0") dmi_entry = input.bool(false, "Entries", group = g_sigma, inline = "gen1") dmi_exits = input.bool(false, "Exits <- DMI", group = g_sigma, inline = "gen1") dmi_entry_lev = input.string("TOP", "DMI Levels", group = g_sigma, options=["TOP","BOTTOM"], inline = "gen2") dmi_entry_lev1 = input.float(20.0, "1", group = g_sigma, inline = "gen2") dmi_entry_lev2 = input.float(25.0, "2", group = g_sigma, inline = "gen2") //} //STC //{ g_stc = "STC SETTINGS" show_stc= input.bool(true, "Show STC", group = g_stc) fastLength = input.int(title="STC: Fast Length", defval=23,inline="stc0", group = g_stc) slowLength = input.int(title="Slow Length", defval=50,inline="stc0", group = g_stc) cycleLength = input.int(title="Cycle Length", defval=10, group = g_stc) d1Length = input.int(title="1st %D Length", defval=3, group = g_stc) d2Length = input.int(title="2nd %D Length", defval=3, group = g_stc) src = input.source(title="Source", defval=close, group = g_stc) upper = input.int(title="Thresholds: Upper", defval=70, group = g_stc) lower = input.int(title="Lower", defval=30, group = g_stc) highlightBreakouts = input.bool(title="Highlight Breakouts ?", defval=true, group = g_stc) macd = ta.ema(src, fastLength) - ta.ema(src, slowLength) k = nz(fixnan(ta.stoch(macd, macd, macd, cycleLength))) d = ta.ema(k, d1Length) kd = nz(fixnan(ta.stoch(d, d, d, cycleLength))) stc = ta.ema(kd, d2Length) stc := math.max(math.min(stc, 100), 0) stcColor1 = stc > stc[1] ? color.new(#7edbca,0) : color.new(#dd64db,0) stcColor2 = stc > upper ? color.new(#7edbca,0) : stc <= lower ? color.new(#dd64db,0) : color.gray stcColor = highlightBreakouts ? stcColor2 : stcColor1 stcPlot = plot(icc?stc:na, title="STC", color=stcColor, transp=0) upperLevel = plot(upper, title="Upper", color=color.gray) hline(50.0, title="Middle", linestyle=hline.style_dotted) lowerLevel = plot(lower, title="Lower", color=color.gray) fill(upperLevel, lowerLevel, title="Middle Zone", color=color.gray, transp=90) upperFillColor = stc > upper and highlightBreakouts ? color.new(#7edbca,70) : na lowerFillColor = stc < lower and highlightBreakouts ? color.new(#dd64db,70) : na fill(upperLevel, stcPlot, color=upperFillColor, transp=80) fill(lowerLevel, stcPlot, color=lowerFillColor, transp=80) buySignal = ta.crossover(stc, lower) sellSignal = ta.crossunder(stc, upper) upperCrossover = ta.crossover(stc, upper) upperCrossunder= ta.crossunder(stc, upper) lowerCrossover = ta.crossover(stc, lower) lowerCrossunder= ta.crossunder(stc, lower) plotshape(icc and upperCrossunder ? upper : na, title="Sell Signal", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(#dd64db,0), transp=0) plotshape(icc and lowerCrossover ? lower : na, title="Buy Signal", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(#7edbca,0), transp=0) //} //DMI+EMA //{ g_dmi = "DMI + EMA SETTINGS" show_dmi= input.bool(true, "Show DMI", group = g_dmi) lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50, group=g_dmi) len = input.int(14, minval=1, title="DI Length", group=g_dmi) show_dmi_ema= input.bool(true, "Show DMI EMA", group = g_dmi) __len = input.int(9, minval=1, title="DMI EMA Length", group=g_dmi) offset = input.int(title="Offset", defval=0, minval=-500, maxval=500, group=g_dmi) typeMA = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group=g_dmi) up = ta.change(high) down = -ta.change(low) plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) trur = ta.rma(ta.tr, len) plus = fixnan(100 * ta.rma(plusDM, len) / trur) minus = fixnan(100 * ta.rma(minusDM, len) / trur) sum = plus + minus adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig) plot(icc and show_dmi?adx:na, color=#F50057, title="ADX") hline(dmi_entry_lev1,"DMI Level 1",color.new(#F50057,70),linestyle=hline.style_solid, linewidth=2) hline(dmi_entry_lev2,"DMI Level 2",color.new(#F50057,70),linestyle=hline.style_solid, linewidth=2) //plot(plus, color=#2962FF, title="+DI") //plot(minus, color=#FF6D00, title="-DI") ma(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) out = ma(adx, __len,typeMA) plot(icc?out:na, title="DMI EMA", color=color.yellow, offset=offset) lev_to_trigger = dmi_entry_lev=="TOP"? (dmi_entry_lev1>dmi_entry_lev2?dmi_entry_lev1:dmi_entry_lev2) : (dmi_entry_lev1>dmi_entry_lev2?dmi_entry_lev2:dmi_entry_lev1) //} //STRICTS DISPLAY //{ var string entry = "" var bool exit = false if stc_entry and entry == "" entry := lowerCrossover?"LONG":upperCrossunder?"SHORT":"" if dmi_entry and entry=="LONG" entry := adx>=lev_to_trigger?"LONG":"" if dmi_entry and entry=="SHORT" entry := adx>=lev_to_trigger?"SHORT":"" if entry == "LONG" or entry == "SHORT" if stc_exits exit := entry == "LONG"?upperCrossunder:entry == "SHORT"?lowerCrossover:false if dmi_exits exit:=adx<=out if exit entry:="" plotshape(icc and lowerCrossover and entry=="LONG" and entry[1] == ""?lower : na , title = "LONG", style = shape.triangleup, location = location.bottom, text = "BUY", textcolor = color.white, color=color.new(#7edbca,0), size=size.small) plotshape(icc and upperCrossunder and entry=="SHORT" and entry[1] == ""?upper : na , title = "SHORT", style = shape.triangledown, location = location.top, text = "SELL", textcolor = color.white, color=color.new(#dd64db,0), size=size.small) plotshape(icc and exit and entry[1]=="LONG", title = "EXIT LONG", style = shape.triangledown, location = location.top, text = "EXIT LONG", textcolor = color.white, color=color.new(#7edbca,0), size=size.small) plotshape(icc and exit and entry[1]=="SHORT", title = "EXIT SHORT", style = shape.triangleup, location = location.bottom, text = "EXIT SHORT", textcolor = color.white, color=color.new(#7edbca,0), size=size.small) //}
% up/down from SMA Alerts
https://www.tradingview.com/script/LzjPvTIF/
Phoo222
https://www.tradingview.com/u/Phoo222/
17
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Phoo222 //@version=5 indicator(title="% up/down from SMA Alerts", shorttitle="% Alert", overlay=true, timeframe="") //SMA inputs len = input.int(20, minval=1, title="Length") src = input(close, title="Source") offset = input.int(title="Offset", defval=0) SMA = ta.sma(src, len) perAway = input.int(10, "% value", minval=1, maxval=300) plot(SMA, title="SMA", offset=offset) PercentInc = SMA + (SMA * perAway / 100) PercentDec = SMA - (SMA * perAway / 100) plot(PercentInc, title="% Up line") plot(PercentDec, title="% Down Line") //if current price increase x% from SMA then Alert trigger alertcondition(close >= PercentInc, title='% up SMA', message='% up from SMA') //if current price decrease x% from SMA then Alert trigger alertcondition(close <= PercentDec, title='% down SMA', message='% down from SMA')
Jurik-Filtered, Adaptive Laguerre PPO [Loxx]
https://www.tradingview.com/script/SlvAwQYR-Jurik-Filtered-Adaptive-Laguerre-PPO-Loxx/
loxx
https://www.tradingview.com/u/loxx/
117
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator(title = 'Jurik-Filtered, Adaptive Laguerre PPO [Loxx]', shorttitle = "JFALPPO [Loxx]", timeframe="", overlay = false, timeframe_gaps=true, max_bars_back = 5000) import loxx/loxxjuriktools/1 as jt greencolor = #2DD204 redcolor = #D2042D bluecolor = #042dd2 lightgreencolor = #96E881 lightredcolor = #DF4F6C _lagfilt(src, gam) => L0 = 0.0, L1 = 0.0, L2 = 0.0, L3 = 0.0 L0 := (1 - gam) * src + gam * nz(L0[1]) L1 := -gam * L0 + nz(L0[1]) + gam * nz(L1[1]) L2 := -gam * L1 + nz(L1[1]) + gam * nz(L2[1]) L3 := -gam * L2 + nz(L2[1]) + gam * nz(L3[1]) out = (L0 + 2 * L1 + 2 * L2 + L3) / 6 out src = input.source(title='Source', defval=hl2, group = "Basic Settings") lookBack = input.int(200, "Period", group = "Basic Settings") gamFast = input.float(0.4, "Gamma Fast", step = 0.01, group = "Basic Settings") gamSlow = input.float(0.8, "Gamm Slow", step = 0.01, group = "Basic Settings") fphs = input.int(-100, title= "Fast Jurik Phase", group = "Jurik Settings") sphs = input.int(0, title= "Slow Jurik Phase", group = "Jurik Settings") fast = input.int(7, "Fast Jurik Period", group = "Jurik Settings") slow = input.int(40, "Slow Jurik Period", group = "Jurik Settings") percent1 = input.float(80, "Percent 1", group = "Levels Settings") percent2 = input.float(90, "Percent 2", group = "Levels Settings") colorbars = input.bool(true, "Color bars?", group = "UI Options") lmas = _lagfilt(src, gamFast) lmal = _lagfilt(src, gamSlow) lmas := jt.jurik_filt(lmas, fast, fphs) lmal := jt.jurik_filt(lmal, slow, sphs) topvalueMinus = 0 topvaluePlus = 0 bottomvalueMinus = 0 bottomvaluePlus = 0 ppoT = (lmas - lmal) / lmal * 100.0 ppoB = (lmal - lmas) / lmal * 100.0 pctRankT = 0.0 pctRankB = 0.0 stateu = 0 stated = 0 for k = 1 to lookBack by 1 if (ppoT[k] < ppoT) topvalueMinus := topvalueMinus + 1 else topvaluePlus := topvaluePlus + 1 if (ppoB[k] < ppoB) bottomvalueMinus := bottomvalueMinus + 1 else bottomvaluePlus := bottomvaluePlus + 1 if (topvalueMinus + topvaluePlus != 0) pctRankT := topvalueMinus / (topvalueMinus + topvaluePlus) if (bottomvalueMinus + bottomvaluePlus != 0) pctRankB := (bottomvalueMinus / (bottomvalueMinus + bottomvaluePlus)) * -1 if (pctRankT > math.max(percent1, percent2) / 100) stateu := 2 if (pctRankT> math.min(percent1, percent2) / 100 and stateu == 0) stateu := 1 if (pctRankB < -math.max(percent1, percent2) / 100) stated :=-2 if (pctRankB < -math.min(percent1, percent2) / 100 and stated == 0) stated :=-1 colorout = stateu == 1 ? lightredcolor : stateu == 2 ? redcolor : stated == -1 ? lightgreencolor : stated == -2 ? greencolor : color.gray plot(pctRankB, "8", color = colorout, style = plot.style_columns) plot(pctRankT, "7", color = colorout, style = plot.style_columns) barcolor(colorbars ? colorout : na) plot(percent1/100, color=color.new(redcolor, 30), linewidth=1, style=plot.style_circles, title = "Overbought level 2") plot(percent2/100, color=color.new(redcolor, 30), linewidth=1, style=plot.style_circles, title = "Overbought level 1") plot(-percent1/100, color=color.new(greencolor, 30), linewidth=1, style=plot.style_circles, title = "Oversold level 1") plot(-percent2/100, color=color.new(greencolor, 30), linewidth=1, style=plot.style_circles, title = "Oversold level 2")
Parabolic SAR with the ADX overlay
https://www.tradingview.com/script/Hi5f56ec-Parabolic-SAR-with-the-ADX-overlay/
Eervin123
https://www.tradingview.com/u/Eervin123/
74
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Eervin123 //@version=5 indicator("YOSAR", overlay = true) start = input.float(defval = 0.02, title = "Start", step = 0.01) increment = input.float(defval = 0.02, title = "Increment", step = 0.01) maximum = input.float(defval = 0.20, title = "Maximum", step = 0.01) // ADX Inputs len = input.int(14, minval=1, title="DI Length") lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50) ADXlowerBound = input.int(25, minval=1, title="ADX Lower Bound") // Function prints a message at the bottom-right of the chart. f_print(_text) => var table _t = table.new(position.bottom_right, 1, 1) table.cell(_t, 0, 0, _text, bgcolor = color.new(color.yellow, transp=50)) sar = ta.sar(start, increment, maximum) [diplus, diminus, adx] = ta.dmi(len, lensig) // Pull in the DI+ DI- and ADX // Create the plot colors for SAR sarColor = if(close > sar) color.green else color.red // Plot the SAR plot(sar, style = plot.style_cross, linewidth=2, color = sarColor) // Plot the ADX color background adxColor = if(adx > 25) switch (diplus > diminus) => color.new(color.green, transp=90) (diplus < diminus) => color.new(color.red, transp=90) bgcolor(adxColor) // Probably comment the following out once you understand the chart f_print("No background color means the ADX is indicating a rangebound market with no trend in place")
Adaptive, Jurik-Filtered, JMA/DWMA MACD [Loxx]
https://www.tradingview.com/script/gxURr5jd-Adaptive-Jurik-Filtered-JMA-DWMA-MACD-Loxx/
loxx
https://www.tradingview.com/u/loxx/
153
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator(title='Adaptive, Jurik-Filtered, JMA/DWMA MACD [Loxx]', shorttitle='AJFJMADWMAMACD [Loxx]', timeframe="", timeframe_gaps=true, max_bars_back = 2000) greencolor = #2DD204 redcolor = #D2042D bluecolor = #042dd2 lightgreencolor = #96E881 lightredcolor = #DF4F6C lightbluecolor = #4f6cdf darkGreenColor = #1B7E02 darkRedColor = #93021F darkBlueColor = #021f93 _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom(src, min_len, max_len, ave_len) => var c = 2 * math.pi var s = 1.414 avglen = ave_len filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0, Sy = 0.0, Sxx = 0.0, Syy = 0.0, Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) dominantcycle = 0.0, peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0, sp = 0.0 for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle dom_in = math.min(math.max(dominantcycle, min_len), max_len) dom_in _a_jurik_filt(src, len, phase) => len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) pow1 = math.max(len1 - 2.0, 0.5) volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65 del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) temp_avg = ta.sma(vsum, avgLen) y = bar_index + 1 if(y <= avgLen + 1) avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1) else avolty := temp_avg dVolty = avolty > 0 ? volty / avolty : 0 dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty dVolty := dVolty < 1 ? 1 : dVolty pow2 = math.pow(dVolty, pow1) len2 = math.sqrt(0.5 * (len - 1)) * len1 Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5 beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2) alpha = math.pow(beta, pow2) jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0 e0 := (1 - alpha) * src + alpha * nz(e0[1]) e1 := (src - e0) * (1 - beta) + beta * nz(e1[1]) e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) jma1 := e2 + nz(jma1[1]) jma1 pine_wma(x, y) => norm = 0.0 sum = 0.0 for i = 0 to y - 1 weight = (y - i) * y norm := norm + weight sum := sum + x[i] * weight sum / norm f_dwma(_src, _length) => pine_wma(pine_wma(_src, _length), _length) adapt = input.string("Fixed", "Calculation type", options = ["Fixed", "Autocorrelation Adaptive"], group = "Basic Settings") src = input.source(close, "Source", group = "Basic Settings") jmalen = input.int(12, "JMA Length", minval=1, group = "Basic Settings") dwmalen = input.int(26, "DWMA Length", minval=1, group = "Basic Settings") macdph = input.int(0, title = "Jurik Phase", group = "Basic Settings") sauto_src = input.source(close, title='JMA APA Source', group = "JMA Autocorrelation Periodgram Algorithm") sauto_min = input.int(8, minval = 1, title='JMA APA Min Length', group = "JMA Autocorrelation Periodgram Algorithm") sauto_max = input.int(26, minval = 1, title='JMA APA Max Length', group = "JMA Autocorrelation Periodgram Algorithm") sauto_avg = input.int(12, minval = 1, title='JMA APA Average Length', group = "JMA Autocorrelation Periodgram Algorithm") fauto_src = input.source(close, title='DWMA APA Source', group = "DWMA Autocorrelation Periodgram Algorithm") fauto_min = input.int(8, minval = 1, title='DWMA APA Min Length', group = "DWMA Autocorrelation Periodgram Algorithm") fauto_max = input.int(48, minval = 1, title='DWMA APA Max Length', group = "DWMA Autocorrelation Periodgram Algorithm") fauto_avg = input.int(26, minval = 1, title='DWMA APA Average Length', group = "DWMA Autocorrelation Periodgram Algorithm") colorbars = input.bool(false, "Color bars?", group = "UI Options") fauto = _auto_dom(fauto_src, fauto_min, fauto_max, fauto_avg) fout = adapt == "Fixed" ? dwmalen : int(fauto) < 1 ? 1 : int(fauto) sauto = _auto_dom(sauto_src, sauto_min, sauto_max, sauto_avg) sout = adapt == "Fixed" ? jmalen : int(sauto) < 1 ? 1 : int(sauto) dwma = f_dwma(src, int(fout)) jma = _a_jurik_filt(src, sout, int(macdph)) macd = jma - dwma colorout = macd >= 0 and macd > macd[1] ? greencolor : macd >= 0 and macd < macd[1] ? lightgreencolor : macd < 0 and macd < macd[1] ? redcolor : lightredcolor plot(macd, title='MACD', color = colorout, linewidth = 3, style = plot.style_histogram) plot(macd, color = color.white, linewidth = 2) barcolor(colorbars ? colorout : na)
Jurik Velocity ("smoother moment") [Loxx]
https://www.tradingview.com/script/Pk0UVTTT-Jurik-Velocity-smoother-moment-Loxx/
loxx
https://www.tradingview.com/u/loxx/
139
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Jurik Velocity (\"smoother moment\") [Loxx]", shorttitle="JV [Loxx]", timeframe="", overlay = false, timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D //mom _jurik_vol(src, len)=> suma = 0.0, sumb = 0.0, sumwa = 0.0, sumwb = 0.0 for k = 0 to len by 1 weight = len - k suma += src[k] * weight sumb += src[k] * weight * weight sumwa += weight sumwb += weight * weight out = sumb/sumwb - suma/sumwa out src = input.source(close, "Source") len = input.int(25, "Length") colorbars = input.bool(false, "Color bars?") out = _jurik_vol(src, len) plot(out, color = out >= 0 ? greencolor : redcolor, linewidth = 2) plot(0, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero line") barcolor(colorbars ? out > 0 ? greencolor : redcolor : na)
OhManLan Golden Cloud
https://www.tradingview.com/script/W7yZsBf8-OhManLan-Golden-Cloud/
OhManLan
https://www.tradingview.com/u/OhManLan/
55
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© OhManLan //@version=5 indicator("OhManLan Golden Cloud", shorttitle="OML Golden Cloud", overlay=true, timeframe="", timeframe_gaps=true) //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// // OML Cloud Show_OML_GoldenCloud = input.bool(title="Show Golden Cloud", defval=true) GR_M = input.float(1.61803398875, minval=0, step=0.001, title="Multipler", tooltip="Golden ratio/Fibonacci number") TenkanPeriods = input.int(9, minval=1, title="Tenkan") KijunPeriods = input.int(26, minval=1, title="Kijun") SenkouSpanBPeriods = input.int(52, minval=1, title="Senkou Span B") Displacement = input.int(26, minval=1, title="Displacement") VWAPf(x) => _Vol = math.sum(volume, x) _WTP = math.sum(ohlc4*volume, x)/_Vol MidCloud_UpperLine = ((VWAPf(TenkanPeriods)) + (VWAPf(KijunPeriods)))/2 MidCloud_LowerLine = VWAPf(SenkouSpanBPeriods) UpCloud_UpperLine = MidCloud_UpperLine*GR_M UpCloud_LowerLine = MidCloud_LowerLine*GR_M LowCloud_UpperLine = MidCloud_UpperLine/GR_M LowCloud_LowerLine = MidCloud_LowerLine/GR_M p3 = plot(Show_OML_GoldenCloud ? UpCloud_UpperLine : na , offset = Displacement - 1, color=color.new(color.gray, 100), title="Senkou Span A (Up)") p4 = plot(Show_OML_GoldenCloud ? UpCloud_LowerLine : na, offset = Displacement - 1, color=color.new(color.gray, 100), title="Senkou Span B (Up)") p1 = plot(Show_OML_GoldenCloud ? MidCloud_UpperLine : na , offset = Displacement - 1, color=color.new(color.gray, 100), title="Senkou Span A (Middle)") p2 = plot(Show_OML_GoldenCloud ? MidCloud_LowerLine : na, offset = Displacement - 1, color=color.new(color.gray, 100), title="Senkou Span B (Middle)") p5 = plot(Show_OML_GoldenCloud ? LowCloud_UpperLine : na , offset = Displacement - 1, color=color.new(color.gray, 100), title="Senkou Span A (Low)") p6 = plot(Show_OML_GoldenCloud ? LowCloud_LowerLine : na, offset = Displacement - 1, color=color.new(color.gray, 100), title="Senkou Span B (Low)") fill(p3, p4, color = UpCloud_UpperLine > UpCloud_LowerLine ? color.new(#00e2ff, 63) : color.new(#ffeb3b, 60)) fill(p1, p2, color = MidCloud_UpperLine > MidCloud_LowerLine ? color.new(#00e2ff, 83) : color.new(#ff8bd8, 80)) fill(p5, p6, color = LowCloud_UpperLine > LowCloud_LowerLine ? color.new(#00e2ff, 63) : color.new(#ff9800, 60)) //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// // END //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--// //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
Adaptive, Jurik-Filtered, Floating RSI [Loxx]
https://www.tradingview.com/script/kDtR6VZo-Adaptive-Jurik-Filtered-Floating-RSI-Loxx/
loxx
https://www.tradingview.com/u/loxx/
151
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Adaptive, Jurik-Filtered, Floating RSI [Loxx]", shorttitle="AJFFRSI [Loxx]", timeframe="", overlay = false, timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D RMA(x, t) => EMA1 = x EMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (1/t) + nz(EMA1[1]) EMA1 _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom(src, min_len, max_len, ave_len) => var c = 2 * math.pi var s = 1.414 avglen = ave_len filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0, Sy = 0.0, Sxx = 0.0, Syy = 0.0, Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) dominantcycle = 0.0, peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0, sp = 0.0 for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle dom_in = math.min(math.max(dominantcycle, min_len), max_len) dom_in _a_jurik_filt(src, len, phase) => len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) pow1 = math.max(len1 - 2.0, 0.5) volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65 del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) temp_avg = ta.sma(vsum, avgLen) y = bar_index + 1 if(y <= avgLen + 1) avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1) else avolty := temp_avg dVolty = avolty > 0 ? volty / avolty : 0 dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty dVolty := dVolty < 1 ? 1 : dVolty pow2 = math.pow(dVolty, pow1) len2 = math.sqrt(0.5 * (len - 1)) * len1 Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5 beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2) alpha = math.pow(beta, pow2) jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0 e0 := (1 - alpha) * src + alpha * nz(e0[1]) e1 := (src - e0) * (1 - beta) + beta * nz(e1[1]) e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) jma1 := e2 + nz(jma1[1]) jma1 _rsx_rsi(src, len)=> src_out = 100 * src mom0 = ta.change(src_out) moa0 = math.abs(mom0) Kg = 3 / (len + 2) Hg = 1 - Kg //mom f28 = 0.0, f30 = 0.0 f28 := Kg * mom0 + Hg * nz(f28[1]) f30 := Hg * nz(f30[1]) + Kg * f28 mom1 = f28 * 1.5 - f30 * 0.5 f38 = 0.0, f40 = 0.0 f38 := Hg * nz(f38[1]) + Kg * mom1 f40 := Kg * f38 + Hg * nz(f40[1]) mom2 = f38 * 1.5 - f40 * 0.5 f48 = 0.0, f50 = 0.0 f48 := Hg * nz(f48[1]) + Kg * mom2 f50 := Kg * f48 + Hg * nz(f50[1]) mom_out = f48 * 1.5 - f50 * 0.5 //moa f58 = 0.0, f60 = 0.0 f58 := Hg * nz(f58[1]) + Kg * moa0 f60 := Kg * f58 + Hg * nz(f60[1]) moa1 = f58 * 1.5 - f60 * 0.5 f68 = 0.0, f70 = 0.0 f68 := Hg * nz(f68[1]) + Kg * moa1 f70 := Kg * f68 + Hg * nz(f70[1]) moa2 = f68 * 1.5 - f70 * 0.5 f78 = 0.0, f80 = 0.0 f78 := Hg * nz(f78[1]) + Kg * moa2 f80 := Kg * f78 + Hg * nz(f80[1]) moa_out = f78 * 1.5 - f80 * 0.5 asdf = math.max(math.min((mom_out / moa_out + 1.0) * 50.0, 100.00), 0.00) asdf _wilders_rsi(x, y) => u = math.max(x - x[1], 0) d = math.max(x[1] - x, 0) rs = RMA(u, y) / RMA(d, y) res = 100 - 100 / (1 + rs) res _rapid_rsi(src, len)=> upSum = math.sum(math.max(ta.change(src), 0), len) dnSum = math.sum(math.max(-ta.change(src), 0), len) rrsi = dnSum == 0 ? 100 : upSum == 0 ? 0 : 100 - 100 / (1 + upSum / dnSum) rrsi adapt = input.string("Fixed", "Calculation type", options = ["Fixed", "Autocorrelation Adaptive"], group = "Basic Settings") rsiType = input.string("Wilders", "RSI Type", options =["Wilders", "RSX", "Rapid"], group = "Basic Settings") src = input.source(close, "Source", group = "Basic Settings") len = input.int(15, "Length", group = "Basic Settings") MinMaxPeriod = input.int(100, "Max floating period", group = "Basic Settings") phs = input.int(50, title= "Jurik Phase", group = "Basic Settings") overb = input.int(80, "Overbought", group = "Thresholds") overs = input.int(20, "Oversold", group = "Thresholds") auto_src = input.source(close, title='APA Source', group = "Autocorrelation Periodgram Algorithm") auto_min = input.int(8, minval = 1, title='APA Min Length', group = "Autocorrelation Periodgram Algorithm") auto_max = input.int(48, minval = 1, title='APA Max Length', group = "Autocorrelation Periodgram Algorithm") auto_avg = input.int(3, minval = 1, title='APA Average Length', group = "Autocorrelation Periodgram Algorithm") colorbars = input.bool(false, "Color bars?", group = "UI Options") auto = _auto_dom(auto_src, auto_min, auto_max, auto_avg) out = adapt == "Fixed" ? len : int(auto) < 1 ? 1 : int(auto) rsi = rsiType == "Wilders" ? _wilders_rsi(src, out) : rsiType == "Rapid" ? _rapid_rsi(src,out) : _rsx_rsi(src, out) rsi := _a_jurik_filt(rsi, out, phs) up = overb dn = overs min = ta.lowest(rsi, 100) max = ta.highest(rsi, 100) rng = max - min levelDn = min + rng * dn / 100.0 levelMi = min + rng * 0.5 levelUp = min + rng * up / 100.0 rsiplot = plot(rsi, color = color.white, linewidth = 2) dnplot = plot(levelDn, color = greencolor, style = plot.style_line) midplot = plot(levelMi, color = color.gray, style = plot.style_line) upplot = plot(levelUp, color = redcolor, style = plot.style_line) fill(rsiplot, upplot, color = rsi >= levelUp ? redcolor :na ) fill(dnplot, rsiplot, color = rsi <= levelDn ? greencolor :na ) barcolor(colorbars ? rsi > levelMi ? greencolor : redcolor : na)
Neo's %K
https://www.tradingview.com/script/VjwXXpBU-Neo-s-K/
NeoDaNomad
https://www.tradingview.com/u/NeoDaNomad/
56
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© NeoDaNomad //@version=5 indicator("%K") int pd = input.int(14,"periods") float max_lo=ta.lowest(low, pd) float max_hi=ta.highest(high,pd) float numer=close - max_lo float denom=max_hi - max_lo int percentageK= math.floor((numer/denom)*100) _color = switch percentageK >= 80 => input.color(color.new(#801922, 0), "80 Col") percentageK <= 20 => input.color(color.new(#1B5E20, 0), "20 Col") percentageK > 20 or percentageK < 80 => input.color(color.new(#000000, 80), "21-79 Col") _80 = hline(80, "80%", color.new(#801922,60), linestyle=hline.style_dotted) _20 = hline(20, "20%", color.new(#801922,60), linestyle=hline.style_dotted) plot(percentageK, "%K" ,color=_color,style=plot.style_columns)
RAVI FX Fisher [Loxx]
https://www.tradingview.com/script/jV9rqvC9-RAVI-FX-Fisher-Loxx/
loxx
https://www.tradingview.com/u/loxx/
129
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("RAVI FX Fisher [Loxx]", shorttitle="RAVIFXF [Loxx]", timeframe="", overlay = false, timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D src = input.source(close, "Source", group = "Basic Settings") maf = input.int(4, "Fast MA Length", minval = 1, group = "Basic Settings") mas = input.int(49, "Slow MA Length", minval = 1, group = "Basic Settings") trigger = input.float(0.07, "Trigger", minval = 0, group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") maval = (ta.wma(src, maf) - ta.wma(src, mas)) * ta.atr(maf) / ta.wma(src, mas) / ta.atr(mas) maval := 100 * maval fish = (math.exp(2 * maval) - 1) / (math.exp(2 * maval) + 1) plot(fish,color = fish >=0 ? greencolor : redcolor, style = plot.style_histogram, linewidth = 2) plot(trigger, color = color.white, linewidth = 1 ) plot(-trigger, color = color.white, linewidth = 1 ) barcolor(colorbars ? fish >=0 ? greencolor : redcolor : na)
Equal Highs and Equal Lows
https://www.tradingview.com/script/wSr22FsQ-Equal-Highs-and-Equal-Lows/
ProValueTrader
https://www.tradingview.com/u/ProValueTrader/
648
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // Β© ProValueTrader //@version=5 indicator("Equal Highs and Equal Lows", shorttitle="Equal Highs/Lows", overlay=true, max_lines_count=500) //////////////////////////////////////////////////////////////////////////////// Equal Highs/Lows precision = input.int(2, step= 1, minval= 1, tooltip="A low value returns more exact Equal Highs/Lows. The value 1 returns the most accurate Equal Highs/Lows") PlotLines = input.bool(true, title="Plot Lines",inline="Line") LineCol = input(color.new(color.white,0),title="Line Color",inline="Line") LineWidth = input.int(3, step= 1, minval= 0,title="Line Width",inline="Line") PlotShapes = input.bool(true, title="Plot Shapes",inline="Shape") ShapeCol_Highs = input(color.new(color.lime,0),title="Highs Color",inline="Shape") ShapeCol_Lows = input(color.new(color.red,0),title="Lows Color",inline="Shape") // max/min max = math.max(high,high[1]) min = math.min(low,low[1]) // Normalize top = (math.abs(high - high[1])/(max-min))*100 bottom = (math.abs(low - low[1])/(max-min))*100 //Condition top_v = ta.crossunder(top,precision) bottom_v = ta.crossunder(bottom,precision) //Lines var line [] Top = array.new_line() var line [] Bot = array.new_line() if top_v and PlotLines t = line.new(bar_index[1],high[1],bar_index,high, color=LineCol, style=line.style_solid, width=LineWidth) array.push(Top,t) if bottom_v and PlotLines b = line.new(bar_index[1],low[1],bar_index,low, color=LineCol, style=line.style_solid, width=LineWidth) array.push(Bot,b) //Plot plotshape(PlotShapes?top_v:na, color=ShapeCol_Highs, offset=0, style=shape.triangledown, size=size.tiny, location=location.abovebar, title="Equal Highs") plotshape(PlotShapes?bottom_v:na, color=ShapeCol_Lows, offset=0, style=shape.triangleup, size=size.tiny, location=location.belowbar, title="Equal Lows") licence = input.string("Licence", group="This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/",tooltip="This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/")
Waddah Attar Hidden Levels [Loxx]
https://www.tradingview.com/script/MlBOeZeV-Waddah-Attar-Hidden-Levels-Loxx/
loxx
https://www.tradingview.com/u/loxx/
276
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Waddah Attar Hidden Levels [Loxx]", shorttitle = "WAHL [Loxx]", overlay = true) greencolor = #2DD204 redcolor = #D2042D bluecolor = #042dd2 lightgreencolor = #D2042D lightredcolor = #DF4F6C darkGreenColor = #1B7E02 darkRedColor = #93021F darkBlueColor = #021f93 f_tickFormat() => _s = str.tostring(syminfo.mintick) _s := str.replace_all(_s, '25', '00') _s := str.replace_all(_s, '5', '0') _s := str.replace_all(_s, '1', '0') _s tfInMinutes(simple string tf = "") => float chartTf = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf) float chartTFInMinutes = tfInMinutes() if chartTFInMinutes > 60 runtime.error("Error: Invalid timerame. This indicaator only works on timeframes 1 hour and below.") multiplier = input.float(0.618, "Fibonacci Multiplier", minval = 0.0, step = 0.01) _close1 = request.security(syminfo.tickerid, "D", close[1], barmerge.gaps_off, barmerge.lookahead_on) _close2 = request.security(syminfo.tickerid, "D", close[2], barmerge.gaps_off, barmerge.lookahead_on) _close3 = request.security(syminfo.tickerid, "D", close[3], barmerge.gaps_off, barmerge.lookahead_on) _open1 = request.security(syminfo.tickerid, "D", open[1], barmerge.gaps_off, barmerge.lookahead_on) _high1 = request.security(syminfo.tickerid, "D", high[1], barmerge.gaps_off, barmerge.lookahead_on) _low1 = request.security(syminfo.tickerid, "D", low[1], barmerge.gaps_off, barmerge.lookahead_on) c1 = 0.0, c2 = 0.0 if(_close1 >= _open1) c1 := (_high1 - _close1) / 2 + _close1 c2 := (_open1 - _low1) / 2 + _low1 else c1 := (_high1 - _open1) / 2 + _open1 c2 := (_close1 - _low1) / 2 + _low1 topBuffer = c1 bottomBuffer = c2 midBuffer = (c1 + c2) / 2 upBoundaryBuffer = c1 + (c1 - c2) * multiplier dnBoundaryBuffer = c2 - (c1 - c2) * multiplier plot(topBuffer, color = redcolor, linewidth = 2, style = plot.style_circles) plot(bottomBuffer, color = greencolor, linewidth = 2, style = plot.style_circles) plot(midBuffer, color = color.white, linewidth = 1, style = plot.style_circles) up = plot(upBoundaryBuffer, color = bluecolor, linewidth = 2, style = plot.style_circles) dn = plot(dnBoundaryBuffer, color = bluecolor, linewidth = 2, style = plot.style_circles) fill(up, dn, color.new(color.gray, 90)) topBufferLabel = label.new(x=bar_index[1] + 5, y = topBuffer, textalign = text.align_center, color = darkRedColor, textcolor = color.white, text= str.tostring(topBuffer, f_tickFormat()), size=size.normal, style=label.style_label_left) bottomBufferLabel = label.new(x=bar_index[1] + 5, y = bottomBuffer, textalign = text.align_center, color = darkGreenColor, textcolor = color.white, text= str.tostring(bottomBuffer, f_tickFormat()), size=size.normal, style=label.style_label_left) midBufferLabel = label.new(x=bar_index[1] + 5, y = midBuffer, textalign = text.align_center, color = color.white, textcolor = bluecolor, text= str.tostring(midBuffer, f_tickFormat()), size=size.normal, style=label.style_label_left) upBoundaryBufferLabel = label.new(x=bar_index[1] + 5, y = upBoundaryBuffer, textalign = text.align_center, color = darkBlueColor, textcolor = color.white, text= str.tostring(upBoundaryBuffer, f_tickFormat()) + " (" + str.tostring(multiplier, "#.###") + ")", size=size.normal, style=label.style_label_left) dnBoundaryBufferLabel = label.new(x=bar_index[1] + 5, y = dnBoundaryBuffer, textalign = text.align_center, color = darkBlueColor, textcolor = color.white, text= str.tostring(dnBoundaryBuffer, f_tickFormat()) + " (" + str.tostring(multiplier, "#.###") + ")", size=size.normal, style=label.style_label_left) label.delete(topBufferLabel[1]) label.delete(bottomBufferLabel[1]) label.delete(midBufferLabel[1]) label.delete(upBoundaryBufferLabel[1]) label.delete(dnBoundaryBufferLabel[1])
Multiple EMA
https://www.tradingview.com/script/ShKM1ez4-Multiple-EMA/
nirav8605
https://www.tradingview.com/u/nirav8605/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© nirav8605 //@version=5 indicator("Multiple EMA", overlay = true) Lengthema1 = input.int(title = "EMA1", defval = 9, minval = 1, maxval = 200) Lengthema2 = input.int(title = "EMA2", defval = 44, minval = 1, maxval = 200) Lengthema3 = input.int(title = "EMA3", defval = 55, minval = 1, maxval = 200) Lengthema4 = input.int(title = "EMA4", defval = 100, minval = 1, maxval = 200) Lengthema5 = input.int(title = "EMA5", defval = 200, minval = 1, maxval = 200) /// EMA INDICATOR EMA1 = ta.ema(close,Lengthema1) EMA2 = ta.ema(close,Lengthema2) EMA3 = ta.ema(close,Lengthema3) EMA4 = ta.ema(close,Lengthema4) EMA5 = ta.ema(close,Lengthema5) /// PLOT plot(EMA1, color = color.new(color.green,0)) plot(EMA2, color = color.new(color.red,0)) plot(EMA3, color = color.new(color.purple,0)) plot(EMA4, color = color.new(color.yellow,0)) plot(EMA5, color = color.new(color.blue,0)) plot(close)
Open Price v5
https://www.tradingview.com/script/vrGzkubA/
feibilanceon
https://www.tradingview.com/u/feibilanceon/
75
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© feibilanceon //@version=5 indicator("Open Price v5", shorttitle="OP_v5", overlay=true) len = input(60, "Length") yearly_open = request.security(syminfo.tickerid, '12M', open, lookahead=barmerge.lookahead_on) monthly_open = request.security(syminfo.tickerid, 'M', open, lookahead=barmerge.lookahead_on) weekly_open = request.security(syminfo.tickerid, 'W', open, lookahead=barmerge.lookahead_on) if weekly_open != weekly_open[1] var weekly_line = line.new(time,close,time,close, xloc=xloc.bar_time) // line.delete(weekly_line) weekly_line := line.new(time, weekly_open, time + 1000*60*60*24*7, weekly_open, xloc=xloc.bar_time, color=color.green) if monthly_open != monthly_open[1] var monthly_line = line.new(time,close,time,close, xloc=xloc.bar_time) // line.delete(monthly_line) monthly_line := line.new(time, monthly_open, time + 1000*60*60*24*31, monthly_open, xloc=xloc.bar_time, color=color.orange) if yearly_open != yearly_open[1] var yearly_line = line.new(time,close,time,close, xloc=xloc.bar_time) // line.delete(yearly_line) yearly_line := line.new(time, yearly_open, time + 1000*60*60*24*365, yearly_open, xloc=xloc.bar_time, color=color.aqua) color statusColor = color.green switch close > yearly_open and close > monthly_open and close > weekly_open => statusColor := color.new(color.green, 80) close > yearly_open and close > monthly_open and close < weekly_open => statusColor := color.new(color.green, 85) close > yearly_open and close < monthly_open and close > weekly_open => statusColor := color.new(color.green, 90) close > yearly_open and close < monthly_open and close < weekly_open => statusColor := color.new(color.green, 95) close < yearly_open and close > monthly_open and close > weekly_open => statusColor := color.new(color.red, 95) close < yearly_open and close > monthly_open and close < weekly_open => statusColor := color.new(color.red, 90) close < yearly_open and close < monthly_open and close > weekly_open => statusColor := color.new(color.red, 85) close < yearly_open and close < monthly_open and close < weekly_open => statusColor := color.new(color.red, 80) bgcolor(statusColor)
v2.3 Weekly Fibo Candle Middle Line
https://www.tradingview.com/script/KwYtFFh7-v2-3-Weekly-Fibo-Candle-Middle-Line/
MalibuKenny
https://www.tradingview.com/u/MalibuKenny/
60
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© kenny888 //@version=5 indicator(title='v2.3 Weekly Fibo Candle Middle Line', overlay=true, max_labels_count=100) var firstcandledate = str.format('{0,date, YYYY-MM-d}', time) //Get input ======[Groups] BEGIN // Group - Session Volatility Realtime group0 = 'Period under study' startDate = input.time(title='Start Date', defval=timestamp("10 Jun 2022 17:00:00 GMT+8"), tooltip='Date & time to begin analysis', group=group0) endDate = input.time(title='End Date', defval=timestamp('1 Jan 2099 12:00 +0000'), tooltip='Date & time to stop analysis', group=group0) show_centreline_ohlc = input.bool(title='show_centreline_ohlc', defval=false, group=group0, inline='HLline') use_custom_period = input.bool(title='use_custom_period', defval=true, group=group0, inline='HLline') var timeSession1="" // @@@ Setting @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // timeSession1 := input.session(title='From to', defval='0000-0000', group=group0) // Set the period var timeSession = '' if not use_custom_period if syminfo.ticker == 'HSI1!' timeSession := "0900-0200" else if syminfo.ticker == 'ES1!' timeSession := "2130-0400" // range light line from 0500 to cash. else if syminfo.ticker == 'NQ1!' timeSession := "2130-0400" // range light line from 0500 to cash. else if syminfo.ticker == 'CN50USD' timeSession := '0900-0415' else if syminfo.ticker == 'FDAX1!' or syminfo.ticker == 'GER30' timeSession :="1500-0345" else if syminfo.ticker == 'J225' timeSession :="0600-0400" else timeSession := timeSession1 // @@@ Setting @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ show_colorBG = false colorBG = color.rgb(0, 0, 255, 95) showRangeLabel = false RangeLabel_loc = yloc.abovebar show_table = false table_loc = position.bottom_right show_table_10days = false show_table_maxmin = false //Get input ======[Groups] END // This function returns true if the current bar falls within the given time session (:1234567 is to include all weekdays) inSession(sess) => //custom function input sess na(time(timeframe.period, sess + ':1234567', 'GMT+8')) == false and time >= startDate and time <= endDate //Change the background color for the in sessioin part (colorBG is a check box) bgcolor(show_colorBG and inSession(timeSession) ? colorBG : na) // Check if a new session has begun (not in ==> in) var withinSession = false if not inSession(timeSession)[1] and inSession(timeSession) withinSession := true withinSession // Declare required variables for analysis var MAXINT = 2147483647.0 var highestHigh = -1.0 var lowestLow = MAXINT var DailyCashHigh = -1.1 var DailyCashLow = MAXINT // Check if a session has ended (in ==> not in) if inSession(timeSession)[1] and not inSession(timeSession) withinSession := false // Assign daily cash high and low DailyCashHigh := highestHigh DailyCashLow := lowestLow // Reset stored high/low highestHigh := -1.0 lowestLow := MAXINT // Get highest high and lowest low of current session if withinSession if high > highestHigh highestHigh := high highestHigh if low < lowestLow lowestLow := low plot(withinSession ? highestHigh : na, color=color.rgb(0, 0, 255, 20), style=plot.style_linebr, linewidth=2, title='High Range line') plot(withinSession ? lowestLow : na, color=color.rgb(0, 0, 255, 20), style=plot.style_linebr, linewidth=2, title='Low Range line') // Label - Begin c_highestHigh = close -highestHigh Label_highestHigh = label.new(x=bar_index+10, y=withinSession ? highestHigh : na, color= color.new(color.blue, 70), text=str.tostring(c_highestHigh, "#") + '/ ' + str.tostring(highestHigh- lowestLow, "#"), style=label.style_none, size=size.small, textcolor=color.blue) label.delete(Label_highestHigh[1]) c_lowestLow = close -lowestLow Label_lowestLow = label.new(x=bar_index+10, y=withinSession ? lowestLow : na, color= color.new(color.blue, 70), text=str.tostring(c_lowestLow, "#") + '/ ' + str.tostring(highestHigh- lowestLow, "#"), style=label.style_none, size=size.small, textcolor=color.blue) label.delete(Label_lowestLow[1]) // Label - End var D_open = 0.0 timeinrange(res, sess) => not na(time(res, sess, 'GMT+8')) and na(time(res, sess, 'GMT+8'))[1] if timeinrange('1', timeSession) D_open := open plot(withinSession ? D_open : na, title='Day Open', color=D_open != D_open[1] ? na : color.navy) // One day ema 1 expr = ta.ema(ohlc4, 3) s1 = request.security(syminfo.tickerid, 'D', expr) // 240 Minutes plot(withinSession ? s1 : na, title='Day Open', color=D_open != D_open[1] ? na : color.new(color.green, 100)) c_s1 = close -s1 // Label_s1 = label.new(x=bar_index+5, y=withinSession ? s1 : na, color= color.new(color.green, 70), text=str.tostring(c_s1, "#"), style=label.style_label_left, size=size.normal, textcolor=color.black) // label.delete(Label_s1[1]) var candle_center = 0.0 candle_center := (highestHigh + lowestLow + D_open + close) / 4 // candle_center := (highestHigh + lowestLow) / 2 l_1D3 = s1 + (candle_center - s1) / 2 plot(withinSession ? candle_center : na, title='ohlc4 Candle Center', color=show_centreline_ohlc?color.new(color.red, 0):na, style=plot.style_linebr, linewidth=3) var candle_center_breakpoint = 0.0 candle_center_breakpoint :=(highestHigh + lowestLow + D_open) / 3 plot(withinSession ? candle_center_breakpoint : na, title='ohl3 Candle Center', color=color.new(color.blue, 0), style=plot.style_linebr, linewidth=3) var fibo_projection_upper = 0.0 fibo_projection_upper :=candle_center_breakpoint+(candle_center_breakpoint-lowestLow)*1.618 plot(withinSession ? fibo_projection_upper : na, title='Fibo upper target', color=color.new(color.blue, 0), style=plot.style_circles, linewidth=1) var fibo_projection_lower = 0.0 fibo_projection_lower :=candle_center_breakpoint-(highestHigh-candle_center_breakpoint)*1.618 plot(withinSession ? fibo_projection_lower : na, title='Fibo lower target', color=color.new(color.blue, 0), style=plot.style_circles, linewidth=1) var fibo0618 = 0.0 fibo0618 :=(highestHigh - lowestLow)*0.618+lowestLow plot(withinSession ? fibo0618 : na, title='fibo0618', color=color.new(color.blue, 0), style=plot.style_linebr, linewidth=1) Label_fibo0618 = label.new(x=bar_index+1, y=withinSession ? fibo0618 : na, color= color.new(color.orange, 70), text="Fibo_up "+ str.tostring (close-fibo0618, "#.#"), style=label.style_none, size=size.small, textcolor=color.blue) label.delete(Label_fibo0618[1]) var fibo0500 = 0.0 fibo0500 :=(highestHigh - lowestLow)*0.5+lowestLow plot(withinSession ? fibo0500 : na, title='fibo0500', color=color.new(color.red, 0), style=plot.style_linebr, linewidth=1) Label_fibo0500 = label.new(x=bar_index+1, y=withinSession ? fibo0500 : na, color= color.new(color.orange, 70), text="Fibo_mid " + str.tostring (close-fibo0500, "#.#"), style=label.style_none, size=size.small, textcolor=color.red) label.delete(Label_fibo0500[1]) var fibo0382 = 0.0 fibo0382 :=(highestHigh - lowestLow)*0.382+lowestLow plot(withinSession ? fibo0382 : na, title='fibo0382', color=color.new(color.blue, 0), style=plot.style_linebr, linewidth=1) Label_fibo0382 = label.new(x=bar_index+1, y=withinSession ? fibo0382 : na, color= color.new(color.orange, 70), text="Fibo_low " +str.tostring (close-fibo0382, "#.#") , style=label.style_none, size=size.small, textcolor=color.blue) label.delete(Label_fibo0382[1]) plot(withinSession ? l_1D3 : na, title='1D3ema', color=color.new(color.orange, 100), style=plot.style_linebr) c_l_1D3 = close -l_1D3 // Label_l_1D3 = label.new(x=bar_index+5, y=withinSession ? l_1D3 : na, color= color.new(color.orange, 70), text=str.tostring(c_l_1D3, "#"), style=label.style_label_left, size=size.normal, textcolor=color.black) // label.delete(Label_l_1D3[1]) e=ta.ema(ohlc4,3) plot(e,color=color.black, title="ema3", linewidth = 2) // // --> Custom Function to Check if New Bar == True // // --> (https://www.tradingview.com/wiki/Sessions_and_Time_Functions) // is_newbar(res) => // t = time(res) // ta.change(t) != 0 ? 1 : 0 // // newDay = ta.change(time("W")) != 0 // newDay = is_newbar('W') // plot(ta.vwap, title='VWAP ohlc4',color = newDay? color.new(color.black,100) :color.new( color.red,50), linewidth=5) // swt = input(true, title="Show This Weeks OHLC?") // swy = input(false, title="Show Previous Weeks OHLC?") // //Weekly // wtdo = request.security(syminfo.tickerid, 'W', open) // wpdo = request.security(syminfo.tickerid, 'W', open[1]) // wpc = request.security(syminfo.tickerid, 'W', close) // wpdc = request.security(syminfo.tickerid, 'W', close[1]) // wph = request.security(syminfo.tickerid, 'W', high) // wpdh = request.security(syminfo.tickerid, 'W', high[1]) // wpl = request.security(syminfo.tickerid, 'W', low) // wpdl = request.security(syminfo.tickerid, 'W', low[1]) // //Weekly Plots // plot(swt and wtdo ? wtdo : na, title="Weekly Open", style=plot.style_circles, linewidth=3, color=color.silver) // plot(swy and wpdo ? wpdo : na, title="Previous Weeks Open", style=plot.style_cross, linewidth=3, color=color.silver) // plot(swt and wpc ? wpc : na, title="Weekly Close", style=plot.style_circles, linewidth=3, color=color.fuchsia) // plot(swy and wpdc ? wpdc : na, title="Previous Weeks Close", style=plot.style_cross, linewidth=3, color=color.fuchsia) // plot(swt and wph ? wph : na, title="Weekly High", style=plot.style_circles, linewidth=3, color=color.green) // plot(swy and wpdh ? wpdh : na, title="Previous Weeks High", style=plot.style_cross, linewidth=3, color=color.green) // plot(swt and wpl ? wpl : na, title="Weekly Low", style=plot.style_circles, linewidth=3, color=color.red) // plot(swy and wpdl ? wpdl : na, title="Previous Weeks Low", style=plot.style_cross, linewidth=3, color=color.red)
Jurik Volty [Loxx]
https://www.tradingview.com/script/3HOfpybw-Jurik-Volty-Loxx/
loxx
https://www.tradingview.com/u/loxx/
77
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Jurik Volty [Loxx]", overlay = false, shorttitle="JV [Loxx]", timeframe="", timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D price = input.source(close, "Source") length = input.int(15, "Length") colorbars = input.bool(false, "Color bars?") volty(src, len) => len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) pow1 = math.max(len1 - 2.0, 0.5) volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65 del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) temp_avg = ta.sma(vsum, avgLen) y = bar_index + 1 if(y <= avgLen + 1) avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1) else avolty := temp_avg dVolty = avolty > 0 ? volty / avolty : 0 dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty dVolty := dVolty < 1 ? 1 : dVolty pow2 = math.pow(dVolty, pow1) len2 = math.sqrt(0.5 * (len - 1)) * len1 Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 [avolty, vsum] [avolty, vsum] = volty(price, length) plot(avolty, color = color.white, linewidth = 2) plot(vsum, color = vsum >= avolty ? greencolor : color.gray, linewidth = 3) barcolor(colorbars ? vsum >= avolty ? greencolor : color.gray : na)
EPS & revenue
https://www.tradingview.com/script/bdyYUEnM-EPS-revenue/
ARUN_SAXENA
https://www.tradingview.com/u/ARUN_SAXENA/
93
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© ARUN_SAXENA //@version=5 //@version=5 indicator("EPS & Revnue ", overlay=true) //table location input parmeter i_posTable = input.string(defval=position.top_left, title='Table Position', options=[position.top_left,position.top_center,position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right] ,group="Table" ,inline="6") var table epsTable = table.new(i_posTable , 17, 17, border_width=1,border_color=color.black) // === USER INPUTS colors for table data lightTransp = 0 avgTransp = 0 heavyTransp = 0 i_posColor = color.rgb(144,238,144) i_negColor = color.rgb(255,157,157) i_posColor0 = color.rgb(144,238,144) i_posColor1 = color.rgb(144,238,144) i_posColor2 = color.rgb(144,238,144) i_negColor2 = color.rgb(255,157,157) i_negColor1= color.rgb(255,157,157) i_negColor0 = color.rgb(255,157,157) // === FUNCTIONS AND CALCULATIONS === EPS = request.financial(syminfo.tickerid, "EARNINGS_PER_SHARE", "FQ") SALES = request.financial(syminfo.tickerid, "TOTAL_REVENUE", "FQ") Free_float = request.financial(syminfo.tickerid, "FLOAT_SHARES_OUTSTANDING","FY") OP = request.financial(syminfo.tickerid, "OPER_INCOME", "FQ" ) ROE =request.financial(syminfo.tickerid, "RETURN_ON_EQUITY", "FQ") f_eps(i) => request.security(syminfo.tickerid, '1M', EPS[i]) f_sales(i) => request.security(syminfo.tickerid, '1M', SALES[i]) f_op(i) => request.security(syminfo.tickerid, '1M', OP[i]) f_roe(i) => request.security(syminfo.tickerid, '1M', ROE[i]) // EPS calculation. EPSyoy = (EPS-f_eps(12))/math.abs(f_eps(12))*100 ChangeCurrent = (EPS-f_eps(13))/math.abs(f_eps(13))*100 Change4 = (f_eps(4)-f_eps(16))/math.abs(f_eps(16))*100 Change7 = (f_eps(7)-f_eps(19))/math.abs(f_eps(19))*100 Change10 = (f_eps(10)-f_eps(22))/math.abs(f_eps(22))*100 Change13 = (f_eps(13)-f_eps(25))/math.abs(f_eps(25))*100 //Sales calculation . SalesCurrent1 = (SALES/10000000) Sales41 = (f_sales(4)/10000000) Sales71 = (f_sales(7)/10000000) Sales101 = (f_sales(10)/10000000) Sales131 = (f_sales(13)/10000000) Sales151 = (f_sales(15)/10000000) ff = Free_float*ta.vwap/10000000 //for ROE data roe1 = ROE roe4 = f_roe(4)//)/math.abs(f_sales(4))*100 roe7 = f_roe(7)//)/math.abs(f_sales(7))*100 roe10 = f_roe(10)//)/math.abs(f_sales(10))*100 roe13 = f_roe(13)//)/math.abs(f_sales(13))*100 //for OPM data calculation opm1 = (OP)/math.abs(SALES)*100 opm4 = (f_op(4))/math.abs(f_sales(4))*100 opm7 = (f_op(7))/math.abs(f_sales(7))*100 opm10 = (f_op(10))/math.abs(f_sales(10))*100 opm13 = (f_op(13))/math.abs(f_sales(13))*100 //Change13 = (f_eps(13)-f_eps(25))/math.abs(f_eps(25))*100 //other calculation . TOVR = input(defval=50,title="Average Turnover Period", group= " Input Period for Average Turnover Calculation") turnover50= ta.sma(volume,TOVR)*ta.sma(close,TOVR)*TOVR/10000000 turnover= (volume)*(close)/10000000 AAA = input(defval=50,title="Relative Volume Lenght", group= " Input Lenght for Relative Volume Calculation") Rvol=volume/ta.sma(volume,AAA )*100 RRR = str.tostring(Rvol, '0') + '%' high_low_close = string(' ') weekly_hh = request.security(syminfo.tickerid, 'W', ta.highest(high, 52), lookahead=barmerge.lookahead_on) weekly_ll = request.security(syminfo.tickerid, 'W', ta.lowest(low, 52), lookahead=barmerge.lookahead_on) weekly_hc = request.security(syminfo.tickerid, 'W', ta.highest(close, 52), lookahead=barmerge.lookahead_on) weekly_lc = request.security(syminfo.tickerid, 'W', ta.lowest(close, 52), lookahead=barmerge.lookahead_on) high_plot = high_low_close == ' ' ? weekly_hh : weekly_hc low_plot = high_low_close == ' ' ? weekly_ll : weekly_lc //Average daily range calculation . Length = input(20, title='ADR length', group = "input ADR lenght for ADR % calculation") dhigh = request.security(syminfo.tickerid, 'D', high) dlow = request.security(syminfo.tickerid, 'D', low) ADR = 100 * (ta.sma(dhigh / dlow, Length) - 1) //down from 52w high down =(-high_plot+close)/high_plot*100 up = (close-low_plot)/low_plot*100 //QoQ sales calculation. SalesCurrent = (SALES-f_sales(13))/math.abs(f_sales(13))*100 Sales4 = (f_sales(4)-f_sales(16))/math.abs(f_sales(16))*100 Sales7 = (f_sales(7)-f_sales(19))/math.abs(f_sales(19))*100 Sales10 = (f_sales(10)-f_sales(22))/math.abs(f_sales(22))*100 Sales13 = (f_sales(13)-f_sales(25))/math.abs(f_sales(25))*100 // === TABLE FUNCTIONS === f_fillCell(_table, _column, _row, _value) => // _c_color = _value >= 0 ? i_posColor : i_negColor _c_color =if _value > 3 i_posColor2 else if _value <=3 and _value >=1 i_posColor1 else if _value <1 and _value >0 i_posColor0 else if _value < 0 and _value >= -1 i_negColor0 else if _value <= -1 and _value >= -3 i_negColor1 else if _value < -3 i_negColor2 else color.white _transp = math.abs(_value) > 3 ? heavyTransp : math.abs(_value) > 1 ? avgTransp : lightTransp _cellText = str.tostring(_value, '0.0') table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, _transp), text_color=color.black,text_size=size.small) f_fillCellComp(_table, _column, _row, _value) => _c_color =if _value > 3 i_posColor2 else if _value <3 and _value >1 i_posColor1 else if _value <1 and _value >0 i_posColor0 else if _value < 0 and _value > -1 i_negColor0 else if _value < -1 and _value > -3 i_negColor1 else if _value < -3 i_negColor2 else color.white //_c_color = _value >= 0 ? i_posColor : i_negColor _transp = math.abs(_value) > 60 ? heavyTransp : math.abs(_value) > 20 ? avgTransp : lightTransp //_cellText = str.tostring(_value, '0') + _text _cellText = str.tostring(_value, '0') + '%' table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, _transp), text_color=color.black,text_size=size.small) f_fillCellComp2(_table, _column, _row, _value) => _c_color = _value >= 0 ? i_posColor : i_negColor _transp = math.abs(_value) > 60 ? heavyTransp : math.abs(_value) > 20 ? avgTransp : lightTransp //_cellText = str.tostring(_value, '0') + _text _cellText = str.tostring(_value, '0') + '%' table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, _transp), text_color=color.black,text_size=size.small) f_fillCellComp1(_table, _column, _row, _value) => _c_color = color.rgb(208,224,113) _transp = math.abs(_value) > 60 ? heavyTransp : math.abs(_value) > 20 ? avgTransp : lightTransp //_cellText = str.tostring(_value, '0') + _text _cellText = str.tostring(_value, '0.0') table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, _transp), text_color=color.black,text_size=size.small) f_fillCellCompADR(_table, _column, _row, _value) => //_c_color = color.rgb(208,224,113) _c_color = math.abs(_value) > 3 ? i_posColor0 : i_negColor0 //_cellText = str.tostring(_value, '0') + _text _cellText = str.tostring(ADR, '0.00')+ '%' table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, 20), text_color=color.black,text_size=size.normal) //oneQperf = (EPS-f_eps(4))/math.abs(f_eps(4))*100 //twoQperf = (f_eps(4)-f_eps(7))/math.abs(f_eps(7))*100 //threeQperf = (f_eps(7)-f_eps(10))/math.abs(f_eps(10))*100 //avgPerf = math.avg(oneQperf, twoQperf, threeQperf) // Display table if barstate.islast f_fillCell(epsTable, 1, 10, f_eps(13)) f_fillCell(epsTable, 1, 9, f_eps(10)) f_fillCell(epsTable, 1, 8, f_eps(7)) f_fillCell(epsTable, 1, 7, f_eps(4)) f_fillCell(epsTable, 1, 6, EPS) // QoQ change f_fillCellComp(epsTable, 2, 6, ChangeCurrent) f_fillCellComp(epsTable, 2, 7, Change4) f_fillCellComp(epsTable, 2, 8, Change7) f_fillCellComp(epsTable, 2, 9, Change10) f_fillCellComp(epsTable, 2, 10, Change13) //f_fillCell(epsTable, 1, 1, EPS) //for sales f_fillCell(epsTable, 3, 10, Sales131) f_fillCell(epsTable, 3, 9, Sales101) f_fillCell(epsTable, 3, 8, Sales71) f_fillCell(epsTable, 3, 7, Sales41) f_fillCell(epsTable, 3, 6, SalesCurrent1) f_fillCell(epsTable, 2, 13, ff) //52w high low f_fillCellCompADR(epsTable, 5, 11, ADR) //f_fillCellComp1(epsTable, 5, 12, low_plot) // QoQ change f_fillCellComp(epsTable, 4, 6, SalesCurrent) f_fillCellComp(epsTable, 4, 7, Sales4) f_fillCellComp(epsTable, 4, 8, Sales7) f_fillCellComp(epsTable, 4, 9, Sales10) f_fillCellComp(epsTable, 4, 10, Sales13) f_fillCellComp1(epsTable, 2, 14, turnover) f_fillCellComp1(epsTable, 5, 14, turnover50) f_fillCellComp2(epsTable, 2, 12, up) f_fillCellComp2(epsTable, 2, 11, down) f_fillCellComp2(epsTable, 5, 13, Rvol) f_fillCellComp(epsTable, 5, 6, opm1) f_fillCellComp(epsTable, 5, 7, opm4) f_fillCellComp(epsTable, 5, 8, opm7) f_fillCellComp(epsTable, 5, 9, opm10) f_fillCellComp(epsTable, 5, 10, opm13) f_fillCellComp(epsTable, 6, 6, roe1) f_fillCellComp(epsTable, 6, 7, roe4) f_fillCellComp(epsTable, 6, 8, roe7) f_fillCellComp(epsTable, 6, 9, roe10) f_fillCellComp(epsTable, 6, 10, roe13) bColor=color.rgb(180, 177, 219) txt6 = "% CHG" txt1111= "Earning Calendar (INR)" else bColor=color.rgb(180, 177, 219) //txt6 = "% CHG" txt1111= "Earning Calendar (INR)" txt5 = "IY BACK" txt4 = "3Q BACK" txt3 = "2Q BACK" txt2 = "1Q BACK" txt1 = "Current Q"//str.tostring(DDA) + "/" + str.tostring(MMA) + "/" + str.tostring(YYA) txt6 = "% CHG" txt0 = " " //FOR HEADINGS txt8 = "REPORTED " txt9 = " EPS" txt10 = "SALES(Cr)" txt11 = "% CHG" txt111 = "OPM%" txt121 = "ROE%" txt12 = "TURNOVER D (Cr)" txt13 = "% UP FROM 52W LOW" txt14 = "% DOWN FROM 52W HIGH" txt15 = "FREE FLOAT (Cr)" txt16 = "Created By" txt17 = "ARUN_SAXENA" txt18 = "TURNOVER # (IN Cr.)" txt61 = "ADR % #" txt62 = "52W LOW" txt63 = "R Vol" table.cell(epsTable,0,6, text=txt1, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,7, text=txt2, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,8, text=txt3, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,9, text=txt4, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,10, text=txt5, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,2,5, text=txt6, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,3,11, text=txt61, bgcolor=bColor, text_color=color.black,text_size=size.normal) table.cell(epsTable,3,12, text=txt62, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,3,13, text=txt63, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,5, text=txt8, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,1,5, text=txt9, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,3,5, text=txt10, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,4,5, text=txt11, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,5,5, text=txt111, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,6,5, text=txt121, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,2, text=txt1111, bgcolor=color.rgb(129, 210, 251), text_color=color.black,text_size=size.normal, text_font_family = font.family_monospace) table.cell(epsTable,0,0, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.black,text_size=size.normal) table.cell(epsTable,0,1, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.black,text_size=size.small) table.cell(epsTable,0,14, text=txt12, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,3,14, text=txt18, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,12, text=txt13, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,11, text=txt14, bgcolor=bColor, text_color=color.black,text_size=size.small) table.cell(epsTable,0,13, text=txt15, bgcolor=bColor, text_color=color.black,text_size=size.small) table.merge_cells(epsTable,3,14,4,14) table.merge_cells(epsTable,3,11,4,12) table.merge_cells(epsTable,3,13,4,13) table.merge_cells(epsTable,5,11,6,12) table.merge_cells(epsTable,5,14,6,14) // table.merge_cells(epsTable,5,11,6,11) //table.merge_cells(epsTable,5,12,6,12) table.merge_cells(epsTable,5,13,6,13) table.merge_cells(epsTable,0,14,1,14) table.merge_cells(epsTable,0,11,1,11) table.merge_cells(epsTable,0,12,1,12) table.merge_cells(epsTable,0,13,1,13) table.merge_cells(epsTable,0,2,6,2) table.merge_cells(epsTable,0,0,6,1) // Length = input(20, title='length') // dhigh = request.security(syminfo.tickerid, 'D', high) // dlow = request.security(syminfo.tickerid, 'D', low) // // formula amended, thanks to GlinckEastwoot // ADR = 100 * (ta.sma(dhigh / dlow, Length) - 1) i_moreData = false rev = request.financial(syminfo.tickerid,'TOTAL_REVENUE','FQ',barmerge.gaps_on, ignore_invalid_symbol=true) datasize = 7 blankUnderUp = i_moreData == false ? 3 : 6 // Because there is a blank between the top of the table and the second line but Tradingview doesn't display it. // Function for Date f_array(arrayId, val) => array.unshift(arrayId, val) // append vale to an array array.pop(arrayId) ftdate(_table, _column, _row, _value) => myColor = color.red table.cell(table_id = _table, column = _column, row = _row, text = _value, bgcolor = myColor, text_color = color.black) // For Date var date = array.new_int(datasize) if rev f_array(date, time) // Display table //scondRepeatSameValueAtLastLine = actualEPS==actualEPS1 and standardEPS==standardEPS1 and EPS_Estimate==EPS_Estimate[1] // here I use 'and' instead of 'or' because we want to avoid the display bug of TradingView when the 2 last lines repeat themselves if barstate.islast // For Date MMM-yy for i = 0 to datasize-blankUnderUp if barstate.islast table.cell(epsTable, 0, (6+i), str.format('{0, date, MMM-yy}', array.get(date, i)),bgcolor=color.rgb(180, 177, 219), text_color=color.black,text_size=size.small) //plot(Rvol , color=color.rgb(0,100,0,100))
Tolerance
https://www.tradingview.com/script/Akde9ubU-Tolerance/
layth7ussein
https://www.tradingview.com/u/layth7ussein/
59
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© layth7ussein //@version=5 indicator("Tolerance") src = input(ohlc4, "Source") len = input.int(50, "Length") longLen = input.int(20, "Long MA length") shortLen = input.int(9, "Short MA length") tol = src/ta.sma(src, len)-1 tolMAlong = ta.sma(tol, longLen) tolMAshort = ta.sma(tol, shortLen) plot(tol, color=color.blue) plot(tolMAlong, color=color.yellow) plot(tolMAshort, color=color.red)
Adaptive Look-back/Volatility Phase Change Index on Jurik [Loxx]
https://www.tradingview.com/script/hUijLDU5-Adaptive-Look-back-Volatility-Phase-Change-Index-on-Jurik-Loxx/
loxx
https://www.tradingview.com/u/loxx/
46
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Adaptive Look-back/Volatility Phase Change Index on Jurik [Loxx]",overlay = false, shorttitle="ALBVPCIJ [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom(src, min_len, max_len, ave_len) => var c = 2 * math.pi var s = 1.414 avglen = ave_len filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0, Sy = 0.0, Sxx = 0.0, Syy = 0.0, Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) dominantcycle = 0.0, peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0, sp = 0.0 for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle dom_in = math.min(math.max(dominantcycle, min_len), max_len) dom_in _a_jurik_filt(src, len, phase) => len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) pow1 = math.max(len1 - 2.0, 0.5) volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65 del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) temp_avg = ta.sma(vsum, avgLen) y = bar_index + 1 if(y <= avgLen + 1) avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1) else avolty := temp_avg dVolty = avolty > 0 ? volty / avolty : 0 dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty dVolty := dVolty < 1 ? 1 : dVolty pow2 = math.pow(dVolty, pow1) len2 = math.sqrt(0.5 * (len - 1)) * len1 Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5 beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2) alpha = math.pow(beta, pow2) jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0 e0 := (1 - alpha) * src + alpha * nz(e0[1]) e1 := (src - e0) * (1 - beta) + beta * nz(e1[1]) e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) jma1 := e2 + nz(jma1[1]) jma1 adapt = input.string("Fixed", "Calculation type", options = ["Fixed", "Autocorrelation Adaptive"], group = "Basic Settings") src = input.source(close, "Source", group = "Basic Settings") len = input.int(15, "Length", group = "Basic Settings") phs = input.int(50, title= "JMA Phase", group = "Basic Settings") auto_src = input.source(close, title='APA Source', group = "Autocorrelation Periodgram Algorithm Inputs") auto_min = input.int(8, minval = 1, title='APA Min Length', group = "Autocorrelation Periodgram Algorithm Inputs") auto_max = input.int(48, minval = 1, title='APA Max Length', group = "Autocorrelation Periodgram Algorithm Inputs") auto_avg = input.int(3, minval = 1, title='APA Average Length', group = "Autocorrelation Periodgram Algorithm Inputs") invert = input.bool(false, "Invert PCI to match Trend?", group = "UI Options") colorbars = input.bool(false, "Color bars?", group = "UI Options") mom = ta.change(src, len) upSum = 0.0 dnSum = 0.0 auto = _auto_dom(auto_src, auto_min, auto_max, auto_avg) out = adapt == "Fixed" ? len : math.floor(auto) < 1 ? 1 : math.floor(auto) for i = 0 to len - 1 by 1 grad = nz(src[len]) + mom * (len - i) / (len - 1) dev = nz(src[len - i]) - grad if dev > 0 upSum += dev upSum else dnSum -= dev dnSum sum = upSum + dnSum pci = sum != 0 ? 100 * upSum / sum : 0 jma_out = invert ? 100 - _a_jurik_filt(pci, out, phs) : _a_jurik_filt(pci, out, phs) color_out = invert ? jma_out >= 50 ? greencolor : redcolor : jma_out < 50 ? greencolor : redcolor plot(jma_out, color = color_out, linewidth = 3) barcolor(colorbars ? color_out : na) plot(80, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Overbought") plot(50, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Middle") plot(20, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Oversold")
Adaptive, Double Jurik Filter Moving Average (AJFMA) [Loxx]
https://www.tradingview.com/script/3sSmbpS7-Adaptive-Double-Jurik-Filter-Moving-Average-AJFMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
94
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Adaptive, Double Jurik Filter Moving Average (AJFMA) [Loxx]", shorttitle = "ADJFMA [Loxx]", overlay = true, timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom(src, min_len, max_len, ave_len) => var c = 2 * math.pi var s = 1.414 avglen = ave_len filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0, Sy = 0.0, Sxx = 0.0, Syy = 0.0, Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) dominantcycle = 0.0, peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0, sp = 0.0 for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle dom_in = math.min(math.max(dominantcycle, min_len), max_len) dom_in _a_jurik_filt(src, len, phase) => len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) pow1 = math.max(len1 - 2.0, 0.5) volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65 del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) temp_avg = ta.sma(vsum, avgLen) y = bar_index + 1 if(y <= avgLen + 1) avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1) else avolty := temp_avg dVolty = avolty > 0 ? volty / avolty : 0 dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty dVolty := dVolty < 1 ? 1 : dVolty pow2 = math.pow(dVolty, pow1) len2 = math.sqrt(0.5 * (len - 1)) * len1 Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5 beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2) alpha = math.pow(beta, pow2) jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0 e0 := (1 - alpha) * src + alpha * nz(e0[1]) e1 := (src - e0) * (1 - beta) + beta * nz(e1[1]) e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) jma1 := e2 + nz(jma1[1]) jma1 adapt = input.string("Fixed", "Calculation type", options = ["Fixed", "Autocorrelation Adaptive"], group = "Basic Settings") src = input.source(close, "Source", group = "Basic Settings") len = input.int(40, "Length", group = "Basic Settings") phs = input.int(0, title= "JMA Phase", group = "Basic Settings") double = input.bool(false, title= "Double Smooth?", group = "Basic Settings") auto_src = input.source(close, title='APA Source', group = "Autocorrelation Periodgram Algorithm") auto_min = input.int(8, minval = 1, title='APA Min Length', group = "Autocorrelation Periodgram Algorithm") auto_max = input.int(48, minval = 1, title='APA Max Length', group = "Autocorrelation Periodgram Algorithm") auto_avg = input.int(3, minval = 1, title='APA Average Length', group = "Autocorrelation Periodgram Algorithm") colorbars = input.bool(false, "Color bars?", group = "UI Options") auto = _auto_dom(auto_src, auto_min, auto_max, auto_avg) out = adapt == "Fixed" ? len : math.floor(auto) < 1 ? 1 : math.floor(auto) out_jma = double ? _a_jurik_filt(_a_jurik_filt(src, out, phs), out, phs) : _a_jurik_filt(src, out, phs) plot(out_jma, color = close > out_jma ? greencolor : redcolor, linewidth = 3) barcolor(colorbars ? close > out_jma ? greencolor : redcolor : na)
Adaptive, Jurik-Smoothed, Trend Continuation Factor [Loxx]
https://www.tradingview.com/script/l2tLkgeO-Adaptive-Jurik-Smoothed-Trend-Continuation-Factor-Loxx/
loxx
https://www.tradingview.com/u/loxx/
67
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Adaptive, Jurik-Smoothed, Trend Continuation Factor [Loxx]", overlay = false, shorttitle="AJSTCF [Loxx]", timeframe="", timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D _a_jurik_filt(src, len, phase) => len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) pow1 = math.max(len1 - 2.0, 0.5) volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65 del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) temp_avg = ta.sma(vsum, avgLen) y = bar_index + 1 if(y <= avgLen + 1) avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1) else avolty := temp_avg dVolty = avolty > 0 ? volty / avolty : 0 dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty dVolty := dVolty < 1 ? 1 : dVolty pow2 = math.pow(dVolty, pow1) len2 = math.sqrt(0.5 * (len - 1)) * len1 Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5 beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2) alpha = math.pow(beta, pow2) jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0 e0 := (1 - alpha) * src + alpha * nz(e0[1]) e1 := (src - e0) * (1 - beta) + beta * nz(e1[1]) e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) jma1 := e2 + nz(jma1[1]) jma1 _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom(src, min_len, max_len, ave_len) => var c = 2 * math.pi var s = 1.414 avglen = ave_len filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0, Sy = 0.0, Sxx = 0.0, Syy = 0.0, Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) dominantcycle = 0.0, peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0, sp = 0.0 for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle dom_in = math.min(math.max(dominantcycle, min_len), max_len) dom_in adapt = input.string("Fixed", "Calculation type", options = ["Fixed", "Autocorrelation Adaptive"], group = "Basic Settings") src = input.source(close, "Source", group = "Basic Settings") len_in = input.int(30, "Length", group = "Basic Settings") smoothing = input.int(5, title= "Smoothing Length", group = "Basic Settings") phs = input.int(0, title= "JMA Phase", group = "Basic Settings") auto_src = input.source(close, title='APA Source', group = "Autocorrelation Periodgram Algorithm") auto_min = input.int(8, minval = 1, title='APA Min Length', group = "Autocorrelation Periodgram Algorithm") auto_max = input.int(48, minval = 1, title='APA Max Length', group = "Autocorrelation Periodgram Algorithm") auto_avg = input.int(3, minval = 1, title='APA Average Length', group = "Autocorrelation Periodgram Algorithm") colorbars = input.bool(false, "Color bars?", group = "UI Options") mom = ta.change(src) auto = _auto_dom(auto_src, auto_min, auto_max, auto_avg) out = adapt == "Fixed" ? len_in : math.floor(auto) < 1 ? 1 : math.floor(auto) plus_ch = 0.0, minus_ch = 0.0, plus_cf = 0.0, minus_cf = 0.0 if (mom > 0) plus_ch := mom plus_cf := plus_ch + nz(plus_cf[1]) if (mom < 0) minus_ch := -mom minus_cf := minus_ch + nz(minus_cf[1]) levUp = 0.0 levDn = 0.0 for i = 0 to out -1 levUp += plus_ch[i] - minus_cf[i] levDn += minus_ch[i] - plus_cf[i] levup = _a_jurik_filt(levUp, smoothing, phs) levdn = _a_jurik_filt(levDn, smoothing, phs) val = levup valc = levup > levdn ? color.new(greencolor, 0) : color.new(redcolor, 0) up = plot(levup, color = color.new(greencolor, 100), linewidth = 2) dn = plot(levdn, color = color.new(redcolor, 100), linewidth = 2) fill(up, dn, color = valc) barcolor(colorbars ? valc : na)
Volume Distribution Deviation
https://www.tradingview.com/script/GdHiEA7c-Volume-Distribution-Deviation/
john_everist
https://www.tradingview.com/u/john_everist/
37
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© john_everist //@version=5 indicator('Volume Distribution Deviation', overlay=true, max_bars_back = 3000) volume_time_of_day(vol, look_back, ave_type)=> vol_array = array.new_float(look_back) int count = 1 for i = 1 to 4999 if hour[i] == hour and minute[i] == minute// and dayofweek != dayofweek.saturday and dayofweek != dayofweek.sunday array.set(vol_array, count, vol[i]) count += 1 if count == look_back break float average_vol = na if not timeframe.isintraday average_vol := ta.sma(vol, look_back) else if ave_type == "Mean Average" average_vol := array.sum(vol_array)/array.size(vol_array) else average_vol := array.median(vol_array) average_vol recalc = input.bool(false, title='Reload Indicator', tooltip = "Sometimes the indicator does not load. Tick/untick this to force the indicator to reload") crash = recalc?1:0 var core = "Core Inputs" string currency = input.string("Automatic", title='Baseline Currency', options=['Automatic', 'AUD', 'CAD', 'CHF', 'EUR', 'GBP', 'JPY', 'NZD', 'USD'], group = core, tooltip = "Which Currency do you want investigate the deviation from typical percentage of market transactions at that time of day?\n\nIf you set to 'Automatic' the indicator will automatically chose the currency based on the currency you cross with gold.\n\nOptions are:\nOANDA:XAUNZD, OANDA:XAUAUD, OANDA:XAUJPY, OANDA:XAUCHF, OANDA:XAUEUR, OANDA:XAUGBP, OANDA:XAUCAD, OANDA:XAUUSD") look_back = input.int(10, title = "Number of Days Bcck to Average", minval=1, maxval=20, step=1, group = core, tooltip = "How many days back do you want to average?\n\nWhen using an intraday timeframe, the indicator compares market volume at that time of day to prevous days at the same time. This migates the impact of volume fluctuations that naturally occur throughout the day (New York open verses the deadtime between New York and Asia for example") ave_type = input.string("Median Average", title = "Method of Average Calculation", options = ["Median Average", "Mean Average"], group = core, tooltip = "How should the volume collected over the look back period be averaged?\n\nA median average will mitigate the impact of 'one off spikes'") sma_length = input.int(20, title = "SMA Length", minval = 2, step = 1, group = core, tooltip = "The Simple Moving Average of the current volume across the entire currency group") tolerance_current = input.int(10, title = 'Tolerance for current volume to be highlighted', group = core, tooltip = "When should the CURRENT volume deviation be highlighted and when should it be dimmed?\n\nIs a volume that deviates 10% from its typical for that time of day mean much?") tolerance_average = input.int(5, title = 'Tolerance for average volume to be highlighted', group = core, tooltip = "When should the AVERAGE volume deviation be highlighted and when should it be dimmed?\n\nIs a volume that deviates 10% from its typical for that time of day mean much?") show_value = input.bool(true, title = 'Show Current Market Percent', group = core) show_ave = input.bool(false, title = 'Show Current Market Percent SMA', group = core) fill_ave = input.bool(true, title = 'Fill SMA', group = core) var currencies = "Currencies to Include" bool show_NZD = input.bool(true, title = 'include NZD', group = currencies) bool show_AUD = input.bool(true, title = 'include AUD', group = currencies) bool show_JPY = input.bool(true, title = 'include JPY', group = currencies) bool show_CHF = input.bool(true, title = 'include CHF', group = currencies) bool show_EUR = input.bool(true, title = 'include EUR', group = currencies) bool show_GBP = input.bool(true, title = 'include GBP', group = currencies) bool show_CAD = input.bool(true, title = 'include CAD', group = currencies) bool show_USD = input.bool(true, title = 'include USD', group = currencies) var colours = "Currency Colours" color col_NZD = input.color(color.teal, title = 'NZD colour', group = colours) color col_AUD = input.color(color.red, title = 'AUD colour', group = colours) color col_JPY = input.color(color.purple, title = 'JPY colour', group = colours) color col_CHF = input.color(color.yellow, title = 'CHF colour', group = colours) color col_EUR = input.color(color.lime, title = 'EUR colour', group = colours) color col_GBP = input.color(color.aqua, title = 'GBP colour', group = colours) color col_CAD = input.color(color.orange, title = 'CAD colour', group = colours) color col_USD = input.color(color.white, title = 'USD colour', group = colours) transp_typical = input.int(50, title = "Current Value Transparency within (Specified Percent)", group = colours) col_ave_same = input.bool(false, title = 'SMA colour same as Current Percent', group = colours, tooltip = "Overrides all other colour options for SMA colour") color col_ave_top = input.color(color.new(#00FF00, 0), title = "SMA Color > (Specified Percent)", group = colours) color col_ave_bottom = input.color(color.new(#FF0000, 0), title = "SMA Color < (Specified Percent)", group = colours) color col_ave_typical = input.color(color.new(color.gray, 0), title = "SMA Color within (Specified Percent)", group = colours) sma_transp = input.int(50, title = "SMA transparency", group = colours) sma_transp_fill = input.int(50, title = "SMA fill transparency", group = colours) var p_style = "Plot Style" val_width = input.int(1, title = "Value Width", minval = 1, group = p_style) p_style_temp = input.string("columns", title = "Value Plot Style", options = ["area", "areabr", "circles", "columns", "cross", "histogram", "line", "linebr", "stepline"], group = p_style) plot_style_value = p_style_temp=="area"?plot.style_area:p_style_temp=="areabr"? plot.style_areabr:p_style_temp=="circles" ?plot.style_circles:p_style_temp=="columns"? plot.style_columns:p_style_temp=="cross"? plot.style_cross:p_style_temp=="histogram"? plot.style_histogram:p_style_temp=="line" ?plot.style_line:p_style_temp=="linebr"? plot.style_linebr:p_style_temp=="stepline"? plot.style_stepline :na sma_width = input.int(3, title = "SMA Width", minval = 1, group = p_style) p_style_ave_temp = input.string("stepline", title = "SMA Plot Style", options = ["area", "areabr", "circles", "columns", "cross", "histogram", "line", "linebr", "stepline"], group = p_style) plot_style_ave = p_style_ave_temp=="area"?plot.style_area:p_style_ave_temp=="areabr"? plot.style_areabr:p_style_ave_temp=="circles" ?plot.style_circles:p_style_ave_temp=="columns"? plot.style_columns:p_style_ave_temp=="cross"? plot.style_cross:p_style_ave_temp=="histogram"? plot.style_histogram:p_style_ave_temp=="line" ?plot.style_line:p_style_ave_temp=="linebr"? plot.style_linebr:p_style_ave_temp=="stepline"? plot.style_stepline :na if currency == 'Automatic' if syminfo.ticker == 'XAUAUD' currency := 'AUD' currency else if syminfo.ticker == 'XAUCAD' currency := 'CAD' currency else if syminfo.ticker == 'XAUCHF' currency := 'CHF' currency else if syminfo.ticker == 'XAUEUR' currency := 'EUR' currency else if syminfo.ticker == 'XAUGBP' currency := 'GBP' currency else if syminfo.ticker == 'XAUJPY' currency := 'JPY' currency else if syminfo.ticker == 'XAUNZD' currency := 'NZD' currency else if syminfo.ticker == 'XAUUSD' currency := 'USD' currency else currency := na currency var labels = "Label" show_labs = input(title='Show Currency Label', defval=true, group = labels) lab_size_temp = input.string(title='Label Size', options=['tiny', 'small', 'normal', 'large', 'huge'], defval='small', group = labels) lab_size = lab_size_temp == 'tiny' ? size.tiny : lab_size_temp == 'small' ? size.small : lab_size_temp == 'normal' ? size.normal : lab_size_temp == 'large' ? size.large : lab_size_temp == 'huge' ? size.huge : size.normal var sess = "Check Line" show_line = input.bool(true, title = "Show Vertical Line", group = sess, tooltip = "Add a vertical line at the same time everyday") line_col = input.color(color.new(color.white, 90), title = "Line Colour", group = sess) line_h = input.int(7, title='Line hour', minval = 0, maxval = 23, group = sess) line_m = input.int(0, title='Line minute', minval=0, maxval = 59, group = sess) time_zone_dif = input.int(-6, title='Time zone difference to exchange', options=[-13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], group = sess, tooltip = "You're proberly in a different time zone to your exchange so use this setting to compensate") //===================================================== AUDNZD_volume = request.security('FX:AUDNZD', "", volume) NZDJPY_volume = request.security('FX:NZDJPY', "", volume) NZDCHF_volume = request.security('FX:NZDCHF', "", volume) EURNZD_volume = request.security('FX:EURNZD', "", volume) GBPNZD_volume = request.security('FX:GBPNZD', "", volume) NZDCAD_volume = request.security('FX:NZDCAD', "", volume) NZDUSD_volume = request.security('FX:NZDUSD', "", volume) AUDJPY_volume = request.security('FX:AUDJPY', "", volume) AUDCHF_volume = request.security('FX:AUDCHF', "", volume) EURAUD_volume = request.security('FX:EURAUD', "", volume) GBPAUD_volume = request.security('FX:GBPAUD', "", volume) AUDCAD_volume = request.security('FX:AUDCAD', "", volume) AUDUSD_volume = request.security('FX:AUDUSD', "", volume) CHFJPY_volume = request.security('FX:CHFJPY', "", volume) EURJPY_volume = request.security('FX:EURJPY', "", volume) GBPJPY_volume = request.security('FX:GBPJPY', "", volume) CADJPY_volume = request.security('FX:CADJPY', "", volume) USDJPY_volume = request.security('FX:USDJPY', "", volume) EURCHF_volume = request.security('FX:EURCHF', "", volume) GBPCHF_volume = request.security('FX:GBPCHF', "", volume) CADCHF_volume = request.security('FX:CADCHF', "", volume) USDCHF_volume = request.security('FX:USDCHF', "", volume) EURGBP_volume = request.security('FX:EURGBP', "", volume) EURCAD_volume = request.security('FX:EURCAD', "", volume) EURUSD_volume = request.security('FX:EURUSD', "", volume) GBPCAD_volume = request.security('FX:GBPCAD', "", volume) GBPUSD_volume = request.security('FX:GBPUSD', "", volume) USDCAD_volume = request.security('FX:USDCAD', "", volume) NZD_volume = show_NZD? array.sum(array.from(AUDNZD_volume, NZDJPY_volume, NZDCHF_volume, EURNZD_volume, GBPNZD_volume, NZDCAD_volume, NZDUSD_volume)) : na AUD_volume = show_AUD? array.sum(array.from(AUDNZD_volume, AUDJPY_volume, AUDCHF_volume, EURAUD_volume, GBPAUD_volume, AUDCAD_volume, AUDUSD_volume)) : na JPY_volume = show_JPY? array.sum(array.from(NZDJPY_volume, AUDJPY_volume, CHFJPY_volume, EURJPY_volume, GBPJPY_volume, CADJPY_volume, USDJPY_volume)) : na CHF_volume = show_CHF? array.sum(array.from(NZDCHF_volume, AUDCHF_volume, CHFJPY_volume, EURCHF_volume, GBPCHF_volume, CADCHF_volume, USDCHF_volume)) : na EUR_volume = show_EUR? array.sum(array.from(EURNZD_volume, EURAUD_volume, EURJPY_volume, EURCHF_volume, EURGBP_volume, EURCAD_volume, EURUSD_volume)) : na GBP_volume = show_GBP? array.sum(array.from(GBPNZD_volume, GBPAUD_volume, GBPJPY_volume, GBPCHF_volume, EURGBP_volume, GBPCAD_volume, GBPUSD_volume)) : na CAD_volume = show_CAD? array.sum(array.from(NZDCAD_volume, AUDCAD_volume, CADJPY_volume, CADCHF_volume, EURCAD_volume, GBPCAD_volume, USDCAD_volume)) : na USD_volume = show_USD? array.sum(array.from(NZDUSD_volume, AUDUSD_volume, USDJPY_volume, USDCHF_volume, EURUSD_volume, GBPUSD_volume, USDCAD_volume)) : na total_vol = array.new_float() if show_NZD array.push(total_vol, NZD_volume) if show_AUD array.push(total_vol, AUD_volume) if show_JPY array.push(total_vol, JPY_volume) if show_CHF array.push(total_vol, CHF_volume) if show_EUR array.push(total_vol, EUR_volume) if show_GBP array.push(total_vol, GBP_volume) if show_CAD array.push(total_vol, CAD_volume) if show_USD array.push(total_vol, USD_volume) total_volume = array.sum(total_vol) color col_currency = na float currency_percent = na string currency_text = na string space = " " if currency == 'NZD' currency_percent := (NZD_volume / total_volume) * 100 col_currency := col_NZD currency_text := space+'NZD' else if currency == 'AUD' currency_percent := (AUD_volume / total_volume) * 100 col_currency := col_AUD currency_text := space+'AUD' else if currency == 'JPY' currency_percent :=(JPY_volume / total_volume) * 100 col_currency := col_JPY currency_text := space+'JPY' else if currency == 'CHF' currency_percent := (CHF_volume / total_volume) * 100 col_currency := col_CHF currency_text := space+'CHF' else if currency == 'EUR' currency_percent := (EUR_volume / total_volume) * 100 col_currency := col_EUR currency_text := space+'EUR' else if currency == 'GBP' currency_percent := (GBP_volume / total_volume) * 100 col_currency := col_GBP currency_text := space+'GBP' else if currency == 'CAD' currency_percent := (CAD_volume / total_volume) * 100 col_currency := col_CAD currency_text := space+'CAD' else if currency == 'USD' currency_percent := (USD_volume / total_volume) * 100 col_currency := col_USD currency_text := space+'USD' float currency_ave = na if timeframe.isintraday currency_ave := volume_time_of_day(currency_percent, look_back, ave_type) else currency_ave := ta.sma(currency_percent, sma_length) currency_percent := (currency_percent / currency_ave) * 100 - 100 currency_deviation_ave = ta.sma(currency_percent, sma_length) color col_ave = na color col_sma_fill = na if col_ave_same col_ave := color.new(col_currency, sma_transp) col_sma_fill := color.new(col_currency, sma_transp_fill) else if currency_deviation_ave>tolerance_average col_ave := color.new(col_ave_top, sma_transp) col_sma_fill := color.new(col_ave_top, sma_transp_fill) else if currency_deviation_ave<-tolerance_average col_ave := color.new(col_ave_bottom, sma_transp) col_sma_fill := color.new(col_ave_bottom, sma_transp_fill) else col_ave := color.new(col_ave_typical, sma_transp) col_sma_fill := color.new(col_ave_typical, sma_transp_fill) color middle_col = color.new(color.white,100) ave_middle = plot(0, color = middle_col) ave_extreme = plot(currency_deviation_ave, color = middle_col) fill_col_percent = col_currency fill(ave_middle, ave_extreme, color = fill_ave?col_sma_fill:na) hline(50, color = middle_col) hline(-50, color = middle_col) if currency_percent < tolerance_current and currency_percent > -tolerance_current col_currency := color.new(col_currency, transp_typical) plot(currency_percent, title = "Currency Percent", linewidth = val_width, color = show_value?col_currency:na, style = plot_style_value) plot(currency_deviation_ave, title = "Average Currency Deviation", linewidth = sma_width, color = show_ave?col_ave:na, style = plot_style_ave) if show_labs lab_style = label.style_label_left color invisible = color.new(color.gray, 100) lab = label.new(bar_index[0], 0, text=currency_text, textcolor=col_currency, color=invisible, style=lab_style, size=lab_size) label.delete(lab[1]) start = line_h + time_zone_dif if start < 0 start := 24 - math.abs(start) finish = line_h + time_zone_dif + 1 if finish > 24 finish := 0 start_h_str = start < 10 ? '0' + str.tostring(start) : str.tostring(start) finish_h_str = finish < 10 ? '0' + str.tostring(finish) : str.tostring(finish) start_m_str = line_m < 10 ? '0' + str.tostring(line_m) : str.tostring(line_m) finish_m_str = line_m < 10 ? '0' + str.tostring(line_m) : str.tostring(line_m) string session_str = start_h_str + start_m_str + '-' + finish_h_str + finish_m_str session = time("", session_str) bgcolor(show_line and not session and session[1] ? line_col:na)
[APD] Sharegenius Swing Trading Strategy
https://www.tradingview.com/script/H9lyD8Kx-APD-Sharegenius-Swing-Trading-Strategy/
AkhileshPDalvi
https://www.tradingview.com/u/AkhileshPDalvi/
110
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© AkhileshPDalvi //@version=5 indicator(title='[APD] Sharegenius Swing Trading Method', shorttitle='[APD] SST', overlay=true) // <<< User Input >>> { lines = input.bool(defval=true, inline='1', title='Indicator | Show/Hide | Dashboard') Dash = input.bool(defval=true, inline='1', title='') tb1 = input.bool(group='Target 🎯', defval=true, title='', inline='1') targetper1 = input.int(group='Target 🎯', defval=20, title='1st Target in %', minval=1, inline='1', tooltip='Based on trend change the Target') tb2 = input.bool(group='Target 🎯', defval=true, title='', inline='2') targetper2 = input.int(group='Target 🎯', defval=15, title='2nd Target in %', minval=1, inline='2', tooltip='Based on trend change the Target') tb3 = input.bool(group='Target 🎯', defval=true, title='', inline='3') targetper3 = input.int(group='Target 🎯', defval=10, title='3rd Target in %', minval=1, inline='3', tooltip='Based on trend change the Target') histData = input.int(group='Dashboard Settings πŸ”¨', defval=0, title='Historical Dashboard Readings', minval=0, tooltip='Enter number of bars back\nFor Example to check previous days Readings enter 1\n\nNote = Use Measure Tool to check bar no of particular date from current date.') upperlength = input.int(group='SST Settings πŸ”¨', defval=20, title='Upper Period', minval=1, tooltip='20 is recommended') lowerlength = input.int(group='SST Settings πŸ”¨', defval=20, title='Lower Period', minval=1, tooltip='20 is recommended') capital = input.int(group='SST Settings πŸ”¨', defval=10000, minval=1, title='Capital Per Trade', tooltip='For averaging keep Capital Per Trade same') showRs = input.bool(group='RS Settings πŸ”¨', defval=false ,title="Show RS", tooltip='Don\'t plot RS unless needed. It will affect the chart because of RS values.') benchmark = input.symbol(group='RS Settings πŸ”¨', defval="NSE:NIFTY",title="Benchmark") scr = input.source(group='RS Settings πŸ”¨', defval=close ,title="Source") len = input.int(group='RS Settings πŸ”¨', defval=55 ,title="RS Length", minval=1, step=1) // ------------------------------------------------------------ } // <<< SST Calculation >>> { lower = ta.lowest(lowerlength) upper = ta.highest(upperlength) gtt = upper - upper * 0.05 target1 = upper + upper * (targetper1 / 100) target2 = upper + upper * (targetper2 / 100) target3 = upper + upper * (targetper3 / 100) diff = (upper / close - 1) * 100 qty = upper <= capital ? math.ceil(capital / upper) : 0 // ------------------------------------------------------------ } // <<< RS Calculation >>> { baseSymbol = request.security(syminfo.tickerid, timeframe.period, scr) comparativeSymbol = request.security(benchmark, timeframe.period, scr) rs = (baseSymbol / baseSymbol[len] / (comparativeSymbol / comparativeSymbol[len]) - 1) // ------------------------------------------------------------ } // <<< Plotting SST >>> { P1 = plot(lines ? lower : na, title='Lower level', color=color.new(color.red, 0), linewidth=1) P2 = plot(lines ? gtt : na, title='Start GTT', color=color.new(color.blue, 0), linewidth=1) P3 = plot(lines ? upper : na, title='GTT Price', color=color.new(color.blue, 0), linewidth=2) T1 = plot(lines and tb1 ? target1 : na, title='1st Target', color=color.new(color.lime,0), linewidth=2) T2 = plot(lines and tb2 ? target2 : na, title='2nd Target', color=color.new(color.lime,50), linewidth=2) T3 = plot(lines and tb3 ? target3 : na, title='3rd Target', color=color.new(color.lime,70), linewidth=2) fill(P2, P3, color.new(color.blue, 90), title='Buy zone') fill(T1, T3, color.new(color.lime, 95), title='Target zone') // ------------------------------------------------------------ } // <<< Plotting RS >>> { plot(showRs ? rs : na, title='RS', color=color.red, linewidth=2) // ------------------------------------------------------------ } // <<< Plotting Dashboard >>> { Dash_tooltip = 'Note =' + '\n 1] This Script is for educational purposes only. Nothing in this content should be interpreted as financial advice or a recommendation to buy or sell any sort of security or investment.' + '\n 2] Trade in fundamentally good stocks & strong stocks those are outperforming index because we do not take stoploss in this strategy.' + '\n\n How to use this indicator = ' + '\n 1] Track the 20-Day Low of instrument.' + '\n 2] Create a GTT order which is 5% above 20 DL.' + '\n 3] If the share makes a new 20 DL before getting purchased, then update your GTT order to be 5% above new 20 DL.' + '\n 4] Next GTT will be started when average price falls by 10%. (GTT will be created as 5% above last 20 DL or Buy on 10%, 20%, 30% fall in average price.' + '\n 5] Sell target is 5% of average price. Sell all units or Set sell target on buy price.' + '\n 6] No stop loss needed as we buy when the stock falls.' if Dash == true var table gttTable = table.new(position.top_right, 8, 6, bgcolor=color.white, frame_color=color.white, frame_width=2, border_width=2) if barstate.islast table.cell(table_id = gttTable, column = 0, row = 0, text = "Sharegenius Swing Trading Dashboard", text_halign=text.align_center, tooltip=Dash_tooltip) table.cell(table_id = gttTable, column = 0, row = 1, text = histData > 0 ? str.tostring(histData) + ' Bars ago' : 'Latest Value', text_halign=text.align_center, bgcolor=color.new(color.blue,10), text_color=color.white) table.cell(table_id = gttTable, column = 0, row = 4, text = 'With Love ❀️ by Akhilesh P Dalvi', text_halign=text.align_center, tooltip='Special Thanks πŸ™ To :-\n1] Mahesh Kaushik For Strategy \n2] F.I.R.E. in India For Enhanced SST.') table.merge_cells(gttTable, 0, 0, 7, 0) table.merge_cells(gttTable, 0, 1, 7, 1) table.merge_cells(gttTable, 0, 4, 7, 4) table.cell(table_id = gttTable, column = 0, row = 2, text = str.upper(syminfo.type) + " NAME", bgcolor=color.new(color.black,10), text_color=color.white) table.cell(table_id = gttTable, column = 0, row = 3, text = syminfo.ticker, bgcolor=color.new(color.gray,0), text_color=color.white) table.cell(table_id = gttTable, column = 1, row = 2, text = "CMP", bgcolor=color.new(color.black,10), text_color=color.white) table.cell(table_id = gttTable, column = 1, row = 3, text = str.tostring(math.round(close[histData],2)), bgcolor=color.gray, text_color=color.white) table.cell(table_id = gttTable, column = 2, row = 2, text = "ACTION", bgcolor=color.new(color.black,10), text_color=color.white) table.cell(table_id = gttTable, column = 2, row = 3, text = (close[histData] > gtt ? 'Create GTT Order' : 'Wait & Watch'), bgcolor=(close[histData] > gtt ? color.green : color.blue), text_color=color.white) table.cell(table_id = gttTable, column = 3, row = 2, text = "GTT", bgcolor=color.new(color.black,10), text_color=color.white) table.cell(table_id = gttTable, column = 3, row = 3, text = str.tostring(math.round(upper[histData],2)), bgcolor=color.blue, text_color=color.white) table.cell(table_id = gttTable, column = 4, row = 2, text = "UPDATE GTT", bgcolor=color.new(color.black,10), text_color=color.white) table.cell(table_id = gttTable, column = 4, row = 3, text = gtt[histData] < gtt[histData + 1] or gtt[histData] > gtt[histData + 1] ? 'YES' : 'NO', bgcolor= gtt[histData] < gtt[histData + 1] or gtt[histData] > gtt[histData + 1] ? color.green : color.gray, text_color=color.white) table.cell(table_id = gttTable, column = 5, row = 2, text = "DIFF", bgcolor=color.new(color.black,10), text_color=color.white, tooltip= 'Diff in ' + str.tostring(upperlength) + ' DH & CMP') table.cell(table_id = gttTable, column = 5, row = 3, text = str.tostring(math.round(diff[histData], 2)) + " %", bgcolor= math.round(diff[histData], 2) < 5 ? color.green : color.gray, text_color=color.white, tooltip= 'Diff in ' + str.tostring(upperlength) + ' DH & CMP') table.cell(table_id = gttTable, column = 6, row = 2, text = "QTY", bgcolor=color.new(color.black,10), text_color=color.white, tooltip= 'Capital Per Trade is ' + str.tostring(capital)) table.cell(table_id = gttTable, column = 6, row = 3, text = str.tostring(qty[histData]), bgcolor= color.gray, text_color=color.white, tooltip= 'Capital Per Trade is ' + str.tostring(capital)) table.cell(table_id = gttTable, column = 7, row = 2, text = "RS " + str.tostring(len), bgcolor=color.new(color.black,10), text_color=color.white) table.cell(table_id = gttTable, column = 7, row = 3, text = str.tostring(math.round(rs[histData],2)), bgcolor= color.gray, text_color=color.white) // ------------------------------------------------------------ }
Forex Multi Exchange Volume
https://www.tradingview.com/script/QWqGLbKm-Forex-Multi-Exchange-Volume/
Jury_P
https://www.tradingview.com/u/Jury_P/
15
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© john_everist //@version=5 indicator(title='Multi-Exchange Relative Volume', shorttitle='Multi Exchange Volume', format=format.volume, overlay=true, scale=scale.right) // Input choice1 = input.string(title='Volume 1', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='FXCM') choice2 = input.string(title='Volume 2', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='OANDA') choice3 = input.string(title='Volume 3', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='FOREX.COM') choice4 = input.string(title='Volume 4', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='PEPPERSTONE') choice5 = input.string(title='Volume 5', options=['FXCM', 'OANDA', 'FOREX.COM', 'PEPPERSTONE', 'GLOBALPRIME'], defval='GLOBALPRIME') ema = input.int(title="EMA", defval=14, options=[3, 5, 7, 10, 14, 20, 50, 100, 200]) len = input.int(title="Backtrack", defval=17) // Do some minor changes exchange1 = choice1 == 'FXCM' ? 'FX' : choice1 == 'FOREX.COM' ? 'FX_IDC' : choice1 exchange2 = choice2 == 'FXCM' ? 'FX' : choice2 == 'FOREX.COM' ? 'FX_IDC' : choice2 exchange3 = choice3 == 'FXCM' ? 'FX' : choice3 == 'FOREX.COM' ? 'FX_IDC' : choice3 exchange4 = choice4 == 'FXCM' ? 'FX' : choice4 == 'FOREX.COM' ? 'FX_IDC' : choice4 exchange5 = choice5 == 'FXCM' ? 'FX' : choice5 == 'FOREX.COM' ? 'FX_IDC' : choice5 // Get data volExchange1 = request.security(exchange1 + ':' + syminfo.ticker, timeframe.period, volume) volExchange2 = request.security(exchange2 + ':' + syminfo.ticker, timeframe.period, volume) volExchange3 = request.security(exchange3 + ':' + syminfo.ticker, timeframe.period, volume) volExchange4 = request.security(exchange4 + ':' + syminfo.ticker, timeframe.period, volume) volExchange5 = request.security(exchange5 + ':' + syminfo.ticker, timeframe.period, volume) vol = (na(volExchange1) ? 0 : volExchange1) + (na(volExchange2) ? 0 : volExchange2)+ (na(volExchange3) ? 0 : volExchange3) + (na(volExchange4) ? 0 : volExchange4) + (na(volExchange5) ? 0 : volExchange5) if(vol == 0) vol = volume // Do calculation // Set colors green = #004d40 red = #841515 // Plot volume plot(vol, color=open < close ? green : red, style=plot.style_columns, title='Volume', transp=10) plot(ta.ema(vol, ema), color=color.gray, style=plot.style_area, transp = 60)
.236 FIB Extension Tool
https://www.tradingview.com/script/KqKcf75n-236-FIB-Extension-Tool/
jordanfray
https://www.tradingview.com/u/jordanfray/
207
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© jordanfray //@version=5 indicator(".236 FIB Extension Tool", shorttitle=".236 FIB EXT", overlay=true) // Colors - - - - - - - - - - - - - - - - - - - - white = color.new(#ffffff, 0) red = color.new(#E02A4A, 0) green = color.new(#2DBD85, 0) // Tooltip - - - - - - - - - - - - - - - - - - - - start_tooltip = "Select the start of the price wave where you want to extend the fib levels from." extension_tooltip = "Select the end of the first wave to extend fib levels beyond it." // Indicator Settings - - - - - - - - - - - - - - - - - - - - start = input.price(defval=0, title="Starting Price", confirm=true, group = "Fib Extension Settings", tooltip=start_tooltip) extension = input.price(defval=0, title=".236 Extension", confirm=true, group = "Fib Extension Settings", tooltip=extension_tooltip) support_color = input.color(defval=green, title="Support Color", group = "Fib Extension Settings") resistance_color = input.color(defval=red, title="Reistance Color", group = "Fib Extension Settings") // Calulate FIB Levels - - - - - - - - - - - - - - - - - - - - level_100 = ((extension - start) / .236) + start level_786 = ((level_100 - start) * .786) + start level_650 = ((level_100 - start) * .650) + start level_618 = ((level_100 - start) * .618) + start level_500 = ((level_100 - start) * .500) + start level_382 = ((level_100 - start) * .382) + start level_236 = extension level_000 = start level_1236 = ((level_100 - start) * 1.236) + start level_1328 = ((level_100 - start) * 1.328) + start level_1500 = ((level_100 - start) * 1.500) + start level_1618 = ((level_100 - start) * 1.618) + start level_1786 = ((level_100 - start) * 1.786) + start inner_level_236 = level_236 - ((level_236 - start) * .236) inner_level_328 = level_236 - ((level_236 - start) * .382) inner_level_500 = level_236 - ((level_236 - start) * .500) inner_level_618 = level_236 - ((level_236 - start) * .618) inner_level_650 = level_236 - ((level_236 - start) * .650) inner_level_786 = level_236 - ((level_236 - start) * .786) // Plot Lines - - - - - - - - - - - - - - - - - - - - line_100 = line.new(x1=time[10], y1=level_100, x2=time, y2=level_100, color=close > level_100 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_786 = line.new(x1=time[10], y1=level_786, x2=time, y2=level_786, color=close > level_786 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_650 = line.new(x1=time[10], y1=level_650, x2=time, y2=level_650, color=close > level_650 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_618 = line.new(x1=time[10], y1=level_618, x2=time, y2=level_618, color=close > level_618 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_500 = line.new(x1=time[10], y1=level_500, x2=time, y2=level_500, color=close > level_500 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_328 = line.new(x1=time[10], y1=level_382, x2=time, y2=level_382, color=close > level_382 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_236 = line.new(x1=time[10], y1=level_236, x2=time, y2=level_236, color=close > level_236 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time, style=line.style_dashed) line_000 = line.new(x1=time[10], y1=level_000, x2=time, y2=level_000, color=close > level_000 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time, style=line.style_dashed) line_1236 = line.new(x1=time[10], y1=level_1236, x2=time, y2=level_1236, color=close > level_1236 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_1328 = line.new(x1=time[10], y1=level_1328, x2=time, y2=level_1328, color=close > level_1328 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_1500 = line.new(x1=time[10], y1=level_1500, x2=time, y2=level_1500, color=close > level_1500 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_1618 = line.new(x1=time[10], y1=level_1618, x2=time, y2=level_1618, color=close > level_1618 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) line_1786 = line.new(x1=time[10], y1=level_1786, x2=time, y2=level_1786, color=close > level_1786 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) inner_line_236 = line.new(x1=time[10], y1=inner_level_236, x2=time, y2=inner_level_236, color=close > inner_level_236 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) inner_line_328 = line.new(x1=time[10], y1=inner_level_328, x2=time, y2=inner_level_328, color=close > inner_level_328 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) inner_line_500 = line.new(x1=time[10], y1=inner_level_500, x2=time, y2=inner_level_500, color=close > inner_level_500 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) inner_line_618 = line.new(x1=time[10], y1=inner_level_618, x2=time, y2=inner_level_618, color=close > inner_level_618 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) inner_line_650 = line.new(x1=time[10], y1=inner_level_650, x2=time, y2=inner_level_650, color=close > inner_level_650 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) inner_line_786 = line.new(x1=time[10], y1=inner_level_786, x2=time, y2=inner_level_786, color=close > inner_level_786 ? support_color : resistance_color, width=1, extend=extend.both, xloc=xloc.bar_time) // Label Lines - - - - - - - - - - - - - - - - - - - - var label label_100 = na var label label_786 = na var label label_650 = na var label label_618 = na var label label_500 = na var label label_382 = na var label label_236 = na var label label_000 = na var label label_1236 = na var label label_1328 = na var label label_1500 = na var label label_1618 = na var label label_1786 = na var label inner_label_236 = na var label inner_label_328 = na var label inner_label_500 = na var label inner_label_618 = na var label inner_label_650 = na var label inner_label_786 = na label.delete(label_100) label.delete(label_786) label.delete(label_650) label.delete(label_618) label.delete(label_500) label.delete(label_382) label.delete(label_236) label.delete(label_000) label.delete(label_1236) label.delete(label_1328) label.delete(label_1500) label.delete(label_1618) label.delete(label_1786) label.delete(inner_label_236) label.delete(inner_label_328) label.delete(inner_label_500) label.delete(inner_label_618) label.delete(inner_label_650) label.delete(inner_label_786) label_100 := label.new(x=bar_index + 20, y=level_100, style=label.style_none, size=size.normal, color=close > level_100 ? support_color : resistance_color, textcolor=close > level_100 ? support_color : resistance_color, text="1.00 | " + str.format("{0,number,currency}", level_100)) label_786 := label.new(x=bar_index + 20, y=level_786, style=label.style_none, size=size.normal, color=close > level_786 ? support_color : resistance_color, textcolor=close > level_786 ? support_color : resistance_color, text=".786 | " + str.format("{0,number,currency}", level_786)) label_650 := label.new(x=bar_index + 20, y=level_650, style=label.style_none, size=size.normal, color=close > level_650 ? support_color : resistance_color, textcolor=close > level_650 ? support_color : resistance_color, text=".650 | " + str.format("{0,number,currency}", level_650)) label_618 := label.new(x=bar_index + 20, y=level_618, style=label.style_none, size=size.normal, color=close > level_618 ? support_color : resistance_color, textcolor=close > level_618 ? support_color : resistance_color, text=".618 | " + str.format("{0,number,currency}", level_618)) label_500 := label.new(x=bar_index + 20, y=level_500, style=label.style_none, size=size.normal, color=close > level_500 ? support_color : resistance_color, textcolor=close > level_500 ? support_color : resistance_color, text=".500 | " + str.format("{0,number,currency}", level_500)) label_382 := label.new(x=bar_index + 20, y=level_382, style=label.style_none, size=size.normal, color=close > level_382 ? support_color : resistance_color, textcolor=close > level_382 ? support_color : resistance_color, text=".382 | " + str.format("{0,number,currency}", level_382)) label_236 := label.new(x=bar_index + 20, y=level_236, style=label.style_none, size=size.normal, color=close > level_236 ? support_color : resistance_color, textcolor=close > level_236 ? support_color : resistance_color, text=".236 | " + str.format("{0,number,currency}", level_236)) label_000 := label.new(x=bar_index + 20, y=level_000, style=label.style_none, size=size.normal, color=close > level_000 ? support_color : resistance_color, textcolor=close > level_000 ? support_color : resistance_color, text="0.00 | " + str.format("{0,number,currency}", level_000)) label_1236 := label.new(x=bar_index + 20, y=level_1236, style=label.style_none, size=size.normal, color=close > level_1236 ? support_color : resistance_color, textcolor=close > level_1236 ? support_color : resistance_color, text="1.236 | " + str.format("{0,number,currency}", level_1236)) label_1328 := label.new(x=bar_index + 20, y=level_1328, style=label.style_none, size=size.normal, color=close > level_1328 ? support_color : resistance_color, textcolor=close > level_1328 ? support_color : resistance_color, text="1.328 | " + str.format("{0,number,currency}", level_1328)) label_1500 := label.new(x=bar_index + 20, y=level_1500, style=label.style_none, size=size.normal, color=close > level_1500 ? support_color : resistance_color, textcolor=close > level_1500 ? support_color : resistance_color, text="1.500 | " + str.format("{0,number,currency}", level_1500)) label_1618 := label.new(x=bar_index + 20, y=level_1618, style=label.style_none, size=size.normal, color=close > level_1618 ? support_color : resistance_color, textcolor=close > level_1618 ? support_color : resistance_color, text="1.618 | " + str.format("{0,number,currency}", level_1618)) label_1786 := label.new(x=bar_index + 20, y=level_1786, style=label.style_none, size=size.normal, color=close > level_1786 ? support_color : resistance_color, textcolor=close > level_1786 ? support_color : resistance_color, text="1.786 | " + str.format("{0,number,currency}", level_1786)) inner_label_236 := label.new(x=bar_index + 20, y=inner_level_236, style=label.style_none, size=size.normal, color=close > inner_level_236 ? support_color : resistance_color, textcolor=close > inner_level_236 ? support_color : resistance_color, text=".236 | " + str.format("{0,number,currency}", inner_level_236)) inner_label_328 := label.new(x=bar_index + 20, y=inner_level_328, style=label.style_none, size=size.normal, color=close > inner_level_328 ? support_color : resistance_color, textcolor=close > inner_level_328 ? support_color : resistance_color, text=".328 | " + str.format("{0,number,currency}", inner_level_328)) inner_label_500 := label.new(x=bar_index + 20, y=inner_level_500, style=label.style_none, size=size.normal, color=close > inner_level_500 ? support_color : resistance_color, textcolor=close > inner_level_500 ? support_color : resistance_color, text=".500 | " + str.format("{0,number,currency}", inner_level_500)) inner_label_618 := label.new(x=bar_index + 20, y=inner_level_618, style=label.style_none, size=size.normal, color=close > inner_level_618 ? support_color : resistance_color, textcolor=close > inner_level_618 ? support_color : resistance_color, text=".618 | " + str.format("{0,number,currency}", inner_level_618)) inner_label_650 := label.new(x=bar_index + 20, y=inner_level_650, style=label.style_none, size=size.normal, color=close > inner_level_650 ? support_color : resistance_color, textcolor=close > inner_level_650 ? support_color : resistance_color, text=".650 | " + str.format("{0,number,currency}", inner_level_650)) inner_label_786 := label.new(x=bar_index + 20, y=inner_level_786, style=label.style_none, size=size.normal, color=close > inner_level_786 ? support_color : resistance_color, textcolor=close > inner_level_786 ? support_color : resistance_color, text=".786 | " + str.format("{0,number,currency}", inner_level_786))
Ehlers Adaptive Relative Strength Index (RSI) [Loxx]
https://www.tradingview.com/script/2egHQR7U-Ehlers-Adaptive-Relative-Strength-Index-RSI-Loxx/
loxx
https://www.tradingview.com/u/loxx/
49
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Ehlers Adaptive Relative Strength Index (RSI) [Loxx]", overlay = false, shorttitle="EARSIA [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 //sqrt 2 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) [_out, _c1, _c2, _c3] _auto_dom(src, min_len, max_len, ave_len) => var c = 2 * math.pi var s = 1.414 //sqrt 2 avglen = ave_len [filt, _, _, _] = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0 Sy = 0.0 Sxx = 0.0 Syy = 0.0 Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 maxpwr := 0.991 * maxpwr for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 if maxpwr != 0 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) spx = 0.0 sp = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) >= 0.5 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle = 0.0 dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := math.min(math.max(dominantcycle, min_len), max_len) dominantcycle auto_src = input.source(close, title='Auto Source', group = "Autocorrelation") auto_min = input.int(10, minval = 1, title='Auto Min Length', group = "Autocorrelation") auto_max = input.int(48, minval = 1, title='Auto Max Length', group = "Autocorrelation") auto_avg = input.int(3, minval = 1, title='Auto Average Length', group = "Autocorrelation") [filt, c1, c2, c3] = _f_ess(_f_hp(auto_src, auto_max), auto_min) masterdom = _auto_dom(auto_src, auto_min, auto_max, auto_avg) len_out_bp_rsi = masterdom < 1 ? 1 : masterdom cup = 0.0 cdn = 0.0 for i = 0 to int(len_out_bp_rsi / 2 - 1) by 1 if filt[i] > filt[i + 1] cup := cup + (filt[i] - filt[i + 1]) if filt[i] < filt[i + 1] cdn := cdn + (filt[i + 1] - filt[i]) denom = cup + cdn rsiout = 0.0 if denom != 0 and denom[1] != 0 rsiout := c1 * (cup / denom + cup[1] / denom[1]) / 2 + c2 * rsiout[1] + c3 * rsiout[2] plot(rsiout, color = rsiout > rsiout[1] ? greencolor : redcolor, linewidth = 3) plot(0.8, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Overbought") plot(0.5, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Middle") plot(0.2, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Oversold")
Strength Vs. BTC (SMA)
https://www.tradingview.com/script/r8nXzcPl-Strength-Vs-BTC-SMA/
rydawglv24
https://www.tradingview.com/u/rydawglv24/
13
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© rydawglv24 //@version=5 indicator("Strength Vs. BTC (SMA)") btc = input.symbol("BYBIT:BTCUSDT", title = "Compare To") period = input("5", title = "timeframe") candleAmount = input(100,title = "Number Of Candles to Include in Avg." ) upColor = input(color.green, title = "Up Color") downColor = input(color.red, title = "Down Color") float candleSum = 0 float candleAvg = 0 float btcCandleSum = 0 float btcCandleAvg = 0 float lowCandleSum = 0 float lowCandleAvg = 0 float lowBtcCandleSum = 0 float lowBtcCandleAvg = 0 thisHigh = request.security(syminfo.tickerid, period, high) btcHigh = request.security(btc, period, high) btcLow = request.security(btc, period, low) for i=1 to candleAmount candleSum:= candleSum + thisHigh[i] btcCandleSum:= btcCandleSum + btcHigh[i] if i == candleAmount candleAvg:= candleSum / candleAmount btcCandleAvg:= btcCandleSum / candleAmount pairPCT = (thisHigh - candleAvg) / thisHigh btcPCT = (btcHigh - btcCandleAvg) / btcHigh // for i=1 to candleAmount // lowCandleSum:= lowCandleSum + low[i] // lowBtcCandleSum:= lowBtcCandleSum + btcLow[i] // if i == candleAmount // lowCandleAvg:= lowCandleSum / candleAmount // lowBtcCandleAvg:= lowBtcCandleSum / candleAmount // lowPairPCT = (candleAvg - low) / candleAvg // lowBtcPCT = (lowBtcCandleAvg - btcLow) / lowBtcCandleAvg // highDif = pairPCT - btcPCT // lowDif = lowPairPCT - lowBtcPCT plotColor = color.gray plotPCT = (pairPCT - btcPCT) * 100 if plotPCT < 0 plotColor := downColor if plotPCT > 0 plotColor := upColor plot(0, color=color.gray) plot(plotPCT, color=plotColor) // plot((lowPairPCT - lowBtcPCT) * -100, color=color.red)
Adaptive, Relative Strength EMA (RSEMA) [Loxx]
https://www.tradingview.com/script/NDKH8KHK-Adaptive-Relative-Strength-EMA-RSEMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
88
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Adaptive, Relative Strength EMA (RSEMA) [Loxx]", overlay = true, shorttitle="ARSEMA [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 3000) greencolor = #2DD204 redcolor = #D2042D f1(m) => m >= 0.0 ? m : 0.0 f2(m) => m >= 0.0 ? 0.0 : -m _chande(mom, len) => m1 = f1(mom) m2 = f2(mom) cup = 0.0 cdn = 0.0 for i = 0 to len-1 by 1 cup := cup + m1[i] cdn := cdn + m2[i] [cup, cdn] _jurik_mom(src, len)=> suma = 0.0, sumb = 0.0, sumwa = 0.0, sumwb = 0.0 for k = 0 to len by 1 weight = len - k suma += src[k] * weight sumb += src[k] * weight * weight sumwa += weight sumwb += weight * weight out = sumb/sumwb - suma/sumwa [cup, cdn] = _chande(out, len) [cup, cdn] _wild(src) => cup = math.max(src - src[1], 0) cdn = math.max(src[1] - src, 0) [cup, cdn] rsema(float source = close, int emaPeriod = 50, int rsPeriod = 50, float multiplier = 10.0, string type = "Wilder") => mltp1 = 2.0 / (emaPeriod + 1.0) coef1 = 2.0 / (rsPeriod + 1.0) coef2 = 1.0 - coef1 [cupw, cdnw] = _wild(source) [cupj, cdnj] = _jurik_mom(source, rsPeriod) [cupc, cdnc] = _chande(ta.change(source), rsPeriod) cup = type == "Wilder Momentum" ? cupw : type == "Jurik Momentum" ? cupj : cupc cdn = type == "Wilder Momentum" ? cdnw : type == "Jurik Momentum" ? cdnj : cdnc acup = 0.0 acup := coef1 * cup + coef2 * nz(acup[1]) acdn = 0.0 acdn := coef1 * cdn + coef2 * nz(acdn[1]) rs = math.abs(acup - acdn) / (acup + acdn) multmor = multiplier rate = mltp1 * (1.0 + rs * multmor) rsma = 0.0 rsma := rate * source + (1.0 - rate) * nz(rsma[1], source) rsma _f_hp(_src, max_len) => var c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, _len) => var s = 1.414 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom(src, min_len, max_len, ave_len, mult) => var c = 2 * math.pi var s = 1.414 avglen = ave_len filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = avglen == 0 ? lag : avglen Sx = 0.0 Sy = 0.0 Sxx = 0.0 Syy = 0.0 Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) dominantcycle = 0.0 peakpwr = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0 sp = 0.0 for period = min_len to max_len by 1 if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) if sp != 0 dominantcycle := spx / sp if sp < 0.25 dominantcycle := dominantcycle[1] if dominantcycle < 1 dominantcycle := 1 dom_in = math.min(math.max(dominantcycle, min_len), max_len) * mult dom_in src = input.source(close, 'RS and EMA Source', group = "Basic Settings") type = input.string("Wilder Momentum", "RS Type", options = ["Jurik Momentum", "Chande Momentum", "Wilder Momentum"], group = "Basic Settings") adaptOn = input.string("Fixed", "RS and EMA Period Input Type", options = ["Fixed", "VHF Adaptive", "Autocorrelation Adaptive"], group = "Basic Settings") periods = input.int(50, 'EMA Length', minval=14, group = "Basic Settings") per_in = input.int(50, 'RS Length', minval=4, group = "Basic Settings") mltp = input.int(10, 'RS Multiplier', minval=0, group = "Basic Settings") auto_src = input.source(close, title='Auto Source', group = "Autocorrelation") auto_min = input.int(25, minval = 1, title='Auto Min Length', group = "Autocorrelation") auto_max = input.int(70, minval = 1, title='Auto Max Length', group = "Autocorrelation") auto_avg = input.int(50, minval = 1, title='Auto Average Length', group = "Autocorrelation") vmaxrsi = ta.highest(src, per_in) vminrsi = ta.lowest(src, per_in) noisersi = math.sum(math.abs(ta.change(src)), per_in) vhfrsi = math.abs(vmaxrsi - vminrsi) / noisersi vhfperiodrsi = math.floor(-math.log(vhfrsi) * per_in) vhfperiodrsi := nz(vhfperiodrsi) < 1 ? 1 : nz(vhfperiodrsi) vmaxema = ta.highest(src, periods) vminema = ta.lowest(src, periods) noiseema = math.sum(math.abs(ta.change(src)), periods) vhfema = math.abs(vmaxema - vminema) / noiseema vhfperiodema = math.floor(-math.log(vhfema) * periods) vhfperiodema := nz(vhfperiodema) < 1 ? 1 : nz(vhfperiodema) masterdom = _auto_dom(auto_src, auto_min, auto_max, auto_avg, 1) masterdom := int(masterdom) < 1 ? 1 : int(masterdom) rsiPeriod = adaptOn == "Fixed" ? per_in : adaptOn == "VHF Adaptive" ? vhfperiodrsi : int(masterdom) emaPeriod = adaptOn == "Fixed" ? periods : adaptOn == "VHF Adaptive" ? vhfperiodema : int(masterdom) rsema = rsema(src, emaPeriod, rsiPeriod, mltp, type) plot(rsema, color = close > rsema ? greencolor : redcolor, linewidth = 3) plotchar(int(masterdom), "Auto Dom Cyle Length", char = "", location = location.top)
Buy/Sell Signals
https://www.tradingview.com/script/VubFLJdx-Buy-Sell-Signals/
TradingTail
https://www.tradingview.com/u/TradingTail/
353
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© mayurssupe //@version=5 indicator("Buy & Sell Signals",overlay=true,shorttitle="Tail Signals") //colors signal1 = input.bool(defval=false,title="Buy Sell Signals",group="Options",tooltip="Works on Every Ticker") _filterSignals = input.bool(defval=true,title="Supertrend with ATR ",group="Options",tooltip="Detect Signals Based on Supertrend & ATR Only works on higher tf") _snakeLine =input.bool(defval=false,title="Stoploss",group="Options",tooltip = "Stoploss line is use to maintain stoploss and not get hit by operator, accurancy : 60%") //colors color1 = input.color(color.aqua ,title="Long Color",group="Colors") color2 = input.color(#e91e63,title="Short Color",group="Colors") //atr Period for Stoploss Line atrPeriod = input.int(defval = 10 , minval = 10,maxval = 100,step = 2,title="Stoploss Period",group = "Inputs",tooltip = "Atr Value : Default to 10") _suptf = input.timeframe(defval="",title="Set Default Timeframe of Signals on Chart",group="Timeframe") //---------------------// //Custom Security Function fsec(exp) => request.security(ticker.heikinashi(syminfo.tickerid),_suptf,exp,gaps=barmerge.gaps_on,lookahead=barmerge.lookahead_off) symsec(tf,exp)=> request.security(syminfo.tickerid,tf,exp) //Green/Red Bar greenBar =close > open redBar = close < open //------------ // Reversal using Arnold Legoux MA var color pink = #e91e63 var color white = color.white var color aqua = color.aqua //Supertrend var int atrlen = 14 var int multi = 2 //0.8 and 1.6 factor var int exp1 = 9 var int exp2 =21 var int rsiPeriod = 9 //RSI Zones var int zone1 = 70 var int zone2 = 30 //BANKNIFTY1! rsi = ta.rsi(hlc3,rsiPeriod) //rsi rsiB = rsi < zone1 rsiS = rsi > zone2 //Supertrend Indicator using EMA crossover 9,13 [supertrend,direction] = ta.supertrend(multi,atrlen) _neckLine = ta.ema(ta.sma(hl2,14),14) atr1 = ta.rma(ta.tr(true),14) p1 = ta.crossover(hl2,supertrend) and rsiB p2 = ta.crossunder(hl2,supertrend) and rsiS //Boolean Conditions longSup = barstate.isconfirmed and fsec(p1) and hl2 > _neckLine shortSup =barstate.isconfirmed and fsec(p2) and hl2 < _neckLine has_longsup = longSup ? 1 : 0 has_shortsup = shortSup ? 1 : 0 bar_index_has = signal1 ? ta.valuewhen(has_longsup,bar_index,0) : na high_value_has = signal1 ? ta.valuewhen(has_longsup,high,0) : na bar_down = signal1 ? ta.valuewhen(has_shortsup,bar_index,0) : na low_sup = signal1 ? ta.valuewhen(has_shortsup,low,0) : na //LongSup line1 = line.new(bar_index_has,high_value_has,bar_index_has + 1 ,high_value_has,color=color.green,extend=extend.right,width=3) line.delete(line1[1]) //ShortSup line2 = line.new(bar_down,low_sup,bar_down + 1 ,low_sup,color=color.red,extend=extend.right,width=3) line.delete(line2[1]) plotshape(signal1 and longSup ? longSup : 0,title="Long",style=shape.labelup,text="Buy",textcolor=color.white,color=color1,location=location.belowbar) plotshape(signal1 and shortSup ? shortSup : 0,title="Short",style=shape.labeldown,text="Sell",textcolor=color.white,color=color2,location=location.abovebar) //average true range [sup1,direction1] = ta.supertrend(0.8,14) [sup2,direction2] = ta.supertrend(1.6,21) supcross =fsec(ta.crossover(sup1,sup2) and timeframe.isintraday) and hl2 > _neckLine supunder =fsec(ta.crossunder(sup1,sup2) and timeframe.isintraday) and hl2 < _neckLine if(_filterSignals == true) signal1:=false else signal1:=true plotshape(_filterSignals and supcross[1] ? supcross[1] : 0,title="Buy",style=shape.labelup,text="Long",textcolor=color.white,color=color1,location=location.belowbar) plotshape(_filterSignals and supunder[1] ? supunder[1] : 0,title="Sell",style=shape.labeldown,text="Short",textcolor=color.white,color=color2,location=location.abovebar) //Stoploss ma20 = ta.ema(ta.sma(hl2,14) , 14) atrstop = ta.rma(ta.tr(true),atrPeriod) stopLoss = close > ma20 ? (low - atrstop) : close < ma20 ? (high + atrstop) : na plot(_snakeLine and stopLoss ? stopLoss : 2,style = plot.style_stepline,color=color.rgb(255, 209, 56),title = "SnakeLine StoplossH")
RSI + CCI INDICATOR
https://www.tradingview.com/script/nRtmWoYd-RSI-CCI-INDICATOR/
saurabhbrokerwala
https://www.tradingview.com/u/saurabhbrokerwala/
45
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© saurabhbrokerwala //@version=5 indicator("RSI + CCI INDICATOR", overlay = true) //INPUT CONTROLS L_RSI = input.int(title = "rsi", defval = 14, minval = 1, maxval = 30, step = 1 ) L_CCI = input.int(title = "CCI", defval = 20, minval = 1, maxval = 30, step = 1 ) // TRADING INDICATORS RSI = ta.rsi(close,L_RSI) /// 14 period RSI CCI = ta.cci((high+low+close)/3,L_CCI) // 20 period CCI /// BUY AND SELL RULES BUY = ta.crossover(RSI,50) and ta.crossover(CCI,+10) SELL = ta.crossunder(RSI,49) and ta.crossunder(CCI,-10) plotshape(BUY , title = "buy", text = "BUYSIGNAL", color = color.new(color.green,0), style = shape.triangleup, textcolor = color.white, location = location.belowbar, size = size.small) plotshape(SELL , title = "sell", text = "SELLSIGNAL", color = color.new(color.red,0), style = shape.triangledown, textcolor = color.white, location = location.abovebar, size = size.small)
Ehlers Autocorrelation Periodogram [Loxx]
https://www.tradingview.com/script/df3Ofxvr-Ehlers-Autocorrelation-Periodogram-Loxx/
loxx
https://www.tradingview.com/u/loxx/
67
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© rumpypumpydumpy //@version=5 indicator('Ehlers Autocorrelation Periodogram [Loxx]', shorttitle = "EAP [Loxx]", overlay=false, max_bars_back = 3000, timeframe="", timeframe_gaps=true) book = "2013, Cycle Analytics for Traders" tasc = "2016, TASC September" impin = input.string(tasc, "Version of Autocorrelation Periodogram Algorithm", options = [book, tasc], group = "Basic Settings") auto_src = input.source(close, "Auto Source", group = "Basic Settings") auto_min = input.int(10, title='Auto Minnimum Length',minval = 1, tooltip = "Default values should be 8, 9, or 10. Very rarely would you change this value.", group = "Basic Settings") auto_max = input.int(48, title='Auto Maximum Length', minval = 1, tooltip = "Default value is 48. Very rarely would you change this value.", group = "Basic Settings") auto_avg = input.int(3, title='Auto Average Length', minval = 1, tooltip = "Default value is 3. Very rarely would you change this value.", group = "Basic Settings") enhances = input.bool(false, title='Enhance Resolution?', group = "UI Options") widthin = input.int(9, "Line width of thermo plot", group = "UI Options") _f_hp(_src, int max_len) => c = 360 * math.pi / 180 _alpha = (1 - math.sin(c / max_len)) / math.cos(c / max_len) _hp = 0.0 _hp := 0.5 * (1 + _alpha) * (_src - nz(_src[1])) + _alpha * nz(_hp[1]) _hp _f_ess(_src, int _len) => s = 1.414 //sqrt 2 _a = math.exp(-s * math.pi / _len) _b = 2 * _a * math.cos(s * math.pi / _len) _c2 = _b _c3 = -_a * _a _c1 = 1 - _c2 - _c3 _out = 0.0 _out := _c1 * (_src + nz(_src[1])) / 2 + _c2 * nz(_out[1], nz(_src[1], _src)) + _c3 * nz(_out[2], nz(_src[2], nz(_src[1], _src))) _out _auto_dom_imp(src, min_len, max_len, ave_len, imp) => c = 2 * math.pi s = 1.414 filt = _f_ess(_f_hp(src, max_len), min_len) arr_size = max_len * 2 var corr = array.new_float(arr_size, initial_value=0) var cospart = array.new_float(arr_size, initial_value=0) var sinpart = array.new_float(arr_size, initial_value=0) var sqsum = array.new_float(arr_size, initial_value=0) var r1 = array.new_float(arr_size, initial_value=0) var r2 = array.new_float(arr_size, initial_value=0) var pwr = array.new_float(arr_size, initial_value=0) for lag = 0 to max_len by 1 m = ave_len == 0 ? lag : ave_len Sx = 0.0 Sy = 0.0 Sxx = 0.0 Syy = 0.0 Sxy = 0.0 for i = 0 to m - 1 by 1 x = nz(filt[i]) y = nz(filt[lag + i]) Sx += x Sy += y Sxx += x * x Sxy += x * y Syy += y * y Syy if (m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy) > 0 array.set(corr, lag, (m * Sxy - Sx * Sy) / math.sqrt((m * Sxx - Sx * Sx) * (m * Syy - Sy * Sy))) for period = min_len to max_len by 1 array.set(cospart, period, 0) array.set(sinpart, period, 0) for n = ave_len to max_len by 1 array.set(cospart, period, nz(array.get(cospart, period)) + nz(array.get(corr, n)) * math.cos(c * n / period)) array.set(sinpart, period, nz(array.get(sinpart, period)) + nz(array.get(corr, n)) * math.sin(c * n / period)) array.set(sqsum, period, math.pow(nz(array.get(cospart, period)), 2) + math.pow(nz(array.get(sinpart, period)), 2)) for period = min_len to max_len by 1 array.set(r2, period, nz(array.get(r1, period))) array.set(r1, period, 0.2 * math.pow(nz(array.get(sqsum, period)), 2) + 0.8 * nz(array.get(r2, period))) maxpwr = 0.0 if imp == book maxpwr := 0.995 * maxpwr for period = min_len to max_len by 1 if nz(array.get(r1, period)) > maxpwr maxpwr := nz(array.get(r1, period)) for period = ave_len to max_len by 1 array.set(pwr, period, nz(array.get(r1, period)) / maxpwr) peakpwr = 0.0 for period = min_len to max_len by 1 if imp != book if nz(array.get(pwr, period)) > peakpwr peakpwr := nz(array.get(pwr, period)) spx = 0.0 sp = 0.0 for period = min_len to max_len by 1 if nz(array.get(pwr, period)) >= 0.5 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) for period = min_len to max_len by 1 if imp != book if peakpwr >= 0.25 and nz(array.get(pwr, period)) >= 0.25 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) else if nz(array.get(pwr, period)) >= 0.5 spx += period * nz(array.get(pwr, period)) sp += nz(array.get(pwr, period)) dominantcycle = 0.0 if imp == book dominantcycle := sp != 0 ? spx / sp : dominantcycle else dominantcycle := sp != 0 ? spx / sp : dominantcycle dominantcycle := sp < 0.25 ? dominantcycle[1] : dominantcycle dominantcycle := dominantcycle < 1 ? 1 : dominantcycle for period = min_len to max_len by 1 if enhances array.set(pwr, period, math.pow(nz(array.get(pwr, period)), 2)) [dominantcycle, pwr] [masterdom, normpwr] = _auto_dom_imp(auto_src, auto_min, auto_max, auto_avg, impin) //inverse of @RicardoSantos' JohnEhlersFourierTransformlibrary _pwr_to_rgb(db, transparency) => //{ if db > 0.5 color.rgb(255.0, 255.0* (2 * db - 1), 0.0, transparency) else color.rgb(255.0 * db , 0.0, 0.0, transparency) bgcolor(color.rgb(0,0,0,0)) auto_min_out = auto_min -1 plot(auto_min_out + 00, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 00), 0.0), linewidth = widthin) plot(auto_min_out + 02, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 02), 0.0), linewidth = widthin) plot(auto_min_out + 04, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 04), 0.0), linewidth = widthin) plot(auto_min_out + 06, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 06), 0.0), linewidth = widthin) plot(auto_min_out + 08, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 08), 0.0), linewidth = widthin) plot(auto_min_out + 10, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 10), 0.0), linewidth = widthin) plot(auto_min_out + 12, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 12), 0.0), linewidth = widthin) plot(auto_min_out + 14, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 14), 0.0), linewidth = widthin) plot(auto_min_out + 16, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 16), 0.0), linewidth = widthin) plot(auto_min_out + 18, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 18), 0.0), linewidth = widthin) plot(auto_min_out + 20, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 20), 0.0), linewidth = widthin) plot(auto_min_out + 22, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 22), 0.0), linewidth = widthin) plot(auto_min_out + 24, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 24), 0.0), linewidth = widthin) plot(auto_min_out + 26, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 26), 0.0), linewidth = widthin) plot(auto_min_out + 28, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 28), 0.0), linewidth = widthin) plot(auto_min_out + 30, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 30), 0.0), linewidth = widthin) plot(auto_min_out + 32, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 32), 0.0), linewidth = widthin) plot(auto_min_out + 34, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 34), 0.0), linewidth = widthin) plot(auto_min_out + 36, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 36), 0.0), linewidth = widthin) plot(auto_min_out + 38, color = _pwr_to_rgb(array.get(normpwr, auto_min_out + 38), 0.0), linewidth = widthin) plot(masterdom, linewidth = 5, color = #00008b, title="Dominant Cycle Outline") plot(masterdom, linewidth = 1, color = color.white, title="Dominant Cycle Line")
CCI BARS
https://www.tradingview.com/script/LdV6gzZ9-CCI-BARS/
x10140
https://www.tradingview.com/u/x10140/
52
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© peacefulToucan67678 //@version=5 indicator("CCI BARS", overlay=true) Source = input.source(hlc3) Length = input.int(20) cci = ta.cci(Source, Length) color_0 = #00332a color_1 = #056656 color_2 = #22ab94 color_3 = #42bda8 color_4 = #ace5dc color_5 = #faa1a4 color_6 = #f77c80 color_7 = #f7525f color_8 = #b22833 color_9 = #801922 barcolor(cci < -250 ? color_0 : cci > -250 and cci <= -225 ? color_0 : cci > -225 and cci <= -200 ? color_1 :cci > -200 and cci <= -175 ? color_1 :cci > -175 and cci <= -150 ? color_2 :cci > -150 and cci <= -125 ? color_2 :cci > -125 and cci <= -100 ? color_3 :cci > -100 and cci <= -75 ? color_3 :cci > -75 and cci <= -50 ? color_4 :cci > -50 and cci <= 0 ? color_4 :cci > 0 and cci <= 50 ? color_5 :cci > 50 and cci <= 75 ? color_5 :cci > 75 and cci <= 100 ? color_6 :cci > 100 and cci <= 125 ? color_6 :cci > 125 and cci <= 150 ? color_7 :cci > 150 and cci <= 175 ? color_7 :cci > 175 and cci <= 200 ? color_8 :cci > 200 and cci <= 225 ? color_8 :cci > 225 and cci <= 250 ? color_9 :cci > 250 ? color_9:na)
pineCalc- Calculator for Pine
https://www.tradingview.com/script/i9AuxJxC-pineCalc-Calculator-for-Pine/
Toshi-Toshi-Shiba
https://www.tradingview.com/u/Toshi-Toshi-Shiba/
5
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Toshi-Toshi-Shiba //@version=5 indicator("pineCalc- Calculator for Pine",overlay=true) mathType= input.string("Add",options=["Add","Subtract","Divide","Multiply","Modulo"]) float numberToAdd1= input.float(0.0) float numberToAdd2= input.float(0.0) calculator(num1,num2) => switch mathType "Add" => calculation= math.round(num1 + num2,4) "Subtract" => calculation= math.round(num1 - num2,4) "Divide" => calculation= math.round(num1 / num2,4) "Multiply" => calculation= math.round(num1 * num2,4) "Modulo" => calculation= math.round(num1 % num2,4) addedValue= calculator(num1=numberToAdd1,num2=numberToAdd2) number1String= str.tostring(numberToAdd1) number2String= str.tostring(numberToAdd2) calculatorValueString= str.tostring(addedValue) //PLOT GRAPHICAL USER INTERFACE AS TABLE calculatorGui= table.new(position=position.top_right,columns=2,rows=5,bgcolor=#000000,frame_color=color.gray,border_color=color.gray,border_width=3,frame_width=3) table.cell(calculatorGui,column=0,row=0,text="pineCalc",text_color=color.yellow,text_size=size.normal) table.cell(calculatorGui,column=0,row=1,text="Math Type: ",text_color=color.white) table.cell(calculatorGui,column=0,row=2,text="Number to " + mathType + " 1 ",text_color=color.white) table.cell(calculatorGui,column=0,row=3,text="Number to " + mathType + " 2 ",text_color=color.white) table.cell(calculatorGui,column=0,row=4,text="Math Result: ",text_color=color.green) table.cell(calculatorGui,column=1,row=0,text=" v1.0 ",text_color=color.yellow,text_size=size.normal) table.cell(calculatorGui,column=1,row=1,text=mathType,text_color=color.white) table.cell(calculatorGui,column=1,row=2,text=number1String,text_color=color.white) table.cell(calculatorGui,column=1,row=3,text=number2String,text_color=color.white) table.cell(calculatorGui,column=1,row=4,text=calculatorValueString,text_color=color.green) // PYTHON CODE // // // def calculatorAdding(num1,num2) : // if mathType == "Add" : // calculation= num1 + num2 // elif mathType == "Subtract" // calculation= num1 - num2 // // return calculation // // print(calculatorAdding(numberToAdd1,numberToAdd2) //
EPS Table
https://www.tradingview.com/script/2JH1i9P8-EPS-Table/
ARUN_SAXENA
https://www.tradingview.com/u/ARUN_SAXENA/
40
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© ARUN_SAXENA //@version=5 indicator("EPS & revenue", overlay=false) var table epsTable = table.new(position.top_left, 15, 15, border_width=2) lightTransp = 90 avgTransp = 80 heavyTransp = 70 // === USER INPUTS === i_posColor = input(color.rgb(38, 166, 154), title='Positive Color') i_negColor = input(color.rgb(240, 83, 80), title='Negative Color') // i_volColor = input(color.new(#999999, 0), title='Neutral Color') // === FUNCTIONS AND CALCULATIONS === // Current earnings per share EPS = request.financial(syminfo.tickerid, "EARNINGS_PER_SHARE", "FQ") SALES = request.financial(syminfo.tickerid, "TOTAL_REVENUE", "FQ") // Function to define previous quarters' earnings per share f_eps(i) => request.security(syminfo.tickerid, '1M', EPS[i]) f_sales(i) => request.security(syminfo.tickerid, '1M', SALES[i]) // Year over year percentage change EPS EPSyoy = (EPS-f_eps(12))/math.abs(f_eps(12))*100 ChangeCurrent = (EPS-f_eps(13))/math.abs(f_eps(13))*100 Change4 = (f_eps(4)-f_eps(16))/math.abs(f_eps(16))*100 Change7 = (f_eps(7)-f_eps(19))/math.abs(f_eps(19))*100 Change10 = (f_eps(10)-f_eps(22))/math.abs(f_eps(22))*100 Change13 = (f_eps(13)-f_eps(25))/math.abs(f_eps(25))*100 //for Sales data SalesCurrent1 = (SALES/10000000) Sales41 = (f_sales(4)/10000000) Sales71 = (f_sales(7)/10000000) Sales101 = (f_sales(10)/10000000) Sales131 = (f_sales(13)/10000000) Sales151 = (f_sales(15)/10000000) SalesCurrent = (SALES-f_sales(13))/math.abs(f_sales(13))*100 Sales4 = (f_sales(4)-f_sales(16))/math.abs(f_sales(16))*100 Sales7 = (f_sales(7)-f_sales(19))/math.abs(f_sales(19))*100 Sales10 = (f_sales(10)-f_sales(22))/math.abs(f_sales(22))*100 Sales13 = (f_sales(13)-f_sales(25))/math.abs(f_sales(25))*100 // === TABLE FUNCTIONS === f_fillCell(_table, _column, _row, _value) => _c_color = _value >= 0 ? i_posColor : i_negColor _transp = math.abs(_value) > 3 ? heavyTransp : math.abs(_value) > 1 ? avgTransp : lightTransp _cellText = str.tostring(_value, '0.0') table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, _transp), text_color=_c_color,text_size=size.small) f_fillCellComp(_table, _column, _row, _value) => _c_color = _value >= 0 ? i_posColor : i_negColor _transp = math.abs(_value) > 60 ? heavyTransp : math.abs(_value) > 20 ? avgTransp : lightTransp //_cellText = str.tostring(_value, '0') + _text _cellText = str.tostring(_value, '0') + '%' table.cell(_table, _column, _row, _cellText, bgcolor=color.new(_c_color, _transp), text_color=_c_color,text_size=size.small) //oneQperf = (EPS-f_eps(4))/math.abs(f_eps(4))*100 //twoQperf = (f_eps(4)-f_eps(7))/math.abs(f_eps(7))*100 //threeQperf = (f_eps(7)-f_eps(10))/math.abs(f_eps(10))*100 //avgPerf = math.avg(oneQperf, twoQperf, threeQperf) // Display table if barstate.islast f_fillCell(epsTable, 1, 10, f_eps(13)) f_fillCell(epsTable, 1, 9, f_eps(10)) f_fillCell(epsTable, 1, 8, f_eps(7)) f_fillCell(epsTable, 1, 7, f_eps(4)) f_fillCell(epsTable, 1, 6, EPS) // QoQ change f_fillCellComp(epsTable, 2, 6, ChangeCurrent) f_fillCellComp(epsTable, 2, 7, Change4) f_fillCellComp(epsTable, 2, 8, Change7) f_fillCellComp(epsTable, 2, 9, Change10) f_fillCellComp(epsTable, 2, 10, Change13) //f_fillCell(epsTable, 1, 1, EPS) //for sales f_fillCell(epsTable, 3, 10, Sales131) f_fillCell(epsTable, 3, 9, Sales101) f_fillCell(epsTable, 3, 8, Sales71) f_fillCell(epsTable, 3, 7, Sales41) f_fillCell(epsTable, 3, 6, SalesCurrent1) // QoQ change f_fillCellComp(epsTable, 4, 6, SalesCurrent) f_fillCellComp(epsTable, 4, 7, Sales4) f_fillCellComp(epsTable, 4, 8, Sales7) f_fillCellComp(epsTable, 4, 9, Sales10) f_fillCellComp(epsTable, 4, 10, Sales13) //f_fillCell(epsTable, 1, 1, SALES) txt5 = "MAR-21" txt4 = "JUN-21" txt3 = "SEP-21" txt2 = "DEC-21" txt1 = "MAR-22 " txt6 = "% CHANGE" txt0 = " " //txt5 = "IY BACK" //txt4 = "3Q BACK" //txt3 = "2Q BACK" //txt2 = "1Q BACK" //txt1 = "CURRENT Q " //txt6 = "QoQ CHANGE" //txt0 = " " //FOR HEADINGS txt8 = "QTR" txt9 = " EPS " txt10 = "SALES(IN Cr.)" txt11 = "% CHANGE" //orignal table.cell(epsTable,0,6, text=txt1, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,0,7, text=txt2, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,0,8, text=txt3, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,0,9, text=txt4, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,0,10, text=txt5, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,2,5, text=txt6, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) //table.cell(epsTable,0,7, text=txt7, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,width=5,height=3) table.cell(epsTable,0,5, text=txt8, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,1,5, text=txt9, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) //SALES HEADING table.cell(epsTable,3,5, text=txt10, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,4,5, text=txt11, bgcolor=color.rgb(0,0,40,80), text_color=color.blue,text_size=size.small) table.cell(epsTable,0,0, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,text_size=size.small) //table.cell(epsTable,0,1, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,width=5,height=3) table.cell(epsTable,1,1, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,text_size=size.small) //table.cell(epsTable,1,1, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,width=5,height=3) table.cell(epsTable,2,2, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,text_size=size.small) table.cell(epsTable,2,3, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,text_size=size.small) //table.cell(epsTable,2,4, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,text_size=size.small) table.cell(epsTable,2,0, text=txt0, bgcolor=color.rgb(0,0,0,100), text_color=color.blue,text_size=size.small)
RSX of Double MACD [Loxx]
https://www.tradingview.com/script/6J43GXgb-RSX-of-Double-MACD-Loxx/
loxx
https://www.tradingview.com/u/loxx/
79
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("RSX of Double MACD [Loxx]", overlay = false, shorttitle="RSXDMACD [Loxx]", timeframe="", timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D _rsx_rsi(src, len)=> src_out = 100 * src mom0 = ta.change(src_out) moa0 = math.abs(mom0) Kg = 3 / (len + 2) Hg = 1 - Kg //mom f28 = 0.0, f30 = 0.0 f28 := Kg * mom0 + Hg * nz(f28[1]) f30 := Hg * nz(f30[1]) + Kg * f28 mom1 = f28 * 1.5 - f30 * 0.5 f38 = 0.0, f40 = 0.0 f38 := Hg * nz(f38[1]) + Kg * mom1 f40 := Kg * f38 + Hg * nz(f40[1]) mom2 = f38 * 1.5 - f40 * 0.5 f48 = 0.0, f50 = 0.0 f48 := Hg * nz(f48[1]) + Kg * mom2 f50 := Kg * f48 + Hg * nz(f50[1]) mom_out = f48 * 1.5 - f50 * 0.5 //moa f58 = 0.0, f60 = 0.0 f58 := Hg * nz(f58[1]) + Kg * moa0 f60 := Kg * f58 + Hg * nz(f60[1]) moa1 = f58 * 1.5 - f60 * 0.5 f68 = 0.0, f70 = 0.0 f68 := Hg * nz(f68[1]) + Kg * moa1 f70 := Kg * f68 + Hg * nz(f70[1]) moa2 = f68 * 1.5 - f70 * 0.5 f78 = 0.0, f80 = 0.0 f78 := Hg * nz(f78[1]) + Kg * moa2 f80 := Kg * f78 + Hg * nz(f80[1]) moa_out = f78 * 1.5 - f80 * 0.5 rsiout = math.max(math.min((mom_out / moa_out + 1.0) * 50.0, 100.00), 0.00) rsiout src = input.source(close, "Source", group = "Basic Settings") len = input.int(25, "RSI Period", group = "Basic Settings") macdFast = input.int(12, "MACD Fast Length", group = "Basic Settings") macdSlow = input.int(26, "MACD Slow Length", group = "Basic Settings") overbought = input.int(100, "Overbought Level", group = "Basic Settings") oversold = input.int(0, "Oversold Level", group = "Basic Settings") colorbars = input.bool(false, "Color bars?", group = "UI Options") kg = (3.0) / (2.0 + len) hg = 1.0 - kg price = ta.sma(src, 1) mact = ta.ema(price, macdFast)-ta.ema(price, macdSlow) macd = ta.ema(mact, macdFast)-ta.ema(mact, macdSlow) wrkVar = macd rsx =_rsx_rsi(wrkVar, len) plot(rsx, color = rsx > rsx[1] ? greencolor : redcolor, linewidth = 2) plot(50, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero line") tl = plot(overbought, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "Overbought Level 2") tl1 = plot(overbought-5, color=color.rgb(0, 255, 255, 100), style=plot.style_line, title = "Overbought Level 1") bl1 = plot(oversold, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "Overbought Level 1") bl = plot(oversold+5, color=color.rgb(255, 255, 255, 100), style=plot.style_line, title = "Overbought Level 2") fill(tl, tl1, color=color.new(color.gray, 85), title = "Top Boundary Fill Color") fill(bl, bl1, color=color.new(color.gray, 85), title = "Bottom Boundary Fill Color") barcolor(colorbars ? rsx > rsx[1] ? greencolor : redcolor : na)
Aroon Oscillator of Adaptive RSI [Loxx]
https://www.tradingview.com/script/B6gxWodj-Aroon-Oscillator-of-Adaptive-RSI-Loxx/
loxx
https://www.tradingview.com/u/loxx/
77
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Aroon Oscillator of Adaptive RSI [Loxx]", shorttitle ="AO_ARSI [Loxx]", overlay = false, timeframe="", timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D RMA(x, t) => EMA1 = x EMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (1/t) + nz(EMA1[1]) EMA1 _rsx_rsi(src, len)=> f8 = 100 * src f10 = nz(f8[1]) v8 = f8 - f10 f18 = 3 / (len + 2) f20 = 1 - f18 f28 = 0.0 f28 := f20 * nz(f28[1]) + f18 * v8 f30 = 0.0 f30 := f18 * f28 + f20 * nz(f30[1]) vC = f28 * 1.5 - f30 * 0.5 f38 = 0.0 f38 := f20 * nz(f38[1]) + f18 * vC f40 = 0.0 f40 := f18 * f38 + f20 * nz(f40[1]) v10 = f38 * 1.5 - f40 * 0.5 f48 = 0.0 f48 := f20 * nz(f48[1]) + f18 * v10 f50 = 0.0 f50 := f18 * f48 + f20 * nz(f50[1]) v14 = f48 * 1.5 - f50 * 0.5 f58 = 0.0 f58 := f20 * nz(f58[1]) + f18 * math.abs(v8) f60 = 0.0 f60 := f18 * f58 + f20 * nz(f60[1]) v18 = f58 * 1.5 - f60 * 0.5 f68 = 0.0 f68 := f20 * nz(f68[1]) + f18 * v18 f70 = 0.0 f70 := f18 * f68 + f20 * nz(f70[1]) v1C = f68 * 1.5 - f70 * 0.5 f78 = 0.0 f78 := f20 * nz(f78[1]) + f18 * v1C f80 = 0.0 f80 := f18 * f78 + f20 * nz(f80[1]) v20 = f78 * 1.5 - f80 * 0.5 f88_ = 0.0 f90_ = 0.0 f88 = 0.0 f90_ := nz(f90_[1]) == 0 ? 1 : nz(f88[1]) <= nz(f90_[1]) ? nz(f88[1]) + 1 : nz(f90_[1]) + 1 f88 := nz(f90_[1]) == 0 and len - 1 >= 5 ? len - 1 : 5 f0 = f88 >= f90_ and f8 != f10 ? 1 : 0 f90 = f88 == f90_ and f0 == 0 ? 0 : f90_ v4_ = f88 < f90 and v20 > 0 ? (v14 / v20 + 1) * 50 : 50 rsx = v4_ > 100 ? 100 : v4_ < 0 ? 0 : v4_ rsx _wilders_rsi(x, y) => u = math.max(x - x[1], 0) d = math.max(x[1] - x, 0) rs = RMA(u, y) / RMA(d, y) res = 100 - 100 / (1 + rs) res _rapid_rsi(src, len)=> upSum = math.sum(math.max(ta.change(src), 0), len) dnSum = math.sum(math.max(-ta.change(src), 0), len) rrsi = dnSum == 0 ? 100 : upSum == 0 ? 0 : 100 - 100 / (1 + upSum / dnSum) rrsi _bpDom(len, bpw, mult) => HP = 0.0 BP = 0.0 Peak = 0.0 Real = 0.0 counter = 0.0 DC = 0.0 alpha2 = (math.cos(0.25 * bpw * 2 * math.pi / len) + math.sin(0.25 * bpw * 2 * math.pi / len) - 1) / math.cos(0.25 * bpw * 2 * math.pi / len) HP := (1 + alpha2 / 2) * (close - nz(close[1])) + (1 - alpha2) * nz(HP[1]) beta1 = math.cos(2 * math.pi / len) gamma1 = 1 / math.cos(2 * math.pi * bpw / len) alpha1 = gamma1 - math.sqrt(gamma1 * gamma1 - 1) BP := 0.5 * (1 - alpha1) * (HP - nz(HP[2])) + beta1 * (1 + alpha1) * nz(BP[1]) - alpha1 * nz(BP[2]) BP := bar_index == 1 or bar_index == 2 ? 0 : BP Peak := 0.991 * Peak Peak := math.abs(BP) > Peak ? math.abs(BP) : Peak Real := Peak != 0 ? BP / Peak : Real DC := nz(DC[1]) DC := DC < 6 ? 6 : DC counter := counter[1] + 1 if ta.crossover(Real, 0) or ta.crossunder(Real, 0) DC := 2 * counter if 2 * counter > 1.25 * nz(DC[1]) DC := 1.25 * DC[1] if 2 * counter < 0.8 * nz(DC[1]) DC := 0.8 * nz(DC[1]) counter := 0 temp_out = mult * DC temp_out rsiType = input.string("Wilders'", "RSI Type", options =["Wilders'", "RSX", "Rapid"], group = "Basic Settings") adaptOn = input.string("VHF Adaptive", "RSI Calculation Type", options = ["Fixed", "VHF Adaptive", "Band-pass Adaptive"], group = "Basic Settings") src = input.source(close, "Source", group = "Basic Settings") rsiPerIn = input.int(15, "RSI Period", group = "Basic Settings") AroonPeriod = input.int(15, "Aroon Period", group = "Basic Settings") bp_period = input.int(13, "Band-pass Period", minval = 1, group = "Band-pass") bp_width = input.float(0.20, "Band-pass Width", step = 0.1, group = "Band-pass") cyclelen = input.float(100, "Percent of Dominant Cycle (%)", step = 1.0, group = "Band-pass")/100 colorbars = input.bool(false, "Color bars?", group = "UI Options") vmax = ta.highest(src, rsiPerIn) vmin = ta.lowest(src, rsiPerIn) noise = math.sum(math.abs(ta.change(src)), rsiPerIn) vhf = math.abs(vmax - vmin) / noise len_out = int(nz(_bpDom(bp_period, bp_width, cyclelen), 1)) < 1 ? 1 : int(nz(_bpDom(bp_period, bp_width, cyclelen), 1)) rsiPeriod = adaptOn == "Fixed" ? rsiPerIn : adaptOn == "VHF Adaptive" ? int(-math.log(vhf) * rsiPerIn) : len_out rsiPeriod := nz(rsiPeriod) < 1 ? 1 : nz(rsiPeriod) rsi = rsiType == "Wilders'" ? _wilders_rsi(src, rsiPeriod) : rsiType == "Rapid" ? _rapid_rsi(src, rsiPeriod) : _rsx_rsi(src, rsiPeriod) upper = 100 * (ta.highestbars(rsi, AroonPeriod + 1) + AroonPeriod)/AroonPeriod lower = 100 * (ta.lowestbars(rsi, AroonPeriod + 1) + AroonPeriod)/AroonPeriod plot(upper - lower, "Lower", color = upper > lower ? greencolor : redcolor, linewidth = 2) barcolor(colorbars ? upper > lower ? greencolor : redcolor : na) plot(0, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero")
Jurik RSX on JMA [Loxx]
https://www.tradingview.com/script/0RC0Yw8v-Jurik-RSX-on-JMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
175
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Jurik RSX on JMA [Loxx]", overlay = false, shorttitle="JRSXJMA [Loxx]", timeframe="", timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D _a_jurik_filt(src, len, phase) => //static variales volty = 0.0, avolty = 0.0, vsum = 0.0, bsmax = src, bsmin = src len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0) len2 = math.sqrt(0.5 * (len - 1)) * len1 pow1 = math.max(len1 - 2.0, 0.5) beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2) div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100) phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : 1.5 + phase * 0.01 bet = len2 / (len2 + 1) //Price volatility del1 = src - nz(bsmax[1]) del2 = src - nz(bsmin[1]) volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2) //Relative price volatility factor vsum := nz(vsum[1]) + div * (volty - nz(volty[10])) avolty := nz(avolty[1]) + (2.0 / (math.max(4.0 * len, 30) + 1.0)) * (vsum - nz(avolty[1])) dVolty = avolty > 0 ? volty / avolty : 0 dVolty := math.max(1, math.min(math.pow(len1, 1.0/pow1), dVolty)) //Jurik volatility bands pow2 = math.pow(dVolty, pow1) Kv = math.pow(bet, math.sqrt(pow2)) bsmax := del1 > 0 ? src : src - Kv * del1 bsmin := del2 < 0 ? src : src - Kv * del2 //Jurik Dynamic Factor alpha = math.pow(beta, pow2) //1st stage - prelimimary smoothing by adaptive EMA jma = 0.0, ma1 = 0.0, det0 = 0.0, e2 = 0.0 ma1 := (1 - alpha) * src + alpha * nz(ma1[1]) //2nd stage - one more prelimimary smoothing by Kalman filter det0 := (src - ma1) * (1 - beta) + beta * nz(det0[1]) ma2 = ma1 + phaseRatio * det0 //3rd stage - final smoothing by unique Jurik adaptive filter e2 := (ma2 - nz(jma[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1]) jma := e2 + nz(jma[1]) jma _rsx_rsi(src, len)=> src_out = 100 * src mom0 = ta.change(src_out) moa0 = math.abs(mom0) Kg = 3 / (len + 2) Hg = 1 - Kg //mom f28 = 0.0, f30 = 0.0 f28 := Kg * mom0 + Hg * nz(f28[1]) f30 := Hg * nz(f30[1]) + Kg * f28 mom1 = f28 * 1.5 - f30 * 0.5 f38 = 0.0, f40 = 0.0 f38 := Hg * nz(f38[1]) + Kg * mom1 f40 := Kg * f38 + Hg * nz(f40[1]) mom2 = f38 * 1.5 - f40 * 0.5 f48 = 0.0, f50 = 0.0 f48 := Hg * nz(f48[1]) + Kg * mom2 f50 := Kg * f48 + Hg * nz(f50[1]) mom_out = f48 * 1.5 - f50 * 0.5 //moa f58 = 0.0, f60 = 0.0 f58 := Hg * nz(f58[1]) + Kg * moa0 f60 := Kg * f58 + Hg * nz(f60[1]) moa1 = f58 * 1.5 - f60 * 0.5 f68 = 0.0, f70 = 0.0 f68 := Hg * nz(f68[1]) + Kg * moa1 f70 := Kg * f68 + Hg * nz(f70[1]) moa2 = f68 * 1.5 - f70 * 0.5 f78 = 0.0, f80 = 0.0 f78 := Hg * nz(f78[1]) + Kg * moa2 f80 := Kg * f78 + Hg * nz(f80[1]) moa_out = f78 * 1.5 - f80 * 0.5 asdf = math.max(math.min((mom_out / moa_out + 1.0) * 50.0, 100.00), 0.00) asdf src = input.source(close, "Source", group = "Basic Settings") len = input.int(8, "RSX Period", group = "Basic Settings") jma_phase = input.int(defval=8, title="Jurik Phase", group = "Basic Settings") colorbars = input.bool(true, "Color bars?", group = "UI Options") rsx = _rsx_rsi(_a_jurik_filt(src, len, jma_phase), len) rsx := rsx - 50 real = plot(rsx, color = rsx >=0 ? color.new(greencolor, 0) : color.new(redcolor, 0), linewidth = 2, style = plot.style_histogram) zero = plot(0, color=color.new(color.gray, 30), linewidth=1, style=plot.style_circles, title = "Zero line") plot(rsx, color = rsx >=0 ? color.new(greencolor, 0) : color.new(redcolor, 0), linewidth = 2) barcolor(colorbars ? rsx >=0 ? color.new(greencolor, 0) : color.new(redcolor, 0) : na)
Cipher Twister - Long and Short
https://www.tradingview.com/script/TrNZLIzH-Cipher-Twister-Long-and-Short/
Market-Pip-Factory
https://www.tradingview.com/u/Market-Pip-Factory/
450
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Author Β© Market-Pip-Factory //@version=4 //Credits to Falcon and others for parts of the code //Thanks to Nitheesh Rajath for helping me iron out the alert headache :-) // Thanks to Soeski for helping test the config and tweaking study(title="Cipher Twister - Long and Short", shorttitle="Cipher_Twister") n1 = input(10, "Channel Length") n2 = input(21, "Average Length") obLevel1 = input(60, "Over Bought Level 1") obLevel2 = input(53, "Over Bought Level 2") osLevel1 = input(-60, "Over Sold Level 1") osLevel2 = input(-53, "Over Sold Level 2") // Maths Calc and Parameters ap = hlc3 esa = ema(ap, n1) d = ema(abs(ap - esa), n1) ci = (ap - esa) / (0.015 * d) tci = ema(ci, n2) wt1 = tci wt2 = sma(wt1, 4) wt3 = (wt1 - wt2) // Secondary Color Details grow_above = color.rgb(14.9, 65.1, 60.4) grow_below = color.rgb(100, 80.4, 82.4) fall_above = color.rgb(69.8, 87.5, 85.9) fall_below = color.rgb(93.7, 32.5, 31.4) final_col = (wt3>=0 ? (wt3[1] < wt3 ? grow_above : fall_above) : (wt3[1] < wt3 ? grow_below : fall_below) ) // Draw Oversold & Overbought Markers plot(0, color=color.gray) plot(obLevel1, color=color.red) plot(obLevel2, color=color.red) plot(osLevel1, color=color.green) plot(osLevel2, color=color.green) // Draw Light Yellow Cloud Area plot(wt1, style=plot.style_area, color=color.rgb(255, 235, 59, 15), title="wt1") // Draw Blue Cloud Area plot(wt2, style=plot.style_area, color=color.rgb(12, 12, 100, 20), title="wt2") // Draw Green and Red Dots on Intersections plot(cross(wt1, wt2) ? wt2 : na, color=wt2 - wt1 > 0 ? color.red : color.lime, style=plot.style_circles, linewidth=6) // Enable and execute Generic Alerts (for TV free accounts) wtz = cross(wt1, wt2) alertcondition(wtz, title='General Cross Alert', message='Trade Signal Alert') // Enable and execute specific LONG & SHORT Alerts (For TV Pro Accounts) // Detect Crosses longsignal = crossover(wt1, wt2) // Enable this without brakets (and wt1 < osLevel2) for additional special conditions shortsignal = crossunder(wt1, wt2) // Enable this without brakets (and wt1 > obLevel2) for additional special conditions // Only generate entries when the trade's direction is allowed in inputs. // If you want to enable the signal to fire only on CLOSE OF CANDLE, please uncomment the following 2 lines by removing the two forward slashes // on the following 2 lines enterLong = longsignal //and barstate.isconfirmed enterShort = shortsignal //and barstate.isconfirmed // Trigger the alerts only when the compound condition is met. // required code here alertcondition(enterLong, "Long Alert", "Go long") alertcondition(enterShort, "Short Alert", "Go short ") // Draw Divergences showDiv = input(true, "Show Divergences") src = input(title="Source", defval="Wave Trend", options=["Wave Trend", "Signal", "Histogram"]) lbR = input(title="Pivot Lookback Right", defval=5) lbL = input(title="Pivot Lookback Left", defval=5) rangeUpper = input(title="Max of Lookback Range", defval=60) rangeLower = input(title="Min of Lookback Range", defval=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) 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) //wt1="Wave Trend", wt2="Signal", wt3="Histogram" osc = showDiv ? src == "Wave Trend" ? wt1 : src == "Signal" ? wt2 : src == "Histogram" ? wt3 : wt1 : na // Additional Parameters plFound = na(pivotlow(osc, lbL, lbR)) ? false : true phFound = na(pivothigh(osc, lbL, lbR)) ? false : true _inRange(cond) => bars = barssince(cond == true) rangeLower <= bars and bars <= rangeUpper // Regular Bullish // Osc: Higher Low oscHL = osc[lbR] > valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) // Price: Lower Low Parameters priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1) bullCond = plotBull and priceLL and oscHL and plFound // Draw Line for Bullish Divergence plot(plFound ? osc[lbR] : na, offset=-lbR, title="Bullish", linewidth=2, color=(bullCond ? bullColor : noneColor)) // Print Text for Bullish Divergence plotshape(bullCond ? osc[lbR] : na, offset=-lbR, title="Bullish Label", text=" Bullish Divergence ", style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor) // Osc: Lower Low oscLL = osc[lbR] < valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1]) // Price: Higher Low priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1) // Regular Bearish // Osc: Lower High oscLH = osc[lbR] < valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1]) // Price: Higher High Parameters priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1) bearCond = plotBear and priceHH and oscLH and phFound // Draw Line for Bearish Divergence plot(phFound ? osc[lbR] : na, offset=-lbR, title="Bearish", linewidth=2, color=(bearCond ? bearColor : noneColor)) // Print Text for Bearish Divergence plotshape(bearCond ? osc[lbR] : na, offset=-lbR, title="Bearish Label", text=" Bearish Divergence ", style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor)
MACD Indicator for 5 Min Scalp
https://www.tradingview.com/script/xzjdBfPq-MACD-Indicator-for-5-Min-Scalp/
Coachman0912
https://www.tradingview.com/u/Coachman0912/
80
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© pluckyCraft54926 //@version=5 indicator("MACD Indicator") fast_length = input(title="Fast Length", defval=12) slow_length = input(title="Slow Length", defval=26) src = input(title="Source", defval=close) signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 9) sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["SMA", "EMA"]) sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"]) // Plot colors col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD") col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal") col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above") col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above") col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below") col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below") // Calculating fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length) slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length) macd = fast_ma - slow_ma signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length) hist = macd - signal hist_1m = request.security(syminfo.tickerid,"1",hist [barstate.isrealtime ? 1 : 0]) hline(0, "Zero Line", color=color.new(#787B86, 50)) //////////////////////////////////////////////////////// srcBB = hist_1m lengthBBLong = input.int(94,title = "Length BB Long", minval=1) lengthBBShort = input.int(8,title = "Length BB Short", minval=1) multBB = input.float(2.0, minval=0.001, maxval=50, title="StdDev") basisBBLong = ta.sma(srcBB, lengthBBLong) basisBBShort = ta.sma(srcBB, lengthBBShort) devBBLong = multBB * ta.stdev(srcBB, lengthBBLong) devBBShort = multBB * ta.stdev(srcBB, lengthBBShort) upperBB = basisBBShort + devBBShort lowerBB = basisBBLong - devBBLong offsetBB = input.int(0, "Offset", minval = -500, maxval = 500) p1 = plot(upperBB, "Upper", color=#2962FF, offset = offsetBB) p2 = plot(lowerBB, "Lower", color=#2962FF, offset = offsetBB) fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95)) //////////////////////////////////////////////////////////777 plotting = hist_1m <= lowerBB or hist_1m >= upperBB normalcolor = hist_1m>=0 ? (hist_1m[1] < hist_1m ? col_grow_above : col_fall_above) : (hist_1m[1] < hist_1m ? col_grow_below : col_fall_below) plot(hist_1m, title="Histogram", style=plot.style_columns, color=plotting ? normalcolor : color.gray) alertcondition(plotting,"Bigger then avarage Tick")
1-gg702
https://www.tradingview.com/script/kQYO3PmX/
wshm3k
https://www.tradingview.com/u/wshm3k/
25
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© backslash-f // // This script: // - Adds a Heikin-Ashi line to the chart (EMA-based). // - Provides alerts triggered when the color goes from green to red and vice versa. //@version=5 indicator("1-gg702", overlay=true) // EMA ema_input = input.int(title="EMA", defval=3, minval=1) ema_smoothing = input.int(title="EMA Smoothing", defval=2, minval=1) ema_open = ta.ema(open, ema_input) ema_close = ta.ema(close, ema_input) // Developer shouldShowDebugInfo = input(title="Show debug info", group="DEVELOPER", defval=false, tooltip="Check this box to see the values of the main variables on the chart, below bars. This is for debugging purposes only.") // Heikin-Ashi heikinashi = ticker.heikinashi(syminfo.tickerid) heikinashi_open = request.security(heikinashi, timeframe.period, ema_open) heikinashi_close = request.security(heikinashi, timeframe.period, ema_close) heikinashi_open_smooth = ta.ema(heikinashi_open, ema_smoothing) heikinashi_close_smooth = ta.ema(heikinashi_close, ema_smoothing) // Trend var trend = false var last_trend = trend trend := heikinashi_close_smooth >= heikinashi_open_smooth // Color color = trend ? color.green : color.red trend_color = color.new(color, 50) // Alert varip alert_count = 0 alert_message_prefix = '[' + syminfo.ticker + ']' // e.g. "[BTC]" alert_message_body = " Heikin-Ashi new color: " alert_message_sufix = trend ? "🟒" : "πŸ”΄" alert_message = alert_message_prefix + alert_message_body + alert_message_sufix if (trend != last_trend) alert_count := alert_count + 1 last_trend := trend alert(alert_message, alert.freq_once_per_bar) // Debugging label creation var debuggingLabel = label.new(na, na, color=color.new(color.blue, transp=100), textcolor=color.white, textalign=text.align_right, style=label.style_label_up, yloc=yloc.belowbar) if shouldShowDebugInfo current_color_string = "Current color: " + alert_message_sufix last_color_string = "Last color: " + (last_trend ? "🟒" : "πŸ”΄") alert_count_string = "Triggered alerts: " + str.tostring(alert_count) label.set_text(debuggingLabel, current_color_string + '\n' + last_color_string + '\n' + alert_count_string) label.set_color(debuggingLabel, color=color.new(color.blue, transp=0)) label.set_x(debuggingLabel, last_bar_index) label.set_y(debuggingLabel, close) // Lines open_line = plot(heikinashi_open_smooth, color=trend_color, title="Open Line") close_line = plot(heikinashi_close_smooth, color=trend_color, title="Close Line") fill(open_line, close_line, color=trend_color, title="Heikin-Ashi Line") // Calculate the 10-bar and 50-bar Exponential Moving Average (EMA) fastAverage = ta.ema(close, 10) slowAverage = ta.ema(close, 50) medlAverage = ta.ema(close, 100) okAvreage = ta.ema(close,200) plot(fastAverage, color=color.navy) plot(slowAverage, color=color.fuchsia) plot(medlAverage, color=color.white) plot(okAvreage, color=color.yellow) //@version=5 // indicator("Auto Fib Retracement", overlay=true) devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot." depthTooltip = "The minimum number of bars that will be taken into account when calculating the indicator." // pivots threshold threshold_multiplier = input.float(title="Deviation", defval=3, minval=0, tooltip=devTooltip) dev_threshold = ta.atr(10) / close * 100 * threshold_multiplier depth = input.int(title="Depth", defval=10, minval=1, tooltip=depthTooltip) reverse = input(false, "Reverse") var extendLeft = input(false, "Extend Left    |    Extend Right", inline = "Extend Lines") var extendRight = input(true, "", inline = "Extend Lines") var extending = extend.none if extendLeft and extendRight extending := extend.both if extendLeft and not extendRight extending := extend.left if not extendLeft and extendRight extending := extend.right prices = input(true, "Show Prices") levels = input(true, "Show Levels", inline = "Levels") levelsFormat = input.string("Values", "", options = ["Values", "Percent"], inline = "Levels") labelsPosition = input.string("Left", "Labels Position", options = ["Left", "Right"]) var int backgroundTransparency = input.int(85, "Background Transparency", minval = 0, maxval = 100) var line lineLast = na var int iLast = 0 var int iPrev = 0 var float pLast = 0 var isHighLast = false // otherwise the last pivot is a low pivot pivots(src, length, isHigh) => l2 = length * 2 c = nz(src[length]) ok = true for i = 0 to l2 if isHigh and src[i] > c ok := false if not isHigh and src[i] < c ok := false if ok [bar_index[length], c] else [int(na), float(na)] [iH, pH] = pivots(high, depth / 2, true) [iL, pL] = pivots(low, depth / 2, false) calc_dev(base_price, price) => 100 * (price - base_price) / price pivotFound(dev, isHigh, index, price) => if isHighLast == isHigh and not na(lineLast) // same direction if isHighLast ? price > pLast : price < pLast line.set_xy2(lineLast, index, price) [lineLast, isHighLast] else [line(na), bool(na)] else // reverse the direction (or create the very first line) if math.abs(dev) > dev_threshold // price move is significant id = line.new(iLast, pLast, index, price, color=color.gray, width=1, style=line.style_dashed) [id, isHigh] else [line(na), bool(na)] if not na(iH) dev = calc_dev(pLast, pH) [id, isHigh] = pivotFound(dev, true, iH, pH) if not na(id) if id != lineLast line.delete(lineLast) lineLast := id isHighLast := isHigh iPrev := iLast iLast := iH pLast := pH else if not na(iL) dev = calc_dev(pLast, pL) [id, isHigh] = pivotFound(dev, false, iL, pL) if not na(id) if id != lineLast line.delete(lineLast) lineLast := id isHighLast := isHigh iPrev := iLast iLast := iL pLast := pL _draw_line(price, col) => var id = line.new(iLast, price, bar_index, price, color=col, width=1, extend=extending) if not na(lineLast) line.set_xy1(id, line.get_x1(lineLast), price) line.set_xy2(id, line.get_x2(lineLast), price) id _draw_label(price, txt, txtColor) => x = labelsPosition == "Left" ? line.get_x1(lineLast) : not extendRight ? line.get_x2(lineLast) : bar_index labelStyle = labelsPosition == "Left" ? label.style_label_right : label.style_label_left align = labelsPosition == "Left" ? text.align_right : text.align_left labelsAlignStrLeft = txt + '\n ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ \n' labelsAlignStrRight = ' ' + txt + '\n ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ ‏ \n' labelsAlignStr = labelsPosition == "Left" ? labelsAlignStrLeft : labelsAlignStrRight var id = label.new(x=x, y=price, text=labelsAlignStr, textcolor=txtColor, style=labelStyle, textalign=align, color=#00000000) label.set_xy(id, x, price) label.set_text(id, labelsAlignStr) label.set_textcolor(id, txtColor) _wrap(txt) => "(" + str.tostring(txt, format.mintick) + ")" _label_txt(level, price) => l = levelsFormat == "Values" ? str.tostring(level) : str.tostring(level * 100) + "%" (levels ? l : "") + (prices ? _wrap(price) : "") _crossing_level(sr, r) => (r > sr and r < sr[1]) or (r < sr and r > sr[1]) startPrice = reverse ? line.get_y1(lineLast) : pLast endPrice = reverse ? pLast : line.get_y1(lineLast) iHL = startPrice > endPrice diff = (iHL ? -1 : 1) * math.abs(startPrice - endPrice) processLevel(show, value, colorL, lineIdOther) => float m = value r = startPrice + diff * m if show lineId = _draw_line(r, colorL) _draw_label(r, _label_txt(m, r), colorL) if _crossing_level(close, r) alert("Autofib: " + syminfo.ticker + " crossing level " + str.tostring(value)) if not na(lineIdOther) linefill.new(lineId, lineIdOther, color = color.new(colorL, backgroundTransparency)) lineId else lineIdOther show_0 = input(true, "", inline = "Level0") value_0 = input(0, "", inline = "Level0") color_0 = input(#787b86, "", inline = "Level0") show_0_236 = input(true, "", inline = "Level0") value_0_236 = input(0.236, "", inline = "Level0") color_0_236 = input(#f44336, "", inline = "Level0") show_0_382 = input(true, "", inline = "Level1") value_0_382 = input(0.382, "", inline = "Level1") color_0_382 = input(#81c784, "", inline = "Level1") show_0_5 = input(true, "", inline = "Level1") value_0_5 = input(0.5, "", inline = "Level1") color_0_5 = input(#4caf50, "", inline = "Level1") show_0_618 = input(true, "", inline = "Level2") value_0_618 = input(0.618, "", inline = "Level2") color_0_618 = input(#009688, "", inline = "Level2") show_0_65 = input(false, "", inline = "Level2") value_0_65 = input(0.65, "", inline = "Level2") color_0_65 = input(#009688, "", inline = "Level2") show_0_786 = input(true, "", inline = "Level3") value_0_786 = input(0.786, "", inline = "Level3") color_0_786 = input(#64b5f6, "", inline = "Level3") show_1 = input(true, "", inline = "Level3") value_1 = input(1, "", inline = "Level3") color_1 = input(#787b86, "", inline = "Level3") show_1_272 = input(false, "", inline = "Level4") value_1_272 = input(1.272, "", inline = "Level4") color_1_272 = input(#81c784, "", inline = "Level4") show_1_414 = input(false, "", inline = "Level4") value_1_414 = input(1.414, "", inline = "Level4") color_1_414 = input(#f44336, "", inline = "Level4") show_1_618 = input(true, "", inline = "Level5") value_1_618 = input(1.618, "", inline = "Level5") color_1_618 = input(#2962ff, "", inline = "Level5") show_1_65 = input(false, "", inline = "Level5") value_1_65 = input(1.65, "", inline = "Level5") color_1_65 = input(#2962ff, "", inline = "Level5") show_2_618 = input(true, "", inline = "Level6") value_2_618 = input(2.618, "", inline = "Level6") color_2_618 = input(#f44336, "", inline = "Level6") show_2_65 = input(false, "", inline = "Level6") value_2_65 = input(2.65, "", inline = "Level6") color_2_65 = input(#f44336, "", inline = "Level6") show_3_618 = input(true, "", inline = "Level7") value_3_618 = input(3.618, "", inline = "Level7") color_3_618 = input(#9c27b0, "", inline = "Level7") show_3_65 = input(false, "", inline = "Level7") value_3_65 = input(3.65, "", inline = "Level7") color_3_65 = input(#9c27b0, "", inline = "Level7") show_4_236 = input(true, "", inline = "Level8") value_4_236 = input(4.236, "", inline = "Level8") color_4_236 = input(#e91e63, "", inline = "Level8") show_4_618 = input(false, "", inline = "Level8") value_4_618 = input(4.618, "", inline = "Level8") color_4_618 = input(#81c784, "", inline = "Level8") show_neg_0_236 = input(false, "", inline = "Level9") value_neg_0_236 = input(-0.236, "", inline = "Level9") color_neg_0_236 = input(#f44336, "", inline = "Level9") show_neg_0_382 = input(false, "", inline = "Level9") value_neg_0_382 = input(-0.382, "", inline = "Level9") color_neg_0_382 = input(#81c784, "", inline = "Level9") show_neg_0_618 = input(false, "", inline = "Level10") value_neg_0_618 = input(-0.618, "", inline = "Level10") color_neg_0_618 = input(#009688, "", inline = "Level10") show_neg_0_65 = input(false, "", inline = "Level10") value_neg_0_65 = input(-0.65, "", inline = "Level10") color_neg_0_65 = input(#009688, "", inline = "Level10") lineId0 = processLevel(show_neg_0_65, value_neg_0_65, color_neg_0_65, line(na)) lineId1 = processLevel(show_neg_0_618, value_neg_0_618, color_neg_0_618, lineId0) lineId2 = processLevel(show_neg_0_382, value_neg_0_382, color_neg_0_382, lineId1) lineId3 = processLevel(show_neg_0_236, value_neg_0_236, color_neg_0_236, lineId2) lineId4 = processLevel(show_0, value_0, color_0, lineId3) lineId5 = processLevel(show_0_236, value_0_236, color_0_236, lineId4) lineId6 = processLevel(show_0_382, value_0_382, color_0_382, lineId5) lineId7 = processLevel(show_0_5, value_0_5, color_0_5, lineId6) lineId8 = processLevel(show_0_618, value_0_618, color_0_618, lineId7) lineId9 = processLevel(show_0_65, value_0_65, color_0_65, lineId8) lineId10 = processLevel(show_0_786, value_0_786, color_0_786, lineId9) lineId11 = processLevel(show_1, value_1, color_1, lineId10) lineId12 = processLevel(show_1_272, value_1_272, color_1_272, lineId11) lineId13 = processLevel(show_1_414, value_1_414, color_1_414, lineId12) lineId14 = processLevel(show_1_618, value_1_618, color_1_618, lineId13) lineId15 = processLevel(show_1_65, value_1_65, color_1_65, lineId14) lineId16 = processLevel(show_2_618, value_2_618, color_2_618, lineId15) lineId17 = processLevel(show_2_65, value_2_65, color_2_65, lineId16) lineId18 = processLevel(show_3_618, value_3_618, color_3_618, lineId17) lineId19 = processLevel(show_3_65, value_3_65, color_3_65, lineId18) lineId20 = processLevel(show_4_236, value_4_236, color_4_236, lineId19) lineId21 = processLevel(show_4_618, value_4_618, color_4_618, lineId20)
Horns Pattern Identifier [LuxAlgo]
https://www.tradingview.com/script/eyakzwYP-Horns-Pattern-Identifier-LuxAlgo/
LuxAlgo
https://www.tradingview.com/u/LuxAlgo/
3,597
study
5
CC-BY-NC-SA-4.0
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // Β© LuxAlgo //@version=5 indicator("Horns Pattern Identifier [LuxAlgo]" , overlay = true , max_lines_count = 500) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ threshold = input.float(0.05 , step = .01 , minval = 0) //Style bull_css = input.color(#0cb51a, 'Bullish Horn Levels' , group = 'Style') bear_css = input.color(#ff1100, 'Bearish Horn Levels' , group = 'Style') //-----------------------------------------------------------------------------} //Variables declaration //-----------------------------------------------------------------------------{ var line conf = na var line tp = na var target = 0. var lvl = 0. var os = 0 var cross = 0 //-----------------------------------------------------------------------------} //Rolling max/min & normalized distance //-----------------------------------------------------------------------------{ max = math.max(high,high[1],high[2]) min = math.min(low,low[1],low[2]) top = math.abs(high - high[2])/(max-min) btm = math.abs(low - low[2])/(max-min) //-----------------------------------------------------------------------------} //Detect and display horns alongside confirmation level/take profit //-----------------------------------------------------------------------------{ n = bar_index line.set_x2(conf, n) line.set_x2(tp, n) //Inverted Horn if ta.crossunder(top, threshold) and high[1] < math.min(high, high[2]) os := 0 line.set_x2(conf, n - 2) line.set_x2(tp, n - 2) line.new(n , high , n - 2 , high[2] , color = bear_css) lvl := min target := min - (max - min) conf := line.new(n , lvl , n + 1 , lvl , style = line.style_dotted , color = bear_css) tp := line.new(n , target , n + 1 , target , style = line.style_dashed , color = bear_css) //Horn if ta.crossunder(btm, threshold) and low[1] > math.max(low, low[2]) os := 1 line.set_x2(conf, n - 2) line.set_x2(tp, n - 2) line.new(n , low , n - 2 , low[2] , color = bull_css) lvl := max target := max + (max - min) conf := line.new(n , lvl , n + 1 , lvl , style = line.style_dotted , color = bull_css) tp := line.new(n , target , n + 1 , target , style = line.style_dashed , color = bull_css) //-----------------------------------------------------------------------------} //Display breakout signals //-----------------------------------------------------------------------------{ buy = ta.crossover(close, lvl) and os == 1 and cross == 1 sell = ta.crossunder(close, lvl) and os == 0 and cross == 1 cross := lvl != lvl[1] ? 1 : buy or sell ? 0 : cross[1] //Plots plotshape(buy ? low : na, "Buy Label" , style = shape.labelup , location = location.absolute , color = #0cb51a , text = "B" , textcolor = color.white , size = size.tiny) plotshape(sell ? high : na, "Sell Label" , style = shape.labeldown , location = location.absolute , color = #ff1100 , text = "S" , textcolor = color.white , size = size.tiny) //-----------------------------------------------------------------------------}
Imb finder
https://www.tradingview.com/script/baDxyC08-imb-finder/
seaaaaal
https://www.tradingview.com/u/seaaaaal/
410
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@version=5 indicator('Imb finder', overlay=true, max_boxes_count=500) var box[] bulishFvgs = array.new_box() var box[] bearFvgs = array.new_box() var penetrationRatio = input.float(defval=0.5, minval=0, maxval=1, step=0.1, title="Penetration Ratio") var string ig_info = '=== Design ===' var string ig_extend = '=== Extended ===' var color color1 = input.color(color.new(color.yellow, 50), 'Imbalance Color', group=ig_info) var color color2 = input.color(color.new(color.purple, 50), 'Mitigated Color', group=ig_info) var bool isExtend = input.bool(true, 'Show last imabalance', group=ig_extend) var bool hideFilledBoxes = input.bool(true, "Show fullfilled blocks", group=ig_extend) var lookback = input.int(1, "Lookback", 1, group=ig_extend, tooltip="Number of last shown imbalances") var projection = input.int(5, "Projection", 0, group=ig_extend, tooltip="Extends previous imbalances in the future.") t = math.abs(time[2] - time[1]) getMetrix (boxName) => top = box.get_top(boxName) bottom = box.get_bottom(boxName) left = box.get_left(boxName) [top, bottom, left] dropNa (arr) => for [i, item] in arr if na(item) array.remove(arr, i) drawFigure (left, top, right, bottom, color1) => imbBox = box.new(left, top, right, bottom, xloc=xloc.bar_time) box.set_bgcolor(imbBox, color1) box.set_border_color(imbBox, color1) imbBox processCalcBox (topBox, bottomBox, h) => box.set_top(topBox, h) box.set_bottom(bottomBox, h) paintBox (tbox, imbColor) => box.set_bgcolor(tbox, imbColor) box.set_border_color(tbox, imbColor) if not hideFilledBoxes box.delete(tbox) drawLastFvgBoxes (arrayType) => var box[] fvgs = array.new_box() for [i, item] in fvgs box.delete(item) array.clear(fvgs) for [i, item] in arrayType if i > array.size(arrayType) - 1 - lookback [top, bottom, left] = getMetrix(item) tbox = drawFigure(left, top, last_bar_time + t * projection, bottom, color1) array.push(fvgs, tbox) if barstate.isconfirmed if high < low[2] tbox = drawFigure(time[1], low[2], time[0], high, color1) array.push(bulishFvgs, tbox) if low > high[2] tbox = drawFigure(time[1], low, time[0], high[2], color1) array.push(bearFvgs, tbox) if array.size(bulishFvgs) > 0 for i = array.size(bulishFvgs) - 1 to 0 by 1 boxName = array.get(bulishFvgs, i) [top, bottom, left] = getMetrix(boxName) invalidationLimit = (top - bottom) * penetrationRatio if high > bottom + invalidationLimit box.set_bgcolor(boxName, color2) box.set_border_color(boxName, color2) if not hideFilledBoxes box.delete(boxName) array.remove(bulishFvgs, i) if array.size(bearFvgs) > 0 for i = array.size(bearFvgs) - 1 to 0 by 1 boxName = array.get(bearFvgs, i) [top, bottom, left] = getMetrix(boxName) invalidationLimit = (top - bottom) * penetrationRatio if low < top - invalidationLimit box.set_bgcolor(boxName, color2) box.set_border_color(boxName, color2) if not hideFilledBoxes box.delete(boxName) array.remove(bearFvgs, i) if isExtend drawLastFvgBoxes(bulishFvgs) drawLastFvgBoxes(bearFvgs) // label.new(bar_index, high, str.tostring(array.size(bulishFvgs) + array.size(bearFvgs)))
Highest and Low %
https://www.tradingview.com/script/LicNHGiL/
Naruephat
https://www.tradingview.com/u/Naruephat/
12
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Naruephat //@version=5 indicator("Highest and Low %", overlay=true) //input len_lowes_ = input.int(25,'len lowest',step= 25) size_is = input.string('auto','size table right', options = ['auto','tiny','small','normal'] , inline = 'Lnets') size_s = size_is == 'auto' ? size.auto : size_is == 'tiny' ? size.tiny : size_is == 'small' ? size.small : size_is == 'small' ? size.normal : size.auto toDate = time date_start_entry = time var begin = date_start_entry days = (toDate - begin) / (24 * 60 * 60 * 1000) // find the value high var h = 0. if h < high h := high //find the value low var l = 999999999999999999.0 if l > low l := low //latest low var lowest = 0. lowest := ta.lowest(low,len_lowes_) //calcul percentage price = ((close -close[1] ) /close[1] ) * 100 lowes = label.new(bar_index, high, text= 'lowest: '+str.tostring(lowest,'#,###.##') +"$|"+ str.tostring(lowest*34,'#,###.##') + 'บ.\n Price Last: ' +str.tostring(close,'#,###.##') +"$|"+ str.tostring(close*34,'#,###.##') + 'บ.\n(' +str.tostring(price,'#.##' )+')',yloc = yloc.abovebar ,style=label.style_none ,textcolor = close > close[1] ? color.green :color.white , size =size.normal ) label.delete(lowes[1]) plot( h, color = color.new(color.aqua,0) , title = '' ) plot( l, color = color.new(color.aqua,0) , title = '' ) plot( lowest , color = color.new(color.orange,0) , title = '' ) mess1s = str.tostring(days, "#,### days |") + str.tostring(days/30, "#,### month | ") + str.tostring(days/365, "#,###") +' year' mess1 = 'Highest : ' +str.tostring((h - l) / l * 100 ,'#,###.##') + ' %' mess1_2 = 'Low last : '+str.tostring((lowest - h) / h * 100 ,'#,###.##') + ' %' //table table table_countbar = table.new(position.top_right, 1,50 ,border_color = color.orange) table.cell(table_countbar,0, 0, mess1s,text_size = size_s , bgcolor =color.new(color.blue,80),text_color =color.new(color.white,0) ) table.cell(table_countbar,0, 1, mess1,text_size = size_s , bgcolor =color.new(color.green,80),text_color =color.new(color.white,0) ) table.cell(table_countbar,0, 2, mess1_2,text_size = size_s , bgcolor =color.new(color.red,80),text_color =color.new(color.white,0) )
Exponential Moving Average 20/50 - of D/W/M by Trilochan
https://www.tradingview.com/script/IcFwFNZp-Exponential-Moving-Average-20-50-of-D-W-M-by-Trilochan/
itsmethri11
https://www.tradingview.com/u/itsmethri11/
10
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© itsmethri11 //@version=5 indicator("EMA 20/50 - D/W/M by Trilochan", overlay=true) shortest = ta.ema(close, 20) short = ta.ema(close, 50) ema200 = ta.ema(close, 200) H1shortest = request.security(syminfo.tickerid,"60",ta.ema(close, 20)) H1short = request.security(syminfo.tickerid,"60",ta.ema(close, 50)) dshortest = request.security(syminfo.tickerid,"D",ta.ema(close, 20)) dshort = request.security(syminfo.tickerid,"D",ta.ema(close, 50)) wshortest = request.security(syminfo.tickerid,"W",ta.ema(close, 20)) wshort = request.security(syminfo.tickerid,"W",ta.ema(close, 50)) mshortest = request.security(syminfo.tickerid,"M",ta.ema(close, 20)) mshort = request.security(syminfo.tickerid,"M",ta.ema(close, 50)) plot(shortest, color=color.red, title='EMA 20 Dyn') plot(short, color=color.blue, title='EMA 50 Dyn') plot(ema200, color=color.rgb(0, 0, 0), title='EMA 200 Dyn') plot(H1shortest, color=color.red, title='1H EMA 20') plot(H1short, color=color.orange, title='1H EMA 50') plot(dshortest, color=color.orange, title='DEMA 20') plot(dshort, color=color.purple, title='DEMA 50') plot(wshortest, color=color.yellow, title='WEMA 20') plot(wshort, color=color.black, title='WEMA 50') plot(mshortest, color=color.lime, title='MEMA 20') plot(mshort, color=color.green, title='MEMA 50')
741 GME vs AMC
https://www.tradingview.com/script/KtyYqRYj-741-GME-vs-AMC/
Nyanderfull
https://www.tradingview.com/u/Nyanderfull/
3
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Nyanderfull // @version=4 study("741 GME vs AMC", max_labels_count=100) //Input / Colors and Base lines plot_lineWidth = input(1, " Line Width", input.integer, minval=1, maxval=11 ) p1 = plot(0, title="Baseline", linewidth = 0, color=#00000000, display=display.none) hline(0,color=#FFFFFF35,linestyle=hline.style_solid) /////Securities GME = security("GME", timeframe.period, close) AMC = security("AMC", timeframe.period, close) *7 Average = (GME + AMC) / 2 Difference = GME - AMC /////Input / Colors GME_Color = input(title="GME", type=input.color, defval=#00FF00) AMC_Color = input(title="AMC", type=input.color, defval=#FF0000) Average_Color = input(title="Difference", type=input.color, defval=#0077FF55) /////Plots GME_Plot = plot(GME, title="GME", color=GME_Color, linewidth = plot_lineWidth, display=display.all) AMC_Plot = plot(AMC, title="AMC", color=AMC_Color, linewidth = plot_lineWidth, display=display.all) Average_Plot = plot(Average, title="Average", color=Average_Color, linewidth = plot_lineWidth, display=display.all) Difference_Plot = plot(Difference, title="Difference", linewidth = plot_lineWidth, display=display.all) fill(GME_Plot, AMC_Plot, color=color.rgb(255,255,77,95)) fill(p1, Difference_Plot, color=color.blue)
RallySeason
https://www.tradingview.com/script/xXTPU1HM/
oIKUo
https://www.tradingview.com/u/oIKUo/
7
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© oIKUo //@version=5 indicator("RallySeason", overlay=true) //var label = label.new(bar_index, H, style=label.style_none, text="") // parameters window1 = input.int(5, minval=1, title="Quick Window") window2 = input.int(12, minval=1, title="Fast Window") window3 = input.int(24, minval=1, title="Middle window") window4 = input.int(48, minval=1, title= "Slow window") rate = input.float(0.7, minval = 0.01, title= "rate") length = input.int(1, minval=1, title="delta length") threshold = input.float(0.1, minval = 0.0, title="threshold") signalOn = input.bool(true, title="signal on") period = timeframe.period k = 1.0 if period == "D" k := 24 * 60.0 else k := period == "1" ? 1.0: period == "3" ? 3.0: period == "5" ? 5.0: period == "15" ? 15.0: period == "30" ? 30.0: period == "60" ? 60.0: period == "240" ? 240.0 : 1.0 PRICE = close MA1 = ta.sma(PRICE, window1) MA2 = ta.sma(PRICE, window2) MA3 = ta.sma(PRICE, window3) MA4 = ta.sma(PRICE, window4) plot(MA1, "quick", color=color.red, linewidth=2) plot(MA2, "fast", color= color.green, linewidth=2) plot(MA3, "middle", color= color.blue, linewidth=2) plot(MA4, "slow", color=color.purple, linewidth=2) DELTA2 = MA2 - MA2[length] DELTA3 = MA3 - MA3[length] DELTA4 = MA4 - MA4[length] w1 = MA2 - MA3 w2 = MA3 - MA4 r = math.abs(w1 / w2) p0 = w1 > 0 and w2 > 0 p2 = DELTA2 > threshold and DELTA3 > threshold and DELTA4 > threshold p3 = r > (1.0 - rate) and r < (1 + rate) //DELTA2 > DELTA3 and DELTA3 > DELTA4 positive = p0 and p2 and p3 q0 = w1 < 0 and w2 < 0 q2 = DELTA2 < -1.0 * threshold and DELTA3 < -1.0 * threshold and DELTA4 < -1.0 * threshold q3 = r > (1.0 - rate) and r < (1 + rate) //DELTA2 < DELTA3 and DELTA3 < DELTA4 negative = q0 and q2 and q3 color bg_color = na if (signalOn) if positive bg_color := color.new(color.green, 70) if negative bg_color := color.new(color.red, 70) bgcolor(bg_color)
Bitcoin Weekly Support Bands
https://www.tradingview.com/script/mLvbt9kZ-Bitcoin-Weekly-Support-Bands/
Ryukobushi
https://www.tradingview.com/u/Ryukobushi/
10
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Ryukobushi //@version=4 study(title="Bitcoin Weekly Support Bands", overlay=true, resolution="W") src = input(close, title="Source") len0 = input(8, minval=1, title="8sma") out0 = sma(src, len0) len1 = input(6, minval=1, title="6ema") out1 = ema(src, len1) len2 = input(20, minval=1, title="20sma") out2 = sma(src, len2) len3 = input(16, minval=1, title="16ema") out3 = ema(src, len3) len4 = input(64, minval=1, title="64ema") out4 = ema(src, len4) len5 = input(94, minval=1, title="94ema") out5 = ema(src, len5) len6 = input(140, minval=1, title="140sma") out6 = sma(src, len6) len7 = input(150, minval=1, title="150ema") out7 = ema(src, len7) len8 = input(265, minval=1, title="265sma") out8 = sma(src, len8) len9 = input(300, minval=1, title="300ema") out9 = ema(src, len9) len10 = input(56, minval=1, title="56sma") out10 = sma(src, len10) len11 = input(93, minval=1, title="93sma") out11 = sma(src, len11) o0 = plot(out0, linewidth=1, color=color.blue, title="8sma") o1 = plot(out1, linewidth=3, color=color.fuchsia, title="6ema") o2 = plot(out2, linewidth=1, color=color.red, title="20sma") o3 = plot(out3, linewidth=3, color=color.green, title="16ema") o4 = plot(out4, linewidth=1, color=color.red, title="64ema") o5 = plot(out5, linewidth=3, color=color.green, title="94ema") o6 = plot(out6, linewidth=1, color=color.red, title="140sma") o7 = plot(out7, linewidth=3, color=color.green, title="150ema") o8 = plot(out8, linewidth=1, color=color.red, title="265sma") o9 = plot(out9, linewidth=3, color=color.green, title="300ema") o10 = plot(out10, linewidth=3, color=color.yellow, title="56sma") o11 = plot(out11, linewidth=3, color=color.yellow, title="93sma") fill(o0, o1, color=color.yellow) fill(o2, o3, color=color.yellow) fill(o4, o5, color=color.yellow) fill(o6, o7, color=color.yellow) fill(o8, o9, color=color.yellow)
crypto Position Size Calculator
https://www.tradingview.com/script/zCEMOJSK-crypto-Position-Size-Calculator/
Mohamedawke
https://www.tradingview.com/u/Mohamedawke/
201
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Awke //@version=5 indicator(title = "crypto Position Size Calcultor", shorttitle="CPSC" , overlay=true ) RULE1= " Trade Info " Rule2= " Account Info" headline= "Trade display info " // trade info inputs entry = input.float(0.0, title="Entry" , group=RULE1) stoploss = input.float(0.0, title = "Stop Loss", group =RULE1) takeprofit = input.float(0.0, title="Target Price", group =RULE1) // Acoount info inputs Account_balance= input.float(0.0 , title = "Account Balance",group=Rule2) riskpertrade = input.float(0.0 , title="Risk % of the trade",group=Rule2) // finding out the stop loss and target stop_loss_distanation = entry - stoploss take_profit_distantion = takeprofit - entry // rrturing into percentage sl_per = stop_loss_distanation / entry * 100 tg_per = take_profit_distantion / entry * 100 // calculating risk reward ratio and postion size risk_reward_ratio = tg_per / sl_per position_size = Account_balance* riskpertrade / sl_per // diplaying info in table f_Format() => _s = str.tostring(syminfo.mintick) _s := str.replace_all(_s, "25", "00") _s := str.replace_all(_s, "5", "0") _s := str.replace_all(_s, "1", "0") ch_1 = 0.00000000002 ch_2 = 1 ch_3 = 0.00 // logic of display if (entry > ch_1 and stoploss > ch_1 and takeprofit > ch_1 and Account_balance > ch_2 and riskpertrade > ch_3 ) // options var Bottom_left = position.bottom_left var Bottom_right= position.bottom_right var Top_left= position.top_left var Top_right = position.top_right display = input.bool(true, title="Display Info Table", group=headline) dposition = input.string(Bottom_right ,options = [Bottom_left,Bottom_right,Top_left,Top_right ], title = "Display Positions") if (display) var table myTable = table.new(dposition, 2, 6, border_width = 1) txt1 = "Account Balance " txt2 = str.tostring(Account_balance) + " USD" table.cell(myTable , 0,0,bgcolor = color.rgb(128,0,128) ,text_color = color.rgb(255,255,255), text=txt1, text_halign=text.align_center, text_size = size.auto) table.cell(myTable , 1,0,bgcolor = color.rgb(128,0,128) ,text_color = color.rgb(255,255,255), text=txt2, text_halign=text.align_center,text_size = size.auto) txt3 = "Risk Per Trade %" txt4= str.tostring(riskpertrade) + " %" table.cell(myTable , 0,1,bgcolor = color.rgb(0,255,255) ,text_color = color.rgb(0,0,0), text=txt3, text_halign=text.align_center,text_size = size.auto) table.cell(myTable , 1,1,bgcolor = color.rgb(0,255,255) ,text_color = color.rgb(0,0,0), text=txt4, text_halign=text.align_center,text_size = size.auto) txt5 = "Entry " txt6= str.tostring(entry) table.cell(myTable , 0,2,bgcolor = color.black ,text_color = color.white, text=txt5, text_halign=text.align_center,text_size = size.auto) table.cell(myTable , 1,2,bgcolor = color.black,text_color = color.white, text=txt6, text_halign=text.align_center,text_size = size.auto) txt7 = "Stop Loss" txt8= str.tostring(stoploss) table.cell(myTable , 0,3,bgcolor = color.red ,text_color = color.white, text=txt7, text_halign=text.align_center,text_size = size.auto) table.cell(myTable , 1,3,bgcolor = color.red,text_color = color.white, text=txt8, text_halign=text.align_center,text_size = size.auto) txt9 = "Take Profit" txt10= str.tostring(takeprofit) table.cell(myTable , 0,4,bgcolor = color.green ,text_color = color.white, text=txt9, text_halign=text.align_center,text_size = size.auto) table.cell(myTable , 1,4,bgcolor = color.green,text_color = color.white, text=txt10, text_halign=text.align_center,text_size = size.auto) txtx1 = "Position Size Of Trade" txtx2= str.tostring(math.abs(position_size), f_Format()) + " USD" table.cell(myTable , 0,5,bgcolor = color.blue ,text_color = color.white, text=txtx1, text_halign=text.align_center,text_size = size.auto) table.cell(myTable , 1,5,bgcolor = color.blue,text_color = color.white, text=txtx2, text_halign=text.align_center,text_size = size.auto) // displaying trade lines like entry , stoploss , takeprofit display_trade_lines=input.bool(true, title="Display trade lines") hline(display_trade_lines ? entry :na , color= color.blue ,linestyle = hline.style_dotted , linewidth=3) hline(display_trade_lines ? stoploss :na , color= color.red ,linestyle = hline.style_dotted , linewidth=3) hline(display_trade_lines ? takeprofit :na , color= color.green ,linestyle = hline.style_dotted , linewidth=3)
Integral (Area)
https://www.tradingview.com/script/Rq3aMGPr-Integral-Area/
layth7ussein
https://www.tradingview.com/u/layth7ussein/
19
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© layth7ussein //@version=5 indicator("Integral") len = input.int(14, 'Length') lowest = ta.lowest(close, len) sum = 0. for i=0 to len-1 sum := sum + close[i] - lowest ma = ta.sma(sum, 14) plot(sum, color=color.red)
Parabolic SAR MARSI, Adaptive MACD [Loxx]
https://www.tradingview.com/script/glXYerus-Parabolic-SAR-MARSI-Adaptive-MACD-Loxx/
loxx
https://www.tradingview.com/u/loxx/
270
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Parabolic SAR MARSI, Adaptive MACD [Loxx]", shorttitle ="PSAR_MARSI_A_MACD [Loxx]", overlay = false, timeframe="", timeframe_gaps=true) _maRSI(src, price, rsiperiod, speed) => tprice = ta.sma(src, 1) workMaRsi = 0.0 rsi = ta.rsi(src, rsiperiod) if bar_index < rsiperiod workMaRsi := tprice else workMaRsi := workMaRsi[1] + (speed * math.abs(rsi/100.0-0.5)) * (tprice-workMaRsi[1]) workMaRsi variant(type, src, len) => sig = 0.0 if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := ta.ema(src, len) else if type == "DEMA" sig := 2 * ta.ema(src, len) - ta.ema(ta.ema(src, len), len) else if type == "TEMA" sig := 3 * (ta.ema(src, len) - ta.ema(ta.ema(src, len), len)) + ta.ema(ta.ema(ta.ema(src, len), len), len) else if type == "WMA" sig := ta.wma(src, len) else if type == "TRIMA" sig := ta.sma(ta.sma(src, math.ceil(len / 2)), math.floor(len / 2) + 1) else if type == "RMA" sig := ta.rma(src, len) else if type == "VWMA" sig := ta.vwma(src, len) sig rsiSource = input.source(close, "RSI Source", group = "MARSI MACD") rsiPeriod1 = input.int(14, "Fast RSI Period", minval = 0, group = "MARSI MACD") speed1 = input.float(1.2, "Fast MARSI Speed", minval = 0.0, group = "MARSI MACD") rsiPeriod2 = input.int(34, "Slow RSI Period", minval = 0, group = "MARSI MACD") speed2 = input.float(0.8, "Slow MARSI Speed", minval = 0.0, group = "MARSI MACD") start = input.float(0.01, "Start", minval = 0.0, group = "Parabolic SAR") accel = input.float(0.01, "Acceleration", minval = 0.0, group = "Parabolic SAR") finish = input.float(0.1, "Maximum", minval = 0.0, group = "Parabolic SAR") signal_ma = input.string("EMA", title='Signal MA Type', options=["DEMA", "EMA", "RMA", "SMA", "TEMA", "TRIMA", "VWMA", "WMA"], group='MACD') signalPer = input.int(9,"Signal Period", minval = 0, group = "MACD") greencolor = #2DD204 redcolor = #D2042D lightgreencolor = #96E881 lightredcolor = #DF4F6C darkGreenColor = #1B7E02 darkRedColor = #93021F psarUp = input(greencolor, "PSAR Uptrend  ", group="Color Settings", inline="MACD") psarDown = input(redcolor, "PSAR Downtrend  ", group="Color Settings", inline="MACD") col_signal = input(color.white, "Signal Line  ", group="Color Settings", inline="Signal") col_grow_above = input(color.new(lightgreencolor, 60), "Above   Grow", group="Histogram of MACD", inline="Above") col_fall_above = input(color.new(darkGreenColor, 60), "Fall", group="Histogram of MACD", inline="Above") col_grow_below = input(color.new(darkRedColor, 60), "Below Grow", group="Histogram of MACD", inline="Below") col_fall_below = input(color.new(lightredcolor, 60), "Fall", group="Histogram of MACD", inline="Below") macdHi = _maRSI(rsiSource, high, rsiPeriod1, speed1) - _maRSI(rsiSource, high, rsiPeriod2, speed2) macdLo = _maRSI(rsiSource, low, rsiPeriod1, speed1) - _maRSI(rsiSource, low, rsiPeriod2, speed2) macdMid = (macdHi + macdLo) * 0.5 macd = _maRSI(rsiSource, macdMid, rsiPeriod1, speed1) - _maRSI(rsiSource, macdMid, rsiPeriod2, speed2) signal= variant(signal_ma, macd, signalPer) pine_sar(start, inc, max, cutoff, _high, _low, _close) => var float result = na var float maxMin = na var float acceleration = na var bool isBelow = na bool isFirstTrendBar = false if bar_index < cutoff + cutoff * 0.2 if _close > _close[1] isBelow := true maxMin := _high result := _low[1] else isBelow := false maxMin := _low result := 0 isFirstTrendBar := true acceleration := start result := result + acceleration * (maxMin - result) if isBelow if result > _low isFirstTrendBar := true isBelow := false result := math.max(_high, maxMin) maxMin := _low acceleration := start else if result < _high isFirstTrendBar := true isBelow := true result := math.min(_low, maxMin) maxMin := _high acceleration := start if not isFirstTrendBar if isBelow if _high > maxMin maxMin := _high acceleration := math.min(acceleration + inc, max) else if _low < maxMin maxMin := _low acceleration := math.min(acceleration + inc, max) if isBelow result := math.min(result, _low[1]) if bar_index > 1 result := math.min(result, _low[2]) else result := math.max(result, _high[1]) if bar_index > 1 result := math.max(result, _high[2]) result sar = pine_sar(start, accel, finish, math.max(rsiPeriod2, rsiPeriod1), macdHi, macdLo, macd) plot(0, "Zero line", style = plot.style_circles, color = color.gray) plot(macd, "Historgram of MACD", style=plot.style_columns, color=(macd>=0 ? (macd[1] < macd ? col_grow_above : col_fall_above) : (macd[1] < macd ? col_grow_below : col_fall_below))) plot(sar, "PSAR", style=plot.style_cross, linewidth=1, color = sar > signal ? psarDown : psarUp) plot(signal,"Signal", linewidth=1, color = col_signal) plotshape(sar < signal and sar[1] > signal ? sar : na, title='PSAR Long Start', location=location.absolute, style=shape.circle, size=size.tiny, color=greencolor) plotshape(sar > signal and sar[1] < signal ? sar : na, title='PSAR Long Start', location=location.absolute, style=shape.circle, size=size.tiny, color=redcolor) alertcondition(sar < signal and sar[1] > signal, title="PSAR Uptrend", message="Parabolic SAR MARSI, Adaptive MACD: PSAR Uptrend\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(sar > signal and sar[1] < signal, title="PSAR Downtrend", message="Parabolic SAR MARSI, Adaptive MACD: PSAR Downtrend\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossover(macd, 0), title="MACD cross over zero line", message="Parabolic SAR MARSI, Adaptive MACD: MACD cross over zero line\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossunder(macd, 0), title="MACD cross under zero line", message="Parabolic SAR MARSI, Adaptive MACD: MACD cross under zero line\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossover(macd, signal), title="MACD cross over signal line", message="Parabolic SAR MARSI, Adaptive MACD: MACD cross over signal line\nSymbol: {{ticker}}\nPrice: {{close}}") alertcondition(ta.crossunder(macd, signal), title="MACD cross under signal line", message="Parabolic SAR MARSI, Adaptive MACD: MACD cross under signal line\nSymbol: {{ticker}}\nPrice: {{close}}")
Joe's Ultimate MA Ribbon (w/ Crossover Triggers)
https://www.tradingview.com/script/MPVarPgi-Joe-s-Ultimate-MA-Ribbon-w-Crossover-Triggers/
crypto-with-joe
https://www.tradingview.com/u/crypto-with-joe/
64
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© 2022 crypto-with-joe // @version=5 indicator("Joe’s Ultimate MA Ribbon (w/ Crossover Signals)", shorttitle = "Joe’s Ultimate MA Ribbon v1.31", explicit_plot_zorder = true, overlay = true) // Build Moving Average Types ma(source, length, type) => type == "EMA" ? ta.ema(source, length) : type == "SMA" ? ta.sma(source, length) : type == "SMMA (RMA)" ? ta.rma(source, length) : type == "WMA" ? ta.wma(source, length) : type == "VWMA" ? ta.vwma(source, length) : na // OPTIONS // ==================== // Moving Averages // -------------------- ma01_type = input.string("EMA", "MA 01", inline = "MA01", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma01_source = input(close, "Source", inline = "MA01", group = "====== Moving Averages ======") ma01_length = input.int(5, "Length", inline = "MA01", group = "====== Moving Averages ======", minval = 1) ma01 = ma(ma01_source, ma01_length, ma01_type) ma02_type = input.string("EMA", "MA 02", inline = "MA02", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma02_source = input(close, "Source", inline = "MA02", group = "====== Moving Averages ======") ma02_length = input.int(10, "Length", inline = "MA02", group = "====== Moving Averages ======", minval = 1) ma02 = ma(ma02_source, ma02_length, ma02_type) ma03_type = input.string("EMA", "MA 03", inline = "MA03", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma03_source = input(close, "Source", inline = "MA03", group = "====== Moving Averages ======") ma03_length = input.int(15, "Length", inline = "MA03", group = "====== Moving Averages ======", minval = 1) ma03 = ma(ma03_source, ma03_length, ma03_type) ma04_type = input.string("EMA", "MA 04", inline = "MA04", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma04_source = input(close, "Source", inline = "MA04", group = "====== Moving Averages ======") ma04_length = input.int(20, "Length", inline = "MA04", group = "====== Moving Averages ======", minval = 1) ma04 = ma(ma04_source, ma04_length, ma04_type) ma05_type = input.string("EMA", "MA 05", inline = "MA05", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma05_source = input(close, "Source", inline = "MA05", group = "====== Moving Averages ======") ma05_length = input.int(25, "Length", inline = "MA05", group = "====== Moving Averages ======", minval = 1) ma05 = ma(ma05_source, ma05_length, ma05_type) ma06_type = input.string("EMA", "MA 06", inline = "MA06", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma06_source = input(close, "Source", inline = "MA06", group = "====== Moving Averages ======") ma06_length = input.int(30, "Length", inline = "MA06", group = "====== Moving Averages ======", minval = 1) ma06 = ma(ma06_source, ma06_length, ma06_type) ma07_type = input.string("EMA", "MA 07", inline = "MA07", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma07_source = input(close, "Source", inline = "MA07", group = "====== Moving Averages ======") ma07_length = input.int(35, "Length", inline = "MA07", group = "====== Moving Averages ======", minval = 1) ma07 = ma(ma07_source, ma07_length, ma07_type) ma08_type = input.string("EMA", "MA 08", inline = "MA08", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma08_source = input(close, "Source", inline = "MA08", group = "====== Moving Averages ======") ma08_length = input.int(40, "Length", inline = "MA08", group = "====== Moving Averages ======", minval = 1) ma08 = ma(ma08_source, ma08_length, ma08_type) ma09_type = input.string("EMA", "MA 09", inline = "MA09", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma09_source = input(close, "Source", inline = "MA09", group = "====== Moving Averages ======") ma09_length = input.int(45, "Length", inline = "MA09", group = "====== Moving Averages ======", minval = 1) ma09 = ma(ma09_source, ma09_length, ma09_type) ma10_type = input.string("EMA", "MA 10", inline = "MA10", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma10_source = input(close, "Source", inline = "MA10", group = "====== Moving Averages ======") ma10_length = input.int(50, "Length", inline = "MA10", group = "====== Moving Averages ======", minval = 1) ma10 = ma(ma10_source, ma10_length, ma10_type) ma100_type = input.string("EMA", "100 MA", inline = "100 MA", group = "Fixed Moving Averages", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma100 = ma(close, 100, ma100_type) ma200_type = input.string("EMA", "200 MA", inline = "200 MA", group = "Fixed Moving Averages", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma200 = ma(close, 200, ma200_type) ma200htf_type = input.string("EMA", "200 MA HTF", inline = "200 MA HTF", group = "Fixed Moving Averages", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"]) ma200htf_tf = input.timeframe(defval = "60", title="Timeframe", inline = "200 MA HTF", group = "Fixed Moving Averages") ma200htf = ma(close, 200, ma200_type) ma200htf_smoothstep = input.bool(false, title="Smooth", inline = "200 MA HTF") ma200htf_smooth = request.security(syminfo.tickerid, ma200htf_tf, ma200htf, barmerge.gaps_on, barmerge.lookahead_off) ma200htf_step = request.security(syminfo.tickerid, ma200htf_tf, ma200htf, barmerge.gaps_off, barmerge.lookahead_off) // Signals // -------------------- show_entries = input(true, "Show Entries", group = "====== Signals ======") show_exits = input(true, "Show Exits", group = "====== Signals ======") // Long Entry lentry01 = input.string("MA 02", "Signal a LONG ENTRY when...", inline = "Long Entry MA's", group = "Buys/Longs", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) lentry02 = input.string("MA 06", "crosses above", inline = "Long Entry MA's", group = "Buys/Longs", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) lentry_tf = input.string("Chart", "on timeframe", inline = "Long Entry MA's", group = "Buys/Longs", options = ["Chart", "1s", "5s", "15s", "30s", "1m", "5m", "15m", "30m", "1h", "1.5h", "2h", "4h", "8h", "12h", "16h", "1D", "1W", "1M"]) // Long Exit lexit01 = input.string("MA 01", "Signal a LONG EXIT when...", inline = "Long Exit MA's", group = "Buys/Longs", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) lexit02 = input.string("MA 03", "crosses below", inline = "Long Exit MA's", group = "Buys/Longs", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) lexit_tf = input.string("Chart", "on timeframe", inline = "Long Exit MA's", group = "Buys/Longs", options = ["Chart", "1s", "5s", "15s", "30s", "1m", "5m", "15m", "30m", "1h", "1.5h", "2h", "4h", "8h", "12h", "16h", "1D", "1W", "1M"]) // Short Entry sentry01 = input.string("MA 02", "Signal a SHORT ENTRY when...", inline = "Short Entry MA's", group = "Sells/Shorts", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) sentry02 = input.string("MA 06", "crosses below", inline = "Short Entry MA's", group = "Sells/Shorts", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) sentry_tf = input.string("Chart", "on timeframe", inline = "Short Entry MA's", group = "Sells/Shorts", options = ["Chart", "1s", "5s", "15s", "30s", "1m", "5m", "15m", "30m", "1h", "1.5h", "2h", "4h", "8h", "12h", "16h", "1D", "1W", "1M"]) // Short Exit sexit01 = input.string("MA 01", "Signal a SHORT EXIT when...", inline = "Short Exit MA's", group = "Sells/Shorts", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) sexit02 = input.string("MA 03", "crosses above", inline = "Short Exit MA's", group = "Sells/Shorts", options = ["MA 01", "MA 02", "MA 03", "MA 04", "MA 05", "MA 06", "MA 07", "MA 08", "MA 09", "MA 10"]) sexit_tf = input.string("Chart", "on timeframe", inline = "Short Exit MA's", group = "Sells/Shorts", options = ["Chart", "1s", "5s", "15s", "30s", "1m", "5m", "15m", "30m", "1h", "1.5h", "2h", "4h", "8h", "12h", "16h", "1D", "1W", "1M"]) // DATA // ==================== // Detect MA crosses longentry01 = lentry01 == "MA 01" ? ma01 : lentry01 == "MA 02" ? ma02 : lentry01 == "MA 03" ? ma03 : lentry01 == "MA 04" ? ma04 : lentry01 == "MA 05" ? ma05 : lentry01 == "MA 06" ? ma06 : lentry01 == "MA 07" ? ma07 : lentry01 == "MA 08" ? ma08 : lentry01 == "MA 09" ? ma09 : ma10 longentry02 = lentry02 == "MA 01" ? ma01 : lentry02 == "MA 02" ? ma02 : lentry02 == "MA 03" ? ma03 : lentry02 == "MA 04" ? ma04 : lentry02 == "MA 05" ? ma05 : lentry02 == "MA 06" ? ma06 : lentry02 == "MA 07" ? ma07 : lentry02 == "MA 08" ? ma08 : lentry02 == "MA 09" ? ma09 : ma10 longexit01 = lexit01 == "MA 01" ? ma01 : lexit01 == "MA 02" ? ma02 : lexit01 == "MA 03" ? ma03 : lexit01 == "MA 04" ? ma04 : lexit01 == "MA 05" ? ma05 : lexit01 == "MA 06" ? ma06 : lexit01 == "MA 07" ? ma07 : lexit01 == "MA 08" ? ma08 : lexit01 == "MA 09" ? ma09 : ma10 longexit02 = lexit02 == "MA 01" ? ma01 : lexit02 == "MA 02" ? ma02 : lexit02 == "MA 03" ? ma03 : lexit02 == "MA 04" ? ma04 : lexit02 == "MA 05" ? ma05 : lexit02 == "MA 06" ? ma06 : lexit02 == "MA 07" ? ma07 : lexit02 == "MA 08" ? ma08 : lexit02 == "MA 09" ? ma09 : ma10 shortentry01 = sentry01 == "MA 01" ? ma01 : sentry01 == "MA 02" ? ma02 : sentry01 == "MA 03" ? ma03 : sentry01 == "MA 04" ? ma04 : sentry01 == "MA 05" ? ma05 : sentry01 == "MA 06" ? ma06 : sentry01 == "MA 07" ? ma07 : sentry01 == "MA 08" ? ma08 : sentry01 == "MA 09" ? ma09 : ma10 shortentry02 = sentry02 == "MA 01" ? ma01 : sentry02 == "MA 02" ? ma02 : sentry02 == "MA 03" ? ma03 : sentry02 == "MA 04" ? ma04 : sentry02 == "MA 05" ? ma05 : sentry02 == "MA 06" ? ma06 : sentry02 == "MA 07" ? ma07 : sentry02 == "MA 08" ? ma08 : sentry02 == "MA 09" ? ma09 : ma10 shortexit01 = sexit01 == "MA 01" ? ma01 : sexit01 == "MA 02" ? ma02 : sexit01 == "MA 03" ? ma03 : sexit01 == "MA 04" ? ma04 : sexit01 == "MA 05" ? ma05 : sexit01 == "MA 06" ? ma06 : sexit01 == "MA 07" ? ma07 : sexit01 == "MA 08" ? ma08 : sexit01 == "MA 09" ? ma09 : ma10 shortexit02 = sexit02 == "MA 01" ? ma01 : sexit02 == "MA 02" ? ma02 : sexit02 == "MA 03" ? ma03 : sexit02 == "MA 04" ? ma04 : sexit02 == "MA 05" ? ma05 : sexit02 == "MA 06" ? ma06 : sexit02 == "MA 07" ? ma07 : sexit02 == "MA 08" ? ma08 : sexit02 == "MA 09" ? ma09 : ma10 longentry = ta.crossover(longentry01, longentry02) longexit = ta.crossunder(longexit01, longexit02) shortentry = ta.crossunder(shortentry01, shortentry02) shortexit = ta.crossover(shortexit01, shortexit02) // Fills & Plots // ================ // Fill Backgrounds var position = 0 if longentry position := 1 else position := -1 //bgcolor(position == 1 ? color.green : color.red) // Plot MA's plot(ma01, color = color.aqua, title = "MA 01", linewidth = 1, editable = true) plot(ma02, color = color.blue, title = "MA 02", linewidth = 1, editable = true) plot(ma03, color = color.teal, title = "MA 03", linewidth = 1, editable = true) plot(ma04, color = color.green, title = "MA 04", linewidth = 1, editable = true) plot(ma05, color = color.lime, title = "MA 05", linewidth = 1, editable = true) plot(ma06, color = color.yellow, title = "MA 06", linewidth = 1, editable = true) plot(ma07, color = color.orange, title = "MA 07", linewidth = 1, editable = true) plot(ma08, color = color.purple, title = "MA 08", linewidth = 1, editable = true) plot(ma09, color = color.fuchsia, title = "MA 09", linewidth = 1, editable = true) plot(ma10, color = color.red, title = "MA 10", linewidth = 1, editable = true) plot(ma100, color = #b2b5be, title = "100 MA", linewidth = 2, editable = true) plot(ma200, color = #ffffff, title = "200 MA", linewidth = 3, editable = true) plot(ma200, color = #ff1c15, title = "200 MA (2nd)", linewidth = 1, style = plot.style_line, editable = true) plot(ma200htf_smoothstep ? ma200htf_smooth : ma200htf_step, color = #ff1c15, title = "200 MA HTF", linewidth = 3, editable = true) plot(ma200htf_smoothstep ? ma200htf_smooth : ma200htf_step, color = #ffffff, title = "200 MA HTF (2nd)", linewidth = 1, style = plot.style_line, editable = true) // Plot Signals plotshape(longentry and show_entries ? longentry : na, title = "Long Entry", style = shape.circle, location = location.belowbar, color = color.lime, size = size.auto, editable = true) plotshape(longexit and show_exits ? longexit : na, title = "Long Exit", style = shape.square, location = location.top, color = color.lime, size = size.auto, editable = true) plotshape(shortentry and show_entries ? shortentry : na, title = "Short Entry", style = shape.circle, location = location.abovebar, color = color.red, size = size.auto, editable = true) plotshape(shortexit and show_exits ? shortexit : na, title = "Short Exit", style = shape.square, location = location.bottom, color = color.red, size = size.auto, editable = true)
5EMA(8,13,21,55,125) w/ EMA8-13 + EMA8-125 GC/DC Signal-by Terry
https://www.tradingview.com/script/SuVJ8Ryo-5EMA-8-13-21-55-125-w-EMA8-13-EMA8-125-GC-DC-Signal-by-Terry/
septeriady
https://www.tradingview.com/u/septeriady/
77
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© septeriady //@version=5 indicator('EMA8,13 and EMA8,125 Golden / Dead Cross + BB + Supertrend', overlay=true) // EMA Cross Indicator // User input: EMA lengths and source ema_01_len = input.int(8, title='Ema 8', step=1) ema_02_len = input.int(13, title='Ema 13', step=1) ema_03_len = input.int(21, title='Ema 21', step=1) ema_04_len = input.int(55, title='Ema 55', step=1) ema_05_len = input.int(125, title='Ema 125', step=1) ema_src = input(title='Source', defval=close) // Perhitungan ema_01 = ta.ema(ema_src, ema_01_len) ema_02 = ta.ema(ema_src, ema_02_len) ema_03 = ta.ema(ema_src, ema_03_len) ema_04 = ta.ema(ema_src, ema_04_len) ema_05 = ta.ema(ema_src, ema_05_len) //EMAs in chart signs plot(ema_01, title='ema_01', color=color.new(#E0FFFF, 0), style=plot.style_line, linewidth=1) plot(ema_02, title='ema_02', color=color.new(#ff0040, 0), style=plot.style_line, linewidth=1) plot(ema_03, title='ema_03', color=color.new(#00FF01, 0), style=plot.style_line, linewidth=1) plot(ema_04, title='ema_04', color=color.new(#87CEFA, 0), style=plot.style_line, linewidth=1) plot(ema_05, title='ema_05', color=color.new(#FAFAD2, 0), style=plot.style_line, linewidth=1) //Cross 8-13 detect golden_cross = ta.crossover(ema_01, ema_02) death_cross = ta.crossunder(ema_01, ema_02) //If cross then draw cross on ema level plot(golden_cross or death_cross ? ema_01 : na, style=plot.style_columns, title='8-13 Cross Setting', linewidth=3, color=ema_01 > ema_02 ? color.green : color.red, transp=70) //If cross, draw cross with text below on the chart plotchar(golden_cross or death_cross ? ema_01 : na, title='EMA813 Crossing', char='X', location=location.bottom, color=ema_01 > ema_02 ? color.green : color.red, text='8-13', textcolor=ema_01 > ema_02 ? color.green : color.red, transp=1) //Cross 8-125 detect super_golden_cross = ta.crossover(ema_01, ema_05) super_death_cross = ta.crossunder(ema_01, ema_05) //If cross then draw cross on ema level plot(super_golden_cross or super_death_cross ? ema_01 : na, style=plot.style_columns, title='8-125 Cross Setting', linewidth=3, color=ema_01 > ema_05 ? color.blue : color.yellow, transp=70) //If cross, draw cross with text below on the chart plotchar(super_golden_cross or super_death_cross ? ema_01 : na, title='EMA8125 Crossing', char='X', location=location.bottom, color=ema_01 > ema_05 ? color.blue : color.yellow, text='8-125', textcolor=ema_01 > ema_02 ? color.blue : color.yellow, transp=1) length = input.int(20, minval=1) src = input(close, title="Source") mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev") basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev offset = input.int(0, "Offset", minval = -500, maxval = 500) plot(basis, "Basis", color=#FF6D00, offset = offset) p1 = plot(upper, "Upper", color=#FFD700, offset = offset) p2 = plot(lower, "Lower", color=#FFD700, offset = offset) fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95)) atrPeriod = input(10, "ATR Length") factor = input.float(3.0, "Factor", step = 0.01) [supertrend, direction] = ta.supertrend(factor, atrPeriod) bodyMiddle = plot((open + close) / 2, display=display.none) upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style=plot.style_linebr) downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.red, style=plot.style_linebr) fill(bodyMiddle, upTrend, color.new(color.green, 70), fillgaps=false) fill(bodyMiddle, downTrend, color.new(color.red, 70), fillgaps=false)
Parabolic SAR of KAMA [Loxx]
https://www.tradingview.com/script/sN2E9kBG-Parabolic-SAR-of-KAMA-Loxx/
loxx
https://www.tradingview.com/u/loxx/
191
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Parabolic SAR of KAMA [Loxx]", shorttitle ="PSARKAMA [Loxx]", overlay = true, timeframe="", timeframe_gaps=true) greencolor = #2DD204 redcolor = #D2042D _jfract(count)=> window = math.ceil(count/2) _hl1 = (ta.highest(high[window], window) - ta.lowest(low[window], window)) / window _hl2 = (ta.highest(high, window) - ta.lowest(low, window)) / window _hl = (ta.highest(high, count) - ta.lowest(low, count)) / count _d = (math.log(_hl1 + _hl2) - math.log(_hl)) / math.log(2) dim = _d < 1 ? 1 : _d > 2 ? 2 : _d _kama(src, len, fast, slow, jcount, efratiocalc) => fastend = (2.0 /(fast + 1)) slowend = (2.0 /(slow + 1)) mom = math.abs(ta.change(src, len)) vola = math.sum(math.abs(ta.change(src)), len) efratio = efratiocalc == "Regular" ? (vola != 0 ? mom / vola : 0) : math.min(2.0-_jfract(jcount), 1.0) alpha = math.pow(efratio * (fastend - slowend) + slowend, 2) kama = 0.0 kama := alpha * src + (1 - alpha) * nz(kama[1], src) kama blsrc = input.source(hl2, "Source", group = "Kaufman AMA Settings") period = input.int(10, "Period", minval = 0, group = "Kaufman AMA Settings") kama_fastend = input.float(2, "Kaufman AMA Fast-end Period", minval = 0.0, group = "Kaufman AMA Settings") kama_slowend = input.float(30, "Kaufman AMA Slow-end Period", minval = 0.0, group = "Kaufman AMA Settings") efratiocalc = input.string("Regular", "Efficiency Ratio Type", options = ["Regular", "Jurik Fractal Dimension Adaptive"], group = "Kaufman AMA Settings") jcount = input.int(defval=2, title="Jurik Fractal Dimension Count ", group = "Kaufman AMA Settings") start = input.float(0.02, "Start", minval = 0.0, step = 0.01, group = "Parabolic SAR") accel = input.float(0.02, "Acceleration", minval = 0.0, step = 0.01, group = "Parabolic SAR") finish = input.float(0.2, "Maximum", minval = 0.0, step = 0.01, group = "Parabolic SAR") showSar = input.bool(true, "Show PSAR of Kaufman AMA?", group = "UI Options") showBl = input.bool(true, "Show Kaufman AMA Baseline?", group = "UI Options") trendmatch = input.bool(true, "Activate Trend Confluence?", group = "UI Options") colorbars = input.bool(true, "Color bars?", group = "UI Options") kamaHi = _kama(high, period, kama_fastend, kama_slowend, jcount, efratiocalc) kamaLo = _kama(low, period, kama_fastend, kama_slowend, jcount, efratiocalc) kamaMid = (kamaHi + kamaLo) * 0.5 pine_sar(start, inc, max, cutoff, _high, _low, _close) => var float result = na var float maxMin = na var float acceleration = na var bool isBelow = na bool isFirstTrendBar = false if bar_index < cutoff + cutoff * 0.2 if _close > _close[1] isBelow := true maxMin := _high result := _low[1] else isBelow := false maxMin := _low result := 0 isFirstTrendBar := true acceleration := start result := result + acceleration * (maxMin - result) if isBelow if result > _low isFirstTrendBar := true isBelow := false result := math.max(_high, maxMin) maxMin := _low acceleration := start else if result < _high isFirstTrendBar := true isBelow := true result := math.min(_low, maxMin) maxMin := _high acceleration := start if not isFirstTrendBar if isBelow if _high > maxMin maxMin := _high acceleration := math.min(acceleration + inc, max) else if _low < maxMin maxMin := _low acceleration := math.min(acceleration + inc, max) if isBelow result := math.min(result, _low[1]) if bar_index > 1 result := math.min(result, _low[2]) else result := math.max(result, _high[1]) if bar_index > 1 result := math.max(result, _high[2]) [result, isBelow] [sar, isbelow] = pine_sar(start, accel, finish, math.max(period, kama_fastend, kama_slowend), kamaHi, kamaLo, kamaMid) kamaClose = _kama(blsrc, period, kama_fastend, kama_slowend, jcount, efratiocalc) trendMatchColor = blsrc > kamaClose and isbelow ? greencolor : blsrc < kamaClose and not isbelow ? redcolor : color.white regSarColor = isbelow ? greencolor : redcolor regBlColor = blsrc > kamaClose ? greencolor : redcolor plot(showSar ? sar : na, "PSAR of Kaufman AMA", style = plot.style_circles, linewidth = 2, color = trendmatch ? trendMatchColor : regSarColor) plot(showBl ? kamaClose : na, "Kaufman AMA Baseline", color = trendmatch ? trendMatchColor : regBlColor, linewidth = 2) barcolor(colorbars ? trendMatchColor : na)
Trend Identifier
https://www.tradingview.com/script/sHyuI4AY-Trend-Identifier/
spacekadet17
https://www.tradingview.com/u/spacekadet17/
328
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© spacekadet17 //@version=5 indicator(title="Trend Identifier", shorttitle="Trend Identifier", format=format.price, precision=4, overlay = false) // indicators: price normalized alma, its 1st and 2nd derivatives timeInterval = input(140) smoothining = input(21) ema = ta.alma(close,timeInterval,1.1,6) dema = (ema-ema[1])/ema d2ema = ta.ema(dema-dema[1],smoothining) //plot graph green = color.rgb(20,255,100) yellow = color.yellow red = color.red blue = color.rgb(20,120,255) tcolor = (dema>0) and (d2ema>0)? green : (dema>0) and (d2ema<0) ? yellow : (dema < 0) and (d2ema<0) ? red : (dema < 0) and (d2ema>0) ? blue : color.black demaema = ta.ema(dema,smoothining) plot(demaema, color = tcolor)
Barbwire
https://www.tradingview.com/script/OQWX7v3b-Barbwire/
boitoki
https://www.tradingview.com/u/boitoki/
217
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© boitoki //@version=5 indicator("Barbwire", overlay=true, precision=2, max_boxes_count=300, max_lines_count=500) import boitoki/AwesomeColor/5 as ac import boitoki/ma_function/3 as ma import boitoki/RCI/4 as rci_func [hopen, hclose] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [open, close]) hoc2 = math.avg(math.max(hopen, hclose), math.min(hopen, hclose)) oc2 = math.avg(math.max(open, close), math.min(open, close)) //////////// // DEFINE // option_source1 = 'Open-Close Heikin-Ashi' option_source4 = 'Open-Close' option_source2 = 'High-Low' option_source3 = 'Hybrid' sign = 'Display' GP1 = sign GP2 = sign GP3 = sign color_red = #D93611 color_blue = #1D5A73 ////////////// // FUNCTION // // f_HR (_open, _close) => math.abs(_open - _close) // f_source (_type) => switch _type option_source1 => f_HR(hopen, hlc3) option_source2 => f_HR(high, low) option_source3 => math.avg(f_HR(hopen, hlc3) * 0.6, f_HR(open, close) * 0.3, f_HR(high, low) * 0.1) option_source4 => f_HR(open, close) => f_HR(high, low) // f_get_data (_source, _len) => data = array.new<float>() for i = 1 to _len array.push(data, _source[i]) data f_remove_boxes (_arr, _max) => if array.size(_arr) > _max for i = _max to array.size(_arr) box.delete(array.shift(_arr)) f_get_width_by_box (_id) => math.abs(box.get_right(_id) - box.get_left(_id)) // f_renderBox (_start, _processing, _end, _min, _border_width, _border_color, _bgcolor, _drawing_max, _show) => start_notif = false end_notif = false count = 0 if _show var box barb_box = na var label txt = na var line top = na var line bot = na var float y1 = na var float y2 = na var int x1 = na line_style = line.style_dotted var boxes = array.new<box>() count := f_get_width_by_box(barb_box) if _start x1 := bar_index y1 := high y2 := low barb_box := box.new(x1, y1, x1, y2, _border_color, _border_width, line.style_solid, bgcolor=_bgcolor) txt := label.new(x1, y1, 'β€’', color=color.new(_border_color, 5), textcolor=ac.panda('verydarkgray'), size=size.tiny) if _processing y1 := math.max(y1, high) y2 := math.min(y2, low) box.set_top(barb_box, y1) box.set_bottom(barb_box, y2) box.set_right(barb_box, bar_index) label.set_y(txt, y1) label.set_text(txt, 'β€’β€’β€’') if count == _min start_notif := true if _end box.set_right(barb_box, bar_index) label.delete(txt) if count < _min box.delete(barb_box) else array.push(boxes, barb_box) f_remove_boxes(boxes, _drawing_max) end_notif := true y1 := na, y2 := na [start_notif, end_notif, count] // // f_barb_start (in_barb) => in_barb and (not in_barb[1]) f_barb_end (in_barb) => (not in_barb) and in_barb[1] // // f_dir_by_roc (_src, _len, _scale=2.0) => roc_arr = array.new<float>(_len) roc = ta.roc(_src, 2) roc_moved = math.abs(roc - roc[3]) for i = 1 to _len array.push(roc_arr, roc_moved[i]) min_roc_value = array.min(roc_arr) min_roc_value := array.stdev(roc_arr) * _scale roc_moved <= min_roc_value // f_barb_roc (_len) => height = math.max(hopen, hclose) - math.min(hopen, hclose) roc = ta.roc(height, _len) roc <= 0 // f_barb_stoch (_source1, _source2, _len, _lv) => v1 = ta.stoch(_source1, _source1, _source1, _len) v2 = ta.stoch(_source2, _source2, _source2, math.round(_len * 0.5)) (v1 <= _lv) and (v2 <= _lv) // f_barb_rank (_source, _len, _sens) => arr = array.new<float>(_len) new_arr = array.new<float>() for i = 1 to _len array.push(arr, _source[i]) min_value = array.min(arr) min_value := array.percentile_nearest_rank(arr, _sens) min_value := math.max(min_value, syminfo.mintick * 2) in_barb = _source <= (min_value) in_barb f_le (_v, _std, _malt) => _v <= _std * _malt f_ge (_v, _std, _malt) => _v >= _std * _malt f_id (_v, _arr) => array.indexof(_arr, array.min(_arr)) < _v //////////// // INPUTS // i_source_type = input.string(option_source3, 'Source', options=[option_source1, option_source4, option_source2, option_source3]) i_min = input.int(4, 'Num. of minimum bars', minval=0) i_show_barb = input.bool(true, 'Mixed', group=GP1) i_show_barb_stoch = input.bool(false, 'Stochastic', group=GP1, tooltip='Length β€’ Level %') i_stoch_length = input.int(50, '↔', inline='stoch_param', group=GP1) i_stoch_level = input.int(18, '/ ≀', inline='stoch_param', group=GP1) i_show_barb_rank = input.bool(false, 'Rank %', group=GP2, tooltip='Length β€’ Level %') i_len = input.int(100, '↔', inline='rank_param', group=GP2) i_rank_level = input.int(5, '/ ≀', minval=0, inline='rank_param', group=GP2) i_show_barb_stdev = false //input.bool(false, 'β€’ Stdev', inline='stdev', group=GP3, tooltip='Level') i_stdev_mult = 0.20 //input.float(0.20, '', minval=0.0, step=0.01, inline='stdev', group=GP3) // FILTER i_dir_roc_sens = 2.0 // input.float(2.0, '', minval=0, step=0.1, group='FILTER') i_filter_stdev5 = true // input.bool(true, 'Filtered ">5STDEV"', group='Filter') // STYLE i_border_width = input.int(2, '', minval=0, group='style', inline='style', tooltip='Border width / color / bgcolor') i_boxcolor = input.color(color.new(#F2A341, 20), '', group='style', inline='style') i_bgcolor = input.color(color.new(#F4C58B, 84), '', group='style', inline='style') i_barcolor = input.bool(false, "Bar colors", group='OPTIONS') i_spot_smallest = input.bool(false, 'Smallest bar', inline='smallest_bar', group='OPTIONS') i_smallest_color = input.color(#F2A341, '', inline='smallest_bar', group='OPTIONS') i_spot_largest = input.bool(false, 'Largest bar', inline='largest_bar', group='OPTIONS') i_largest_color = input.color(#0C74A6, '', inline='largest_bar', group='OPTIONS') i_spot_priceflip = false //input.bool(false, 'Price flip', group='OPTIONS') i_memory_cleaning = false //input.bool(false, 'Memory cleaning', group='OPTIONS') i_drawing_max = i_memory_cleaning ? 5 : 200 ////////// // DATA // HR = f_source(i_source_type) data_len = i_len all_data = f_get_data(HR, data_len) all_stdev = array.stdev(all_data) a_data = array.new<float>() if i_filter_stdev5 and array.size(all_data) > 0 for i = 0 to array.size(all_data) - 1 my_value = array.get(all_data, i) if my_value < all_stdev * 5 array.push(a_data, my_value) else a_data := array.copy(all_data) v_std = array.stdev(a_data) v_avg = array.avg(a_data) i_stdev_xs = 0.18 i_stdev_s = 0.50 i_stdev_l = 4.00 i_stdev_xl = 5.00 is_le030 = f_le(HR, v_std, i_stdev_s) is_le005 = f_le(HR, v_std, i_stdev_xs) is_small = f_le(HR, v_std, i_stdev_xs) is_geL = f_ge(HR, v_std, i_stdev_l) is_geXL = f_ge(HR, v_std, i_stdev_xl) is_largest = is_geXL is_smallest = (f_id(1, a_data) or f_le(HR, v_std, i_stdev_xs)) if is_smallest[1] is_smallest := false ////////// // CALC // // FILTER // is_dir_by_roc = f_dir_by_roc(hoc2, i_len, i_dir_roc_sens) in_barb_by_stoch = f_barb_stoch(f_HR(hopen, ohlc4), f_HR(high, low), i_stoch_length, i_stoch_level) in_barb_by_rank = f_barb_rank(HR, i_len, i_rank_level) and is_dir_by_roc in_barb_by_stdev = f_le(HR, v_std, i_stdev_mult) and is_dir_by_roc in_barb_by_roc = f_barb_roc(16) in_barb = in_barb_by_stoch or in_barb_by_rank or in_barb_by_stdev /////////////////// // Conditions /////////////////// ////////////// // BARBWIRE // //if i_filter_roc // is_barb := is_barb and is_dir_by_roc stoch_barb_start = f_barb_start(in_barb_by_stoch) stoch_barb_end = f_barb_end(in_barb_by_stoch) rank_barb_start = f_barb_start(in_barb_by_rank) rank_barb_end = f_barb_end(in_barb_by_rank) stdev_barb_start = f_barb_start(in_barb_by_stdev) stdev_barb_end = f_barb_end(in_barb_by_stdev) barb_start = f_barb_start(in_barb) barb_end = f_barb_end(in_barb) // RENDERING // f_renderBox(stoch_barb_start, in_barb_by_stoch, stoch_barb_end, i_min, i_border_width, i_boxcolor, i_bgcolor, i_drawing_max, i_show_barb_stoch and barstate.isconfirmed) f_renderBox(rank_barb_start, in_barb_by_rank, rank_barb_end, i_min, i_border_width, i_boxcolor, i_bgcolor, i_drawing_max, i_show_barb_rank and barstate.isconfirmed) f_renderBox(stdev_barb_start, in_barb_by_stdev, stdev_barb_end, i_min, i_border_width, i_boxcolor, i_bgcolor, i_drawing_max, i_show_barb_stdev and barstate.isconfirmed) [start_notif, end_notif, barb_count] = f_renderBox(barb_start, in_barb, barb_end, i_min, i_border_width, i_boxcolor, i_bgcolor, i_drawing_max, i_show_barb and barstate.isconfirmed) if in_barb and barb_count >= i_min is_smallest := false //////////////// // CONDITIONS // bar_type = close > open ? 1 : -1 hbar_type = ohlc4 > hopen ? 1 : -1 // TD Sequence var TD = 0 var TS = 0 TD := ohlc4 > ohlc4[4] ? nz(TD[1])+1 : 0 TS := ohlc4 < ohlc4[4] ? nz(TS[1])+1 : 0 TDUp = TD - ta.valuewhen(TD < TD[1], TD , 1) TDDn = TS - ta.valuewhen(TS < TS[1], TS , 1) is_priceflip = hbar_type != hbar_type[1] /////////////// // RENDERING // ////////////// // PLOTTING // color bar_color = na if i_barcolor if is_largest bar_color := i_largest_color else if is_smallest bar_color := i_smallest_color else bar_color := na barcolor(i_barcolor ? bar_color : na) plotshape(i_spot_smallest and is_smallest ? oc2[1] : na, 'Smallest bar', text="Smallest bar", style=shape.diamond, color=color.new(i_smallest_color, 30), location=location.absolute, size=size.tiny , textcolor=color.new(color.white, 100), offset=-1) plotshape(i_spot_largest and is_largest ? oc2[0] : na, 'Largest bar' , text="Largest bar" , style=shape.diamond, color=color.new(i_largest_color , 30), location=location.absolute, size=size.tiny , textcolor=color.new(color.white, 100)) plotshape(is_priceflip and hbar_type == -1 and TDUp and TD >= 12, 'Price flip sell', text="⌁", color=color_red , textcolor=color.white, style=shape.labeldown, location=location.abovebar, size=size.tiny, display=display.none) plotshape(is_priceflip and hbar_type == 1 and TDDn and TS >= 12, 'Price flip buy', text="⌁", color=color_blue, textcolor=color.white, style=shape.labelup , location=location.belowbar, size=size.tiny, display=display.none) /////////// // ALERT // alertcondition(start_notif, "Barbwire start", "Barbwire start") alertcondition(end_notif , "Barbwire end" , "Barbwire end" ) alertcondition(is_smallest, "The smallest bar", "The smallest bar appeared") ////////////// // ANALYSIS // i_analysis_show = false//input.bool(false, 'Analysis', group='ANALYSIS') i_analysis_asc = false//input.bool(false, 'Order ascending', group='ANALYSIS') verticalAdj = 0.6 lookbackLength = i_len//input.int(200, 'Length', group='ANALYSIS') priceHighest = ta.highest(high, lookbackLength) priceLowest = ta.lowest (low , lookbackLength) priceChangeRate = (priceHighest - priceLowest) / priceHighest oscTop = priceLowest * (1 - priceChangeRate * 0.2) oscBottom = priceLowest * (1 - priceChangeRate * verticalAdj) priceHighest := priceHighest * (1 + priceChangeRate * verticalAdj) barIndex = 0 oscHeight = oscTop - oscBottom oscHighest = array.max(a_data) analysis_data_ = f_get_data(HR, lookbackLength) analysis_data = array.new<float>() analysis_stdev = array.stdev(analysis_data_) if i_filter_stdev5 and array.size(analysis_data_) > 0 for i = 0 to array.size(analysis_data_) - 1 my_value = array.get(analysis_data_, i) if my_value < analysis_stdev * 5 array.push(analysis_data, my_value) else analysis_data := array.copy(analysis_data_) var a_line = array.new<line>() var a_labels = array.new<label>() if barstate.islast and i_analysis_show and array.size(analysis_data) > 0 if (array.size(a_line) > 0) for i = 0 to array.size(a_line) - 1 line.delete(array.shift(a_line)) if (array.size(a_labels) > 0) for i = 0 to array.size(a_labels) - 1 label.delete(array.shift(a_labels)) hightAdj = oscHeight / oscHighest rank = array.percentile_nearest_rank(analysis_data, i_rank_level) stdev = array.stdev(analysis_data) stdev_xs = stdev * i_stdev_xs stdev_s = stdev * i_stdev_s stdev_l = stdev * i_stdev_l if i_analysis_asc array.sort(analysis_data, order.ascending) array.push(a_line, line.new(bar_index, oscTop, bar_index - lookbackLength, oscTop, width=1, color=color.new(color.blue, 75))) array.push(a_line, line.new(bar_index, oscBottom, bar_index - lookbackLength, oscBottom, width=1)) array.push(a_line, line.new(bar_index, oscBottom, bar_index - lookbackLength, oscBottom, width=1)) array.push(a_line, line.new(bar_index, oscBottom + (rank * hightAdj), bar_index - lookbackLength, oscBottom + (rank * hightAdj), style=line.style_dotted, width=1, color=color.new(color.orange, 30))) array.push(a_line, line.new(bar_index, oscBottom + (stdev_xs * hightAdj), bar_index - lookbackLength, oscBottom + (stdev_xs * hightAdj), style=line.style_dotted, width=1, color=color.new(color.purple, 30))) array.push(a_line, line.new(bar_index, oscBottom + (stdev_l * hightAdj), bar_index - lookbackLength, oscBottom + (stdev_l * hightAdj), style=line.style_dotted, width=1)) array.push(a_labels, label.new(bar_index + 1, oscBottom + (rank * hightAdj), 'Rank', color=color.new(color.orange, 30), style=label.style_label_left, textcolor=color.white, size=size.tiny)) array.push(a_labels, label.new(bar_index + 1, oscBottom + (stdev_xs * hightAdj), 'Stdev XS', color=color.new(color.purple, 30), style=label.style_label_left, textcolor=color.white, size=size.tiny)) array.push(a_labels, label.new(bar_index + 1, oscBottom + (stdev_l * hightAdj), 'Stdev L' , color=color.new(color.blue , 30), style=label.style_label_left, textcolor=color.white, size=size.tiny)) xc = int(math.avg(bar_index, bar_index - lookbackLength)) array.push(a_line, line.new(xc, oscBottom, xc, oscBottom + oscHeight, style=line.style_dotted)) for i = 0 to array.size(analysis_data) - 1 y2 = array.get(analysis_data, i) color_bar = y2 < (rank) ? color.orange : y2 < (stdev) ? color.blue : color.from_gradient(50, 0, 100, color.blue, color.black) color_bar := y2 < stdev_xs ? color.purple : color_bar array.push(a_line, line.new(bar_index - i, oscBottom, bar_index - i, oscBottom + (y2 * hightAdj), color=color.new(color_bar, 40), width=2) )
Aroon [Loxx]
https://www.tradingview.com/script/T5K26ENP-Aroon-Loxx/
loxx
https://www.tradingview.com/u/loxx/
100
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator(title="Aroon [Loxx]", shorttitle="AR[Loxx]", timeframe="", timeframe_gaps=true) length = input.int(14, minval=1) showReg = input.bool(true, "Show Regular Signals", group = "Signal Options") showCont = input.bool(true, "Show Continuation Signals", group = "Signal Options") greencolor = color.lime redcolor = color.red upper = 100 * (ta.highestbars(high, length+1) + length)/length lower = 100 * (ta.lowestbars(low, length+1) + length)/length QQE2zlongQ = 0 QQE2zlongQ := nz(QQE2zlongQ[1]) QQE2zshortQ = 0 QQE2zshortQ := nz(QQE2zshortQ[1]) long_con = ta.crossover(upper, lower) and showReg short_con = ta.crossunder(upper, lower) and showReg cont_long = upper >= lower and QQE2zlongQ ==1 and ta.crossover(upper, upper[1]) and not long_con and showCont cont_short = upper < lower and QQE2zshortQ ==1 and ta.crossunder(lower, lower[1]) and not short_con and showCont qUp = ta.crossover(upper, lower) qLow = ta.crossunder(upper, lower) QQE2zlongQ := qUp ? 1 : qLow ? 0 : QQE2zlongQ QQE2zshortQ := qLow ? 1 : qUp ? 0 : QQE2zshortQ plot(upper, "Aroon Up", color=greencolor) plot(lower, "Aroon Down", color=redcolor) hline(120, color = color.new(color.gray, 100)) hline(-20, color = color.new(color.gray, 100)) plotshape(long_con, title = "Long", color = greencolor, textcolor = greencolor, text = "L", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(short_con, title = "Short", color = redcolor, textcolor = redcolor, text = "S", style = shape.triangledown, location = location.top, size = size.auto) plotshape(cont_long, title = "Continuation Long", color = greencolor, textcolor = greencolor, text = "CL", style = shape.triangleup, location = location.bottom, size = size.auto) plotshape(cont_short, title = "Continuation Short", color = redcolor, textcolor = redcolor, text = "CS", style = shape.triangledown, location = location.top, size = size.auto)
The Phi Club RSI3M3
https://www.tradingview.com/script/J5qW8kM2-The-Phi-Club-RSI3M3/
ThePhiClub
https://www.tradingview.com/u/ThePhiClub/
18
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© ThePhiClub //@version=4 study(title="Phi Club RSI3M3 from Walter J. Bressert", shorttitle="Bressert", overlay=false) requiredBars = input(title="Required bars", type=input.integer, defval=20, minval=2, step=1) overBought = input(title="Overbought region", defval=70, minval=51, maxval=100, step=1) overSold = input(title="Oversold region", defval=30, minval=1, maxval=49, step=1) sRSI = rsi(close, 3) sMA = sma(sRSI, 3) conditionUpArrow = if ((sMA > sMA[1]) and (sMA[1] < sMA[2]) and (sMA[1] < overSold)) 1 else na conditionDownArrow = if ((sMA < sMA[1]) and (sMA[1] > sMA[2]) and (sMA[1] > overBought)) 1 else na hline(title='OB', price=overBought, color=color.silver) hline(title='OS', price=overSold, color=color.silver) plot(series=sRSI, title="RSI", color=color.red) plot(series=sMA, title="MA", color=color.blue) plotshape(conditionUpArrow, style=shape.arrowup, color=color.green, size=size.auto, location=location.bottom) plotshape(conditionDownArrow, style=shape.arrowdown, color=color.red, size=size.auto, location=location.top)
The Phi Club - Dick Diamonds Indicator 1
https://www.tradingview.com/script/wpclHrMu-The-Phi-Club-Dick-Diamonds-Indicator-1/
ThePhiClub
https://www.tradingview.com/u/ThePhiClub/
27
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© ThePhiClub //@version=4 study(title="The Phi Club", shorttitle="Dick Diamonds Indicator 1", overlay=false) requiredBars = input(title="Required bars", type=input.integer, defval=20, minval=2, step=1) overBought = input(title="Overbought region", defval=70, minval=51, maxval=100, step=1) overSold = input(title="Oversold region", defval=30, minval=1, maxval=49, step=1) sRSI = rsi(close, 3) sMA = sma(sRSI, 3) conditionUpArrow = if ((sMA > sMA[1]) and (sMA[1] < sMA[2]) and (sMA[1] < overSold)) 1 else na conditionDownArrow = if ((sMA < sMA[1]) and (sMA[1] > sMA[2]) and (sMA[1] > overBought)) 1 else na hline(title='OB', price=overBought, color=color.silver) hline(title='OS', price=overSold, color=color.silver) plot(series=sRSI, title="RSI", color=color.red) plot(series=sMA, title="MA", color=color.blue) plotshape(conditionUpArrow, style=shape.arrowup, color=color.green, size=size.auto, location=location.bottom) plotshape(conditionDownArrow, style=shape.arrowdown, color=color.red, size=size.auto, location=location.top)
Top Trend [Loxx]
https://www.tradingview.com/script/NMTcVJcw-Top-Trend-Loxx/
loxx
https://www.tradingview.com/u/loxx/
143
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Top trend [Loxx]", shorttitle = "TT [Loxx]", overlay = true, timeframe="", timeframe_gaps=true) typebol = "Bollinger Bands" typekc = "Keltner Channels" type = input.string(typebol, "Calculation Type", options = [typebol, typekc], group = "Core Settings") src = input.source(close, "Source", group = "Core Settings") MoneyRisk= input.float(1.00, "Money Risk", group ="Core Settings", minval = 0) Length = input.int(20, "Length", group = typebol) Deviation = input.int(2, "Deviation", group = typebol) factor =input.int(3, "Multiplier", minval=1, group = typekc) periodATR =input.int(7, "ATR Period", minval=1, group =typekc) UptrendBuffer =0.0 DowntrendBuffer =0.0 trendBB = 0.0 bsmax = 0.0 bsmin = 0.0 [_, smax, _] = ta.bb(src, Length, Deviation) [_, _, smin] = ta.bb(src, Length, Deviation) if(src > smax[1]) trendBB:=1 if(src < smin[1]) trendBB:=-1 if(trendBB > 0 and smin <smin[1]) smin := smin[1] if(trendBB < 0 and smax > smax[1]) smax := smax[1] bsmax := smax + 0.5 * (MoneyRisk-1) * (smax-smin) bsmin := smin - 0.5 * (MoneyRisk-1) * (smax-smin) if(trendBB > 0 and bsmin < bsmin[1]) bsmin := bsmin[1] if(trendBB < 0 and bsmax > bsmax[1]) bsmax := bsmax[1] if (trendBB > 0) UptrendBuffer := bsmin if (trendBB < 0) DowntrendBuffer := bsmax ttBBout = 0. ttBBout := nz(ttBBout[1]) ttBBout := DowntrendBuffer > 0 ? DowntrendBuffer : UptrendBuffer > 0 ? UptrendBuffer : ttBBout up = src - (factor*ta.atr(periodATR)) dn = src + (factor*ta.atr(periodATR)) trendUp = 0.0 trendDown = 0.0 trendKC = 0.0 ttkc = 0.0 trendUp := close[1] > trendUp[1] ? math.max(up, trendUp[1]) : up trendDown := close[1] < trendDown[1] ? math.min(dn, trendDown[1]) : dn trendKC := close > trendDown[1] ? 1: close < trendUp[1] ? -1: nz(trendKC[1], 1) ttkc := trendKC == 1 ? trendUp + 0.5 * (MoneyRisk-1) * (trendUp-trendDown) : trendDown- 0.5 * (MoneyRisk-1) * (trendUp-trendDown) linecolorKC = trendKC == 1 ? color.lime : color.red linecolorBB = close > ttBBout ? color.lime : color.red plot(type == typekc ? ttkc : ttBBout , color = type == typekc ? linecolorKC : linecolorBB , linewidth = 2, title = "Top trend")
Ext/Non EMA Signals
https://www.tradingview.com/script/PtT9HG9k-Ext-Non-EMA-Signals/
DustinL89
https://www.tradingview.com/u/DustinL89/
46
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© DustinL89 //@version=5 indicator("Ext/Non EMA Signals", shorttitle="EMA Signals", overlay=true) //for use on extended sessons //get user input regularemasource= input(title="Regular EMA", defval=close) regularemalength= input(title="Regular EMA", defval=10) extendedemasource= input(title="Extended EMA", defval=close) extendedemalength= input(title="Extended EMA", defval=10) //Get data C = close O = open //get extended and regular sesion info textend = ticker.new (syminfo.prefix,syminfo.ticker,session.extended) treg = ticker.new (syminfo.prefix,syminfo.ticker,session.regular) extended = request.security(textend,timeframe.period, ta.ema(extendedemasource,extendedemalength),barmerge.gaps_on) regular = request.security(treg,timeframe.period, ta.ema(regularemasource,regularemalength),barmerge.gaps_on) //plotline plot(extended,"Extended Session Line",color=color.new(color.red,0)) plot(regular,"Regular Session Line",color=color.new(color.red,0)) //Signal Identifier GoShort = C >= O and C < extended and C < regular GoLong = C <= O and C > extended and C > regular //plot singals to chart plotshape(GoLong, title="Bullish Signal", location=location.abovebar, color=color.new(color.green,0), style=shape.triangledown) plotshape(GoShort, title="Bearish Signal", location=location.belowbar, color=color.new(color.red, 0), style=shape.triangleup)
DirectionalBarBNBUSDT
https://www.tradingview.com/script/WXOSoC8I/
nortegabonilla
https://www.tradingview.com/u/nortegabonilla/
9
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© nortegabonilla //@version=5 indicator("Directional_Candle", overlay=true) //TP y SL Alcista velas direccionales A1 //plot(close*1.0075,"Take Profit Up", color.green) //plot(close+(2*(close-(low*0.999))),"R2-UP", color.yellow) //plot(close+((close-(low*0.999))),"R1-UP", color.orange) //plot(low*0.999,"Stop Loss Up", color.red) plot(low-0.02,"SL-LONG", color.red) plot((low-0.02)*1.0035,"ENTRY-LONG", color.green) plot((low-0.02)*1.00875,"TP-LONG", color.blue) plot(close*1.005,"TP-LONG-MARKET", color.orange) //TP y SL Bajista velas direccionales B3 //plot(close*0.9925,"Take Profit Down", color.green) //plot(close-(2*((high*1.001)-close)),"R2-DOWN", color.yellow) //plot(close-((high*1.001)-close),"R1-DOWN", color.orange) //plot(high*1.001,"Stop Loss Down", color.red) plot(high+0.02,"SL-SHORT", color.red) plot((high+0.02)*0.9965,"ENTRY-SHORT", color.green) plot((high+0.02)*0.99125,"TP-SHORT", color.blue) plot(close*0.995,"TP-SHORT-MARKET", color.orange) //A1 //barcolor ((close > open and close > high[1] and ((close-low)/(high-low) > 0.66)) ? color.blue : na) plotshape((close > open and close > high[1] and ((close-low)/(high-low) > 0.66)), title="Candle A1", text='A1'+'\n', location=location.belowbar, style=shape.cross, size=size.tiny, color=color.green, textcolor=color.gray, transp=0) //B3 //barcolor ((close < open and close < low[1] and ((high-close)/(high-low) > 0.66)) ? color.orange : na) plotshape((close < open and close < low[1] and ((high-close)/(high-low) > 0.66)), title="Candle B3", text='B3'+'\n', location=location.abovebar, style=shape.cross, size=size.tiny, color=color.red, textcolor=color.gray, transp=0) //Rechazo alcista //barcolor ((close > open and ((high-open)/(high-low) < 0.33)) ? color.blue : na) plotshape((close > open and ((high-open)/(high-low) < 0.33)), title="Rejection Up", text='RU'+'\n', location=location.belowbar, style=shape.cross, size=size.tiny, color=color.green, textcolor=color.gray, transp=1) //Rechazo bajista //barcolor ((close < open and ((open-low)/(high-low) < 0.33)) ? color.orange : na) plotshape((close < open and ((open-low)/(high-low) < 0.33)), title="Rejection Down", text='RD'+'\n', location=location.abovebar, style=shape.cross, size=size.tiny, color=color.red, textcolor=color.gray, transp=0) //Envolvente alcista //barcolor ((open[1] > close [1] and open < close and high > high[1] and low < low[1]) ? color.blue : na) plotshape((open[1] > close [1] and open < close and high > high[1] and low < low[1]), title="Engulfing Up", text='EU'+'\n', location=location.belowbar, style=shape.cross, size=size.tiny, color=color.green, textcolor=color.gray, transp=0) //Envolvente bajista //barcolor ((open[1] < close [1] and open > close and low < low[1] and high > high[1]) ? color.orange : na) plotshape((open[1] < close [1] and open > close and low < low[1] and high > high[1]), title="Engulfing Down", text='ED'+'\n', location=location.abovebar, style=shape.cross, size=size.tiny, color=color.red, textcolor=color.gray, transp=0) //Vela interior alcista //barcolor ((open[1] > close [1] and open < close and high < high[1] and low > low[1]) ? color.blue : na) plotshape((open[1] > close [1] and open < close and high < high[1] and low > low[1]), title="Inside Up", text='IU'+'\n', location=location.belowbar, style=shape.cross, size=size.tiny, color=color.green, textcolor=color.gray, transp=0) //Vela interior bajista //barcolor ((open[1] < close [1] and open > close and high < high[1] and low > low[1]) ? color.orange : na) plotshape((open[1] < close [1] and open > close and high < high[1] and low > low[1]), title="Inside Down", text='ID'+'\n', location=location.abovebar, style=shape.cross, size=size.tiny, color=color.red, textcolor=color.gray, transp=0) //Entrada en largo TP/Sl //plotshape((close > open and close > high[1] and ((close-low)/(high-low) > 0.66)) or (close > open and ((high-open)/(high-low) < 0.33)) or (open[1] > close [1] and open < close and high > high[1] and low < low[1]) or (open[1] > close [1] and open < close and high < high[1] and low > low[1]), title="Long", text="", location=location.abovebar, style=shape.diamond, size=size.tiny, color=color.green, textcolor=color.gray, transp=0) //Entrada en corto TP/SL //plotshape((close < open and close < low[1] and ((high-close)/(high-low) > 0.66)) or (close < open and ((open-low)/(high-low) < 0.33)) or (open[1] < close [1] and open > close and low < low[1] and high > high[1]) or (open[1] < close [1] and open > close and high < high[1] and low > low[1]), title="Short", text="", location=location.belowbar, style=shape.diamond, size=size.tiny, color=color.red, textcolor=color.gray, transp=0) //l = label.new(bar_index, high, '\n\n\n\n\n\n\n\n\n\n\n\n\nTP-UP: '+ str.tostring(close*1.0075) + '\n SL-UP:' + str.tostring(low*0.999) + '\nR-UP: ' + str.tostring(((high*1.0075)-close)/(close-(low*0.999))) + '\n\nTP-DOWN: '+ str.tostring(close*0.9925) + '\n SL-DOWN:' + str.tostring(high*1.001) + '\nR-DOWN: ' + str.tostring((close-(low*0.9925))/((high*1.001)-close)), color=close > open ? color.white : color.white, textcolor=color.black, style=label.style_none, yloc=yloc.belowbar) //l = label.new(bar_index, high, '\n\n\n\n\n\n\n\n\n\n\n\n\nSL-LONG: '+ str.tostring(low-0.02) + '\n ENTRY-LONG:' + str.tostring((low-0.02)*1.0035) + '\n TP-LONG:' + str.tostring((low-0.02)*1.0105) + '\n SL-SHORT:' + str.tostring(high+0.002) + '\n ENTRY-SHORT: ' + str.tostring((high+0.02)*0.9895) + '\n TP-SHORT: ' + str.tostring((high+0.02)*0.993), color=close > open ? color.white : color.white, textcolor=color.black, style=label.style_none, yloc=yloc.belowbar) //label.delete(l[1]) //m = label.new(bar_index, high, '\n\nTPDOWN: '+ str.tostring(close*0.9925) + '\n SL:' + str.tostring(high*1.001) + '\nR: ' + str.tostring(((high*1.001)-close)/(close-(low*0.9925))), color=close < open ? color.white : color.white, textcolor=color.red, style=label.style_none, yloc=yloc.belowbar) //label.delete(m[1])
Neuracap Price Widget
https://www.tradingview.com/script/X53t3lOG-Neuracap-Price-Widget/
saroj1960mittal
https://www.tradingview.com/u/saroj1960mittal/
4
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© NeuraCap //@version=5 indicator('Neuracap Price Widget', shorttitle='NeuraCap Px widget', overlay=true) //////////// // INPUTS // weeks = input(52, "Number of Weeks") show_ath = input(true, "Show High?") show_atl = input(true, "Show Low?") show_table = input(true, "Show table with stats?") /////////////// // FUNCTIONS // // get 52 weeks high/low get_week_high_low() => var time_arr = array.new_int(0) var high_arr = array.new_float(0) var low_arr = array.new_float(0) array.unshift(time_arr, time) array.unshift(high_arr, high) array.unshift(low_arr, low) ms_limit = 604800000 * weeks while (array.get(time_arr, array.size(time_arr) - 1) < time - ms_limit) array.pop(time_arr) array.pop(high_arr) array.pop(low_arr) // getting all-time high/low ath = array.max(high_arr) atl = array.min(low_arr) hi = 0 while true if array.get(high_arr, hi) == ath break hi += 1 li = 0 while true if array.get(low_arr, li) == atl break li += 1 ath_dt = array.get(time_arr, hi) atl_dt = array.get(time_arr, li) [ath, atl, ath_dt, atl_dt] [ath, atl, ath_dt, atl_dt] = request.security(syminfo.tickerid, '1D', get_week_high_low()) ath_days = math.round((timenow - ath_dt) / 86400000) atl_days = math.round((timenow - atl_dt) / 86400000) // get pre-covid high and covid low get_covid_high_low() => var time1_arr = array.new_int(0) var high1_arr = array.new_float(0) var low1_arr = array.new_float(0) ms_limit1 = 604800000 * 112 //112 weeks difference ms_limit2 = 604800000 * 125 //125 time1 = time - ms_limit1 array.unshift(time1_arr, time1) array.unshift(high1_arr, high) array.unshift(low1_arr, low) while (array.get(time1_arr, array.size(time1_arr) -1) < time1 - ms_limit2) array.pop(time1_arr) array.pop(high1_arr) array.pop(low1_arr) // getting pre-covid high and covid low cvh = array.max(high1_arr) cvl = array.min(low1_arr) hi = 0 while true if array.get(high1_arr, hi) == cvh break hi += 1 li = 0 while true if array.get(low1_arr, li) == cvl break li += 1 [cvh, cvl] [cvh, cvl] = request.security(syminfo.tickerid, '1D', get_covid_high_low()) // plotting if show_ath lATH=line.new(bar_index - 1, ath, bar_index, ath, extend = extend.both, color = color.green) line.delete(lATH[1]) if show_atl lATL=line.new(bar_index - 1, atl, bar_index, atl, extend = extend.both, color = color.red) line.delete(lATL[1]) if show_table var table ATHtable = table.new(position.top_right, 6, 5, frame_color = color.gray, bgcolor = color.gray, border_width = 1, frame_width = 1, border_color = color.white) ath_time = str.tostring(year(ath_dt)) + "-" + str.tostring(month(ath_dt)) + "-" + str.tostring(dayofmonth(ath_dt)) atl_time = str.tostring(year(atl_dt)) + "-" + str.tostring(month(atl_dt)) + "-" + str.tostring(dayofmonth(atl_dt)) // Header table.cell(ATHtable, 0, 0, "", bgcolor = #cccccc) table.cell(ATHtable, 1, 0, "When?", bgcolor = #cccccc) table.cell(ATHtable, 2, 0, "Days ago", bgcolor = #cccccc) table.cell(ATHtable, 3, 0, "Price", bgcolor = #cccccc) table.cell(ATHtable, 4, 0, "% Away", bgcolor = #cccccc) table.cell(ATHtable, 5, 0, "$ Diff", bgcolor = #cccccc) if (show_ath) // ATH table.cell(ATHtable, 0, 1, "Dist from High", bgcolor = #cccccc) table.cell(ATHtable, 1, 1, ath_time, bgcolor = color.new(color.green, transp = 25)) table.cell(ATHtable, 2, 1, str.tostring(ath_days), bgcolor = color.new(color.green, transp = 25)) table.cell(ATHtable, 3, 1, str.tostring(ath), bgcolor = color.new(color.green, transp = 25)) table.cell(ATHtable, 4, 1, str.tostring((1- (close/ath )) * 100 , "#.##") + "%", bgcolor = color.new(color.green, transp = 25)) table.cell(ATHtable, 5, 1, str.tostring(ath - close , "#.##") + "$", bgcolor = color.new(color.green, transp = 25)) if (show_atl) // ATL table.cell(ATHtable, 0, 2, "Dist from Low", bgcolor = #cccccc) table.cell(ATHtable, 1, 2, atl_time, bgcolor = color.new(color.red, transp = 25)) table.cell(ATHtable, 2, 2, str.tostring(atl_days), bgcolor = color.new(color.red, transp = 25)) table.cell(ATHtable, 3, 2, str.tostring(atl), bgcolor = color.new(color.red, transp = 25)) table.cell(ATHtable, 4, 2, str.tostring(((close / atl) - 1) * 100 , "#.##") + "%", bgcolor = color.new(color.red, transp = 25)) table.cell(ATHtable, 5, 2, str.tostring(atl - close, "#.##") + "$", bgcolor = color.new(color.red, transp = 25)) table.cell(ATHtable, 0, 3, "Returns L2H", bgcolor = #cccccc) table.cell(ATHtable, 1, 3, "", bgcolor = color.new(color.white, transp = 25)) table.cell(ATHtable, 2, 3, str.tostring(""), bgcolor = color.new(color.white, transp = 25)) table.cell(ATHtable, 3, 3, str.tostring(""), bgcolor = color.new(color.white, transp = 25)) table.cell(ATHtable, 4, 3, str.tostring(((ath/ atl) - 1) * 100 , "#.##") + "%", bgcolor = color.new(color.white, transp = 25)) table.cell(ATHtable, 5, 3, str.tostring(ath - atl, "#.##") + "$", bgcolor = color.new(color.white, transp = 25)) // table.cell(ATHtable, 0, 4, "COVID H/L", bgcolor = #cccccc) // table.cell(ATHtable, 1, 4, "pre-cov Hi", bgcolor = color.new(color.white, transp = 25)) // table.cell(ATHtable, 2, 4, str.tostring(cvh), bgcolor = color.new(color.white, transp = 25)) // table.cell(ATHtable, 3, 4, str.tostring("covid low"), bgcolor = color.new(color.white, transp = 25)) // table.cell(ATHtable, 4, 4, str.tostring(cvl), bgcolor = color.new(color.white, transp = 25)) // table.cell(ATHtable, 5, 4, str.tostring(""), bgcolor = color.new(color.white, transp = 25)) // alerts alertcondition(ta.crossover(high, ath), 'All-time High!', 'All-time High!') alertcondition(ta.crossunder(low, atl), 'All-time Low!', 'All-time Low!')
Volume Gain
https://www.tradingview.com/script/WwAqwGP0-Volume-Gain/
carlpwilliams2
https://www.tradingview.com/u/carlpwilliams2/
56
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© carlpwilliams2 // This shows the distance, as a percentage, that the volume is currently over the average volume. //@version=5 indicator("Volume Gain %") volumeTimeframe = input.timeframe("",title="Volume Timeframe", group="Volume") volumeMaLength = input.int(30, title="Volume MA length", group="Volume") volumeGainUpperLimit = input.float(50, title="Volume gain Upper Limit", group="Limits") volumeGainLowerLimit = input.float(-50, title="Volume gain Lower Limit", group="Limits") volumeSrc = request.security(syminfo.tickerid,volumeTimeframe,volume, barmerge.gaps_on) volMa = ta.ema(volumeSrc, volumeMaLength) volumeGain = ((volumeSrc-volMa)/volumeSrc)*100 volumeBullish = close>open upper = plot(volumeGainUpperLimit, title="Volume Gain Upper line", color=color.new(color.gray,60)) lower = plot(volumeGainLowerLimit, title="Volume Gain lower line", color=color.new(color.gray,60)) fill(upper,lower,color.new(color.gray,80)) plot(volumeGain, title="Volume Gain", color=volumeBullish?color.green:color.red, linewidth=2)
TicTop Indicator
https://www.tradingview.com/script/GzOdCN4T-TicTop-Indicator/
Donniee_Brasco
https://www.tradingview.com/u/Donniee_Brasco/
35
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Donniee_Brasco //@version=5 indicator("Stocks Percent Change Monitor", overlay=false) stock1 = input.symbol(defval="AAPL", title="Symbol 1") stock2 = input.symbol(defval="MSFT", title="Symbol 2") stock3 = input.symbol(defval="AMZN", title="Symbol 3") stock4 = input.symbol(defval="TSLA", title="Symbol 4") stock5 = input.symbol(defval="GOOGL", title="Symbol 5") stock6 = input.symbol(defval="NVDA", title="Symbol 6") stock1_pctchange = ((request.security(stock1, "D", close)/request.security(stock1, "D", close[1]))-1)*100 stock2_pctchange = ((request.security(stock2, "D", close)/request.security(stock2, "D", close[1]))-1)*100 stock3_pctchange = ((request.security(stock3, "D", close)/request.security(stock3, "D", close[1]))-1)*100 stock4_pctchange = ((request.security(stock4, "D", close)/request.security(stock4, "D", close[1]))-1)*100 stock5_pctchange = ((request.security(stock5, "D", close)/request.security(stock5, "D", close[1]))-1)*100 stock6_pctchange = ((request.security(stock6, "D", close)/request.security(stock6, "D", close[1]))-1)*100 plot(math.avg(stock1_pctchange,stock2_pctchange,stock3_pctchange,stock4_pctchange,stock5_pctchange,stock6_pctchange), style=plot.style_columns)
SKYROCKET | CBDR Range
https://www.tradingview.com/script/iPnzMKb7-SKYROCKET-CBDR-Range/
adelghaeinian
https://www.tradingview.com/u/adelghaeinian/
254
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© adelghaeinian //@version=5 indicator("SKYROCKET | CBDR Range", overlay=true, max_lines_count = 500) range_start_hour = input.int(defval=12, minval=0, maxval=23, title="Range start Hour", group="START", inline="start") range_start_minute = input.int(defval=0, minval=0, maxval=59, title="Minutes", group="START", inline="start") range_end_hour = input.int(defval=13, minval=0, maxval=23, title="Range start Hour", group="END", inline="end") range_end_minute = input.int(defval=0, minval=0, maxval=59, title="Minutes", group="END", inline="end") count = input(3, title="Count") colorTop = input(color.green) colorBetween = input(color.new(color.gray, 50)) colorBottom = input(color.red) colorRange = input(color.blue) rangeIsDotted = input(true, "Dash Line Style For The Range") plot_mid = input(true) close_to_close = input(false, "Close To Close (instead of low to high distance)") isInRange = hour*60 + minute<= (range_end_hour*60+range_end_minute) and hour*60 + minute > range_start_minute+range_start_hour*60 isOnEnd = hour[1]*60 + minute[1] < range_end_hour*60+range_end_minute and hour*60 + minute >= range_end_hour*60+range_end_minute isOnStart = hour[1]*60 + minute[1] < range_start_minute+range_start_hour*60 and hour*60 + minute >= range_start_minute+range_start_hour*60 var startIDX = -1 var range_high = -100000.0 var range_low = 99999999.9 var distance = 0.0 if isOnStart startIDX:=bar_index if isInRange if not close_to_close range_high := math.max(range_high, high) range_low:= math.min(range_low, low) if close_to_close range_high := math.max(range_high, close) range_low:= math.min(range_low, close) distance := range_high - range_low if isOnEnd line.new(startIDX, range_high, bar_index, range_high, xloc=xloc.bar_index, style=rangeIsDotted?line.style_dashed:line.style_solid, color=colorRange) line.new(startIDX, range_low, bar_index, range_low, xloc=xloc.bar_index, style=rangeIsDotted?line.style_dashed:line.style_solid, color=colorRange) for i = 1 to count line.new(startIDX, range_high + i*distance, bar_index, range_high + i*distance, xloc=xloc.bar_index, style=line.style_solid, color=colorTop) if plot_mid for i = 1 to count line.new(startIDX, range_high + (i-1)*distance + distance/2, bar_index, range_high + (i-1)*distance + distance/2, xloc=xloc.bar_index, style=line.style_dashed, color=colorBetween) for i = 1 to count line.new(startIDX, range_low - (i-1)*distance - distance/2, bar_index, range_low - (i-1)*distance - distance/2, xloc=xloc.bar_index, style=line.style_dashed, color=colorBetween) for i = 1 to count line.new(startIDX, range_low - i*distance, bar_index, range_low - i*distance, xloc=xloc.bar_index, style=line.style_solid, color=colorBottom) range_high := -100000.0 range_low := 99999999.9
EMA -PA
https://www.tradingview.com/script/7pOW0Pzt-EMA-PA/
suitableGnu11617
https://www.tradingview.com/u/suitableGnu11617/
17
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Bookmaster9 //@version=4 study(title="ema clouds by granolabar", shorttitle="EMA - PA", overlay=true) ema13 = ema(close, 13) ema21 = ema(close, 21) ema13plot = plot(ema13, color=#2ecc71, transp=100, style=plot.style_line, linewidth=1, title="EMA(13)") ema21plot = plot(ema21, color=#f00b0b, transp=100, style=plot.style_line, linewidth=1, title="EMA(21)") fill(ema13plot, ema21plot, color=ema13 > ema21 ? color.lime : color.teal, transp=60, editable=true)
EMA -PA
https://www.tradingview.com/script/7SwNnSFX-EMA-PA/
suitableGnu11617
https://www.tradingview.com/u/suitableGnu11617/
9
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Bookmaster9 //@version=4 study(title="ema clouds by granolabar", shorttitle="EMA - PA", overlay=true) ema13 = ema(close, 13) ema21 = ema(close, 21) ema13plot = plot(ema13, color=#2ecc71, transp=100, style=plot.style_line, linewidth=1, title="EMA(13)") ema21plot = plot(ema21, color=#f00b0b, transp=100, style=plot.style_line, linewidth=1, title="EMA(21)") fill(ema13plot, ema21plot, color=ema13 > ema21 ? color.lime : color.teal, transp=60, editable=true)
FiboBars Extended
https://www.tradingview.com/script/65SeqrsO-FiboBars-Extended/
CapitalizatorUA
https://www.tradingview.com/u/CapitalizatorUA/
42
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© CapitalizatorUA //@version=5 indicator("FiboBars Extended", overlay=true) int Period = input.int(title= "Period", defval=7, minval=1) float hgst = ta.highest(high,Period) float lwst = ta.lowest(low,Period) level = input.float(title="Level", defval=0.236, options=[0.000, 0.236, 0.382, 0.500, 0.618, 0.764, 1.000, 1.382, 1.618]) int trend = 0 int trend1 =if ((trend[1]>=0) and (((hgst-lwst)*level)<(close[0])-lwst)) 1 else -1 int trend2 =if(trend[1]<=0)and((hgst-lwst)*level<(hgst-close[0])) -1 else 1 trend:=if (open[0]>close[0]) trend1 else trend2 barcolor(trend>0 ? #008000 : #ffcccb)
Infiten's Return Candle Oscillator
https://www.tradingview.com/script/Zxd98cbo-Infiten-s-Return-Candle-Oscillator/
spiritualhealer117
https://www.tradingview.com/u/spiritualhealer117/
26
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© spiritualhealer117 //@version=4 study("RCO") len = input(title="Short Length", type=input.integer, defval=14) long_len = input(title="Long Length", type=input.integer, defval=14) o_c = (open-open[1])/open[1] + 1 l_c = (low-low[1])/low[1]+ 1 h_c = (high-high[1])/high[1]+ 1 c_c = (close-close[1])/close[1]+ 1 ocprod = 1.0 ccprod = 1.0 lcprod = 1.0 hcprod = 1.0 for i = 0 to len ocprod := ocprod * o_c[i] lcprod := lcprod * l_c[i] hcprod := hcprod * h_c[i] ccprod := ccprod * c_c[i] rco_av = ((ccprod+hcprod+lcprod+ocprod)/4)-1 rco_max_thresh = highest(rco_av,long_len) rco_min_thresh = lowest(rco_av,long_len) rco_smoothed = sma(rco_av, long_len) hline(0) c = rco_av>0?color.new(color.green,min(75,abs((rco_max_thresh[1]-rco_av)/rco_av)*100)):color.new(color.red,min(75,abs((rco_min_thresh[1]-rco_av)/rco_av)*100)) plot(rco_smoothed, color=c, linewidth=4) plotcandle(ccprod-1, hcprod-1, lcprod-1, ocprod-1, title = 'RCO', color = ocprod < ccprod ? color.green : color.red, wickcolor= ocprod < ccprod ? color.green : color.red,bordercolor= ocprod < ccprod ? color.green : color.red)
Overnight inventory
https://www.tradingview.com/script/KyU8kIBI-Overnight-inventory/
sl-wk
https://www.tradingview.com/u/sl-wk/
98
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© sl-wk //@version=5 indicator("Overnight inventory", overlay=true) //-------------------------------inputs---------------------------------------// t_y_pos = input.string(defval="middle", title=" Table Position", inline="11", options=["top", "middle", "bottom"], group="Table") t_x_pos = input.string(defval="right", title="", inline="11", options=["left", "center", "right"], group="Table") input_on = input.session("1615-0930", title="Overnight session (EST)", group="ON settings") i_length = input.int(defval=16, title="ON range lookback", minval=1, maxval=200, group="ON settings") var on_range_arr = array.new_float(i_length, 0) on_len = 465 var above_arr = array.new_float(on_len, 0) var below_arr = array.new_float(on_len, 0) var volume_arr = array.new_float(i_length, 0) //------------------------------adding values to arrays-----------------------// f_add_to_array(_arr, _val, _len) => len = array.size(_arr) if (len == _len) array.pop(_arr) array.unshift(_arr, _val) else array.unshift(_arr, _val) //---------------------------previous close calculations----------------------// getValueAt(_h, _m, _value) => v_period = timestamp('GMT-4',year(time), month(time), dayofmonth(time)[1], _h, _m) b_period = time >= v_period and time[1] < v_period valueAt = ta.valuewhen(b_period, _value, 0) on_session = time(timeframe.period,str.format("{0}:1234567", input_on), "GMT-4") cr_close = on_session ? getValueAt(16,15, open) : getValueAt(16,14, close) isToday = false if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time) isToday := true isToday //-------------------------calculations of overnight's volume-----------------// if on_session if close > cr_close f_add_to_array(above_arr, volume, on_len) else f_add_to_array(below_arr, volume, on_len) else array.clear(above_arr) array.clear(below_arr) sum_above = array.sum(above_arr) sum_below = array.sum(below_arr) volume_long = math.round((sum_above / (sum_above + sum_below))*100) volume_short = math.round((sum_below / (sum_above + sum_below))*100) volume_net = na(sum_above) and close < cr_close ? -100 : na(sum_below) and close > cr_close ? 100 : volume_long - volume_short //-------------------------Volume Traded function-----------------------------// getVolume(period) => gt_session = time(timeframe.period,str.format("{0}:1234567", period), "GMT-4") var volume_sum = 0.0 if gt_session if not gt_session[1] volume_sum := volume else volume_sum := volume + nz(volume_sum[1]) formated_vol = math.round(volume_sum /1000) //---------------------previous ON ranges calculations------------------------// getRange(period) => gt_session = time(timeframe.period,str.format("{0}:1234567", period), "GMT-4") var period_high = 0.0 var period_low = 0.0 if gt_session if not gt_session[1] period_low := low period_high := high else period_low := math.min(low, period_low) period_high := math.max(high, period_high) period_high - period_low //--------------------------------final calculations--------------------------// vol_traded = getVolume(input_on) on_range = getRange(input_on) savePeriod_i = timestamp('GMT-4',year(time), month(time), dayofmonth(time), 16, 00) savePeriod = time >= savePeriod_i and time[1] < savePeriod_i if savePeriod f_add_to_array(on_range_arr, on_range, i_length) f_add_to_array(volume_arr, vol_traded, i_length) avg_on_range = array.median(on_range_arr) st_on_range = array.stdev(on_range_arr) z_on_range = (on_range - avg_on_range) / st_on_range on_range_color = z_on_range > 1 ? color.lime : z_on_range < -1 ? color.red : color.gray vol_avg = array.avg(volume_arr) vol_st = array.stdev(volume_arr) vol_zsc = math.round((vol_traded - vol_avg) / vol_st,2) plotchar(volume_net, 'SL low', '', location.top, color.gray, size=size.tiny) //---------------------------------forming the table--------------------------// if barstate.islast if timeframe.isminutes and timeframe.multiplier < 60 table rangeTable = table.new(t_y_pos + "_" + t_x_pos, 2, 4) table.cell(rangeTable, 0, 0, "ON range:", text_color=color.gray, text_halign=text.align_right) table.cell(rangeTable, 1, 0, na(z_on_range) ? "-" : str.tostring(math.round(z_on_range,2))+"Οƒ", text_color=on_range_color, text_halign=text.align_left) table.cell(rangeTable, 0, 1, "Inv. net:", text_color=color.gray, text_halign=text.align_right) table.cell(rangeTable, 1, 1, na(volume_net) ? "-" : str.tostring(volume_net)+"%", text_color=color.gray, text_halign=text.align_left) table.cell(rangeTable, 0, 2, "Vol traded:", text_color=color.gray, text_halign=text.align_right) table.cell(rangeTable, 1, 2, na(vol_traded) ? "-" : str.tostring(math.round(vol_traded,0))+"k", text_color=color.gray, text_halign=text.align_left) table.cell(rangeTable, 0, 3, "Vol range:", text_color=color.gray, text_halign=text.align_right) table.cell(rangeTable, 1, 3, na(vol_zsc) ? "-" : str.tostring(vol_zsc)+"Οƒ", text_color=color.gray, text_halign=text.align_left)
Hybrid, Zero lag, Adaptive cycle MACD [Loxx]
https://www.tradingview.com/script/4f9LDGMZ-Hybrid-Zero-lag-Adaptive-cycle-MACD-Loxx/
loxx
https://www.tradingview.com/u/loxx/
157
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© loxx //@version=5 indicator("Hybrid, Zero lag, Adaptive cycle MACD [Loxx]", shorttitle = "HZLACMACD [Loxx]", timeframe="", timeframe_gaps=true, max_bars_back = 5000) RMA(x, t) => EMA1 = x EMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (1/t) + nz(EMA1[1]) EMA1 EMA(x, t) => EMA1 = x EMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (2 / (t + 1)) + nz(EMA1[1]) EMA1 _bpDom(len, bpw, mult) => HP = 0.0 BP = 0.0 Peak = 0.0 Real = 0.0 counter = 0.0 DC = 0.0 alpha2 = (math.cos(0.25 * bpw * 2 * math.pi / len) + math.sin(0.25 * bpw * 2 * math.pi / len) - 1) / math.cos(0.25 * bpw * 2 * math.pi / len) HP := (1 + alpha2 / 2) * (close - nz(close[1])) + (1 - alpha2) * nz(HP[1]) beta1 = math.cos(2 * math.pi / len) gamma1 = 1 / math.cos(2 * math.pi * bpw / len) alpha1 = gamma1 - math.sqrt(gamma1 * gamma1 - 1) BP := 0.5 * (1 - alpha1) * (HP - nz(HP[2])) + beta1 * (1 + alpha1) * nz(BP[1]) - alpha1 * nz(BP[2]) BP := bar_index == 1 or bar_index == 2 ? 0 : BP Peak := 0.991 * Peak Peak := math.abs(BP) > Peak ? math.abs(BP) : Peak Real := Peak != 0 ? BP / Peak : Real DC := nz(DC[1]) DC := DC < 6 ? 6 : DC counter := counter[1] + 1 if ta.crossover(Real, 0) or ta.crossunder(Real, 0) DC := 2 * counter if 2 * counter > 1.25 * nz(DC[1]) DC := 1.25 * DC[1] if 2 * counter < 0.8 * nz(DC[1]) DC := 0.8 * nz(DC[1]) counter := 0 temp_out = mult * DC temp_out ZL = "Zero lag" R = "Regular" macd_type = input.string(ZL, title='MACD Type', options=[ZL, R], group='MACD') calc_type = input.string("Fixed", title='Calculation Type', options=["Band-pass Dominant Cycle", "Fixed"], group='MACD', tooltip = "Default is Fixed, this is the regular calculation for MACD and signal length inputs. If you choose Band-pass, then all fixed length inputs are ignored and the Band-pass Dominant Cycle measure will be used instead. You can see the Band-pass cycle lengths in the info window to fine-tune the signal.") macdSrc = input.source(close, title='Source', group='MACD') f_length_i = input.int(12, title="Fast Length", group='MACD') s_length_i = input.int(24, title='Slow Length', group='MACD') signalLen = input.int(9, title='Signal Length', group='MACD') bp_period = input.int(13, "Band-pass Period", minval = 1, group = "Band-pass") bp_width = input.float(0.20, "Band-pass Width", step = 0.1, group = "Band-pass") cycle_len = input.float(100, "MACD Percent of Dominant Cycle (%)", step = 1.0, group = "Band-pass", tooltip ="View info window to see how this changes the value of the MACD MA length inputs")/100 efi_reduction = input.float(75, "Signal Percent of Dominant Cycle (%) ", step = 1.0, group = "Band-pass", tooltip ="View info window to see how this changes the value of the MACD MA length inputs")/100 slMult = input.float(2.0, "MACD Slow-to-Fast Multiple", step = 0.1, group = "Band-pass", tooltip = "The multiple of Slow-to-Fast used to calculate the dynamic lenth of the MACD slow and fast MA inputs. For example, regular MACD is 12 and 24, fast and slow. So a multiple of 2 would mean the following: Slow length = (Fast length X 2).") macd_ma_type = input.string("EMA", title='Oscillator MA Type', options=["ALMA", "DEMA", "EMA", "LSMA", "RMA", "SMA", "TEMA", "TRIMA", "VWMA", "WMA"], group='MACD') sig_type = input.string("EMA", title='Signal Line MA Type', options=["ALMA", "DEMA", "EMA", "LSMA", "RMA", "SMA", "TEMA", "TRIMA", "VWMA", "WMA"], group='MACD') col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD") col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal") col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above") col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above") col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below") col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below") alma_offset = input.float(defval=0.85, title="* Arnaud Legoux Moving Average (ALMA) Only - Offset", group = "Moving Average Inputs") alma_sigma = input.int(defval=6, title="* Arnaud Legoux Moving Average (ALMA) Only - Sigma", group = "Moving Average Inputs") lsma_offset = input.int(defval=0, title="* Least Squares Moving Average (LSMA) Only - Offset", group = "Moving Average Inputs") variant(type, src, len) => sig = 0.0 if type == "ALMA" sig := ta.alma(src, len, alma_offset, alma_sigma) else if type == "SMA" sig := ta.sma(src, len) else if type == "EMA" sig := EMA(src, len) else if type == "DEMA" sig := 2 * EMA(src, len) - EMA(EMA(src, len), len) else if type == "TEMA" sig := 3 * (EMA(src, len) - EMA(EMA(src, len), len)) + EMA(EMA(EMA(src, len), len), len) else if type == "WMA" sig := ta.wma(src, len) else if type == "TRIMA" sig := ta.sma(ta.sma(src, math.ceil(len / 2)), math.floor(len / 2) + 1) else if type == "RMA" sig := RMA(src, len) else if type == "VWMA" sig := ta.vwma(src, len) else if type == "LSMA" sig := ta.linreg(src, len, lsma_offset) sig _macd(src, m_type, ma_type, s_type, f_len, s_len, sig_len, sig_type_in) => fast_MA1 = variant(ma_type, src, f_len) fast_MA2 = variant(ma_type, fast_MA1, f_len) diff_fast = fast_MA1 - fast_MA2 zlag_fast= fast_MA1 + diff_fast slow_MA1 = variant(ma_type, src, s_len) slow_MA2 = variant(ma_type, slow_MA1, s_len) diff_slow = slow_MA1 - slow_MA2 zlag_slow= slow_MA1 + diff_slow macd = 0.0 sig = 0.0 hist = 0.0 if (m_type == ZL) macd := zlag_fast - zlag_slow ema1 = variant(sig_type_in, macd, sig_len) ema2= variant(sig_type_in, ema1, sig_len) diff = ema1 - ema2 sig := ema1 + diff hist := macd - sig else macd := fast_MA1 - slow_MA1 sig_t= variant(sig_type_in, macd, sig_len) sig := sig_t hist := macd - sig [macd, sig, hist] len_out_macd = int(nz(_bpDom(bp_period, bp_width, cycle_len), 1)) < 1 ? 1 : int(nz(_bpDom(bp_period, bp_width, cycle_len), 1)) len_out_signal = int(nz(_bpDom(bp_period, bp_width, efi_reduction), 1)) < 1 ? 1 : int(nz(_bpDom(bp_period, bp_width, efi_reduction), 1)) specFL = calc_type == "Band-pass Dominant Cycle" ? len_out_macd: f_length_i specSL = calc_type == "Band-pass Dominant Cycle" ? int(len_out_macd * slMult) : s_length_i specSig = calc_type == "Band-pass Dominant Cycle" ? len_out_signal : signalLen [macd, signal, hist] = _macd(macdSrc, macd_type, macd_ma_type, macd_ma_type, specFL, specSL, specSig, sig_type) plot(0, "Zero Line", color=color.new(#787B86, 50)) plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below))) plot(macd, title="MACD", color=col_macd) plot(signal, title="Signal", color=col_signal) plotchar(len_out_macd, title = "MACD Fast BP Cycle Length", char = "", location = location.top) plotchar(int(len_out_macd * slMult) , title = "MACD Slow BP Cycle Length", char = "", location = location.top) plotchar(len_out_signal, title = "Signal BP Cycle Length", char = "", location = location.top)
Australian Gross Domestic Product
https://www.tradingview.com/script/euAusEYy-Australian-Gross-Domestic-Product/
Katandra
https://www.tradingview.com/u/Katandra/
0
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Katandra Code by Katandra RW //@version=5 indicator("Australian Gross Domestic Product") plot(request.economic("AU", "GDP"))
SP Weekly Gain MA
https://www.tradingview.com/script/G1NTJICN-SP-Weekly-Gain-MA/
jackdriscoll777
https://www.tradingview.com/u/jackdriscoll777/
1
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© jackdriscoll777 // @version=5 indicator("SP Weekly Gain MA") years_back = 5 candles_back = 52 * years_back // weeks in a year i_n = 0 gain = (close[i_n] - open[i_n]) / (open[i_n]) * 100 while gain < 0 i_n := i_n + 1 gain := (close[i_n] - open[i_n]) / (open[i_n]) * 100 ma = ta.sma(gain, candles_back) plot(ma)
Distance From Moving Average
https://www.tradingview.com/script/QByrJ4Gl-Distance-From-Moving-Average/
Botnet101
https://www.tradingview.com/u/Botnet101/
537
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Botnet101 //@version=5 indicator("Distance From Moving Average", overlay=false, precision=2) // Inputs //{ src = input.source(defval=close , title="Source") length = input.int (defval=20 , title="Length") calculation_type = input.string(defval="Percentage", title="Calculation Type", options=["Spread", "Percentage"]) ma_type = input.string(defval="EMA" , title="MA Type" , options=["EMA", "SMA", "WMA", "VWMA", "HMA"]) show_LL = input.bool (defval=true , title="Lowest Low" , group='Highest High/Lowest Low', inline="High/Low") show_HH = input.bool (defval=true , title="Highest High" , group='Highest High/Lowest Low', inline="High/Low") show_past_low = input.bool (defval=true , title='Lows' , group='Historic Highs/Lows' , inline="High/Low") show_past_high = input.bool (defval=true , title='Highs' , group='Historic Highs/Lows' , inline="High/Low") _lookback = input.int (defval=50 , title='Lookback Length', step=1, minval=0, group='Historic Highs/Lows' ) label_text_colour = input.color(defval=color.white , title="Text Colour" , group='Historic Highs/Lows' ) show_labels = input.bool (defval=true , title='show Labels' , group='Current values Label Settings') label_size = input.string(defval='Normal' , title='Label Size' , options=["Auto", "Tiny", "Small", "Normal", "Large", "Huge"], group='Current values Label Settings') label_position = input.int (defval=5 , title='Label Position', step=5 , group='Current values Label Settings') //} // Functions //{ GetMA = switch ma_type "EMA" => ta.ema (src, length) "SMA" => ta.sma (src, length) "WMA" => ta.wma (src, length) "VWMA" => ta.vwma(src, length) "HMA" => ta.hma (src, length) GetSeries = switch calculation_type "Spread" => close - GetMA "Percentage" => 100 * (close - GetMA) / GetMA GetLowestLow () => if (show_LL) var float lowest_low = 0.0 if (GetSeries < lowest_low) lowest_low := GetSeries lowest_low GetHighestHigh () => if (show_HH) var float highest_high = 0.0 if (GetSeries > highest_high) highest_high := GetSeries highest_high // Calculate and Show historic Highs and Lows PlotHistoricHighLows (_series) => _pl = ta.pivotlow (_series, _lookback, _lookback) _ph = ta.pivothigh(_series, _lookback, _lookback) _low = math.round (_pl, 2) _high = math.round (_ph, 2) if not na(_low) and show_past_low label.new(x=bar_index[_lookback], y=_low , text=str.tostring(_low , format.percent), style=label.style_label_up , color=color.new(color.black, 100), textcolor=label_text_colour) if not na(_high) and show_past_high label.new(x=bar_index[_lookback], y=_high, text=str.tostring(_high, format.percent), style=label.style_label_down, color=color.new(color.black, 100), textcolor=label_text_colour) GetLabelSize = switch label_size "Auto" => size.auto "Tiny" => size.tiny "Small" => size.small "Normal" => size.normal "Large" => size.large "Huge" => size.huge SetLabel(show_label, textValue, percentage, col) => if not na(percentage) and barstate.islast and show_label dt = time - time[1] newX = time + label_position * dt string percentageString = str.tostring(percentage, format.percent) string textLabel = textValue != '' ? textValue + ' (' + percentageString + ')' : percentageString label = label.new(x=newX, y=percentage, xloc=xloc.bar_time, style=label.style_label_left) label.set_color (id=label, color=color.new(col, 0)) label.set_text (id=label, text=textLabel) label.set_textcolor(id=label, textcolor=color.white) label.set_textalign(id=label, textalign=text.align_right) label.set_size (id=label, size=GetLabelSize) label.set_style (id=label, style=label.style_label_left) label.delete(label[1]) //} lowest_low = GetLowestLow () highest_high = GetHighestHigh() PlotHistoricHighLows (GetSeries) // Plots //{ plot(GetSeries , title="Distance" , color=color.aqua, style=plot.style_columns) plot(lowest_low , title="Highest High", color=color.red , style=plot.style_line ) plot(highest_high, title="Lowest Low" , color=color.red , style=plot.style_line ) //} if (show_labels) SetLabel(true, 'LL' , math.round(lowest_low , 2), color.red) SetLabel(true, 'HH' , math.round(highest_high, 2), color.red) SetLabel(true, 'Dist', math.round(GetSeries , 2), color.blue)
SP moving average manual
https://www.tradingview.com/script/f8yBzW4j-SP-moving-average-manual/
jackdriscoll777
https://www.tradingview.com/u/jackdriscoll777/
1
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© jackdriscoll777 //@version=5 indicator("SP moving average manual") final_count = 52 * 5 // 5 years back of weekly candles count = 0 i_n = 0 total = 0.0 for i = 0 to final_count gain = (close[i] - open[i]) / open[i] * 100 if gain > 0 // if it was a positive week, increase count and total count := count + 1 total := total + gain average = total / count plot(average)
Pullback Indicator Trial
https://www.tradingview.com/script/T4ChvIee-Pullback-Indicator-Trial/
Eterna9271
https://www.tradingview.com/u/Eterna9271/
48
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© Eterna9271 //@version=5 indicator("Pullback Indicator Trial", overlay = true) //Inputs fastEmaLength = input(defval = 9, title = 'Fast EMA Length') slowEmaLength = input(defval = 13, title = 'Slow EMA Length') slowerEmaLength = input(defval = 21, title = 'Slower EMA Length') slowestEmaLength = input(defval = 200, title = 'Slowest EMA Length') atrPeriod = input(defval = 14, title = 'Atr Period') stoploss = input(defval = 1, title = 'Stoploss') rr = input(defval = 2, title = 'Risk/Reward Ratio') showdef = input(defval = true, title = 'Use Default Signals?') useCandleFilter = input(defval = true, title = 'Use Candle?') //CALC highestHigh = ta.highest(high, 6) lowestLow = ta.lowest(low, 6) atr = ta.atr(atrPeriod) bema = ta.ema(low, 1) sema = ta.ema(high, 1) fastEma = ta.ema(close, fastEmaLength) slowEma = ta.ema(close, slowEmaLength) slowestEma = ta.ema(close, slowerEmaLength) superslowestEma = ta.ema(close, slowestEmaLength) //Signal buySignal = ta.crossunder(bema, fastEma) and fastEma > slowEma and slowEma > slowestEma and slowestEma > superslowestEma and showdef sellSignal = ta.crossover(sema, fastEma) and fastEma < slowEma and slowEma < slowestEma and slowestEma < superslowestEma and showdef buyCondition = fastEma > slowEma and slowEma > slowestEma and slowestEma > superslowestEma sellCondition = fastEma < slowEma and slowEma < slowestEma and slowestEma < superslowestEma // Get SL and Target prices EntryPrice = 0.0 StopPrice = 0.0 TargetPrice = 0.0 buyEntryPrice = highestHigh sellEntryPrice = lowestLow // Buy Stoploss and Target if buySignal StopPrice := buyEntryPrice - ((buyEntryPrice - low) + (stoploss*atr)) TargetPrice := buyEntryPrice + (rr*((buyEntryPrice - low) + (stoploss*atr))) EntryPrice := buyEntryPrice // Sell Stoploss & Target if sellSignal StopPrice := sellEntryPrice + ((high - sellEntryPrice) + (stoploss*atr)) TargetPrice := sellEntryPrice - (rr*((high - sellEntryPrice) + (stoploss*atr))) EntryPrice := sellEntryPrice // Plot Signal plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small) plotshape(sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small) // Draw stops & targets plot(buySignal or buySignal[1] ? buySignal ? StopPrice : StopPrice[1] : na, title="Buy Stop Price", color=color.yellow, style=plot.style_linebr) plot(sellSignal or sellSignal[1] ? sellSignal ? StopPrice : StopPrice[1] : na, title="Sell Stop Price", color=color.yellow, style=plot.style_linebr) plot(buySignal or buySignal[1] ? buySignal ? TargetPrice : TargetPrice[1] : na, title="Buy Target Price", color=color.blue, style=plot.style_linebr) plot(sellSignal or sellSignal[1] ? sellSignal ? TargetPrice : TargetPrice[1] : na, title="Sell Target Price", color=color.blue, style=plot.style_linebr) plot(buySignal or buySignal[1] ? buySignal ? EntryPrice : EntryPrice[1] : na, title="Buy Entry Price", color=color.white, style=plot.style_linebr) plot(sellSignal or sellSignal[1] ? sellSignal ? EntryPrice : EntryPrice[1] : na, title="Sell Entry Price", color=color.white, style=plot.style_linebr) //alerts if buySignal alert("Buy Entry (" + str.tostring(highestHigh) + "), StopLoss (" + str.tostring(buyEntryPrice - ((buyEntryPrice - low) + (stoploss*atr))) + "), TakeProfit (" + str.tostring(buyEntryPrice + (rr*((buyEntryPrice - low) + (stoploss*atr)))) + ").", alert.freq_once_per_bar_close) if sellSignal alert("Sell Entry (" + str.tostring(lowestLow) + "), StopLoss (" + str.tostring(sellEntryPrice + ((high - sellEntryPrice) + (stoploss*atr))) + "), TakeProfit (" + str.tostring(sellEntryPrice - (rr*((high - sellEntryPrice) + (stoploss*atr)))) + ").", alert.freq_once_per_bar_close)
LTF -> HTF volume delta Up/Down
https://www.tradingview.com/script/nu3YB5jV-LTF-HTF-volume-delta-Up-Down/
fikira
https://www.tradingview.com/u/fikira/
190
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© fikira //@version=5 indicator("LTF -> HTF volume delta Up/Down", overlay=false, format=format.volume) // This script is part of a collection of educational scripts // If you want to return to the open source INDEX page, click the link in the comments: // -> https://www.tradingview.com/script/TUeC9XDq-Education-INDEX/ ltf = str.tostring(timeframe.isintraday ? math.max(1, math.round(timeframe.multiplier / 50)) : timeframe.multiplier * 25 ) [nV, sV, bV, tV] = request.security_lower_tf(syminfo.tickerid, ltf, [close == open ? volume : 0, close < open ? volume : 0, close > open ? volume : 0, volume]) plot(volume, style=plot.style_columns, color=close > open ? color.new(color.lime , 85) : color.new(#FF0000 , 85), title='Total Volume', linewidth=2) plot(array.sum(bV), color=color.lime, title='UP Volume LTF') plot(array.sum(sV), color=color.red , title='DN Volume LTF')
Top 40 constituents of Nifty50
https://www.tradingview.com/script/icSqTWG8-Top-40-constituents-of-Nifty50/
iravan
https://www.tradingview.com/u/iravan/
104
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© iravan //@version=5 indicator("Top 40 constituents of Nifty50", shorttitle="Nifty50 Constituents", overlay=false, max_boxes_count=100, max_lines_count=100, max_labels_count=100) box_space = timeframe.isdwm ? 5 : 5 box_width = timeframe.isdwm ? 2 : 2 var sym_len = 40 var sym_names = array.new<string>(sym_len) var sym_changes = array.new<float>(sym_len) var boxes1 = array.new<box>(sym_len) var boxes2 = array.new<box>(sym_len) var labels1 = array.new<label>(sym_len) var lowest = array.from(1000.0) setBox(id, l, t, r, b, c) => box.set_left(id, l) box.set_top(id, t) box.set_right(id, r) box.set_bottom(id, b) box.set_bgcolor(id, c) box.set_border_color(id, c) setLabel(id, x, y, t, c) => label.set_x(id, x) label.set_y(id, y) label.set_text(id, t) label.set_textcolor(id, c) ohlc(s, i) => if not barstate.islast [0, 0, 0, 0] [s_open, s_high, s_low, s_close] = request.security(s, timeframe.period, [open, high, low, close]) o = (s_open[0] - s_close[1])/s_close[1] * 100 h = (s_high[0] - s_close[1])/s_close[1] * 100 l = (s_low[0] - s_close[1])/s_close[1] * 100 c = (s_close[0] - s_close[1])/s_close[1] * 100 if barstate.islast _l = array.get(lowest, 0) if(l < _l) array.set(lowest, 0, l) box_index = bar_index - (sym_len - i) * box_space setBox(array.get(boxes1, i - 1), box_index + box_width / 2, c, box_index - box_width / 2, o, c > o ? color.teal: color.red) setBox(array.get(boxes2, i - 1), box_index, h, box_index, l, c > o ? color.teal: color.red) ex_index = str.pos(s, ":") name_index = ex_index >= 0? ex_index + 1: 0 name = str.substring(s, name_index, name_index + 3) array.set(sym_names, i - 1, name) array.set(sym_changes, i - 1, c) if(i == sym_len) __l = array.get(lowest, 0) for j = 1 to sym_len __name = array.get(sym_names, j - 1) __change = math.round(array.get(sym_changes, j - 1), 2) __change_text = __name + "\n" + str.tostring(__change) + "%" lbl_index = bar_index - (sym_len - j) * box_space setLabel(array.get(labels1, j - 1), lbl_index, __l - 1, __change_text, __change < 0? color.red: color.green) [o, h, l, c] if barstate.isfirst for i = 0 to sym_len - 1 array.set(boxes1, i, box.new(0, 0, 0, 0, border_width=1)) array.set(boxes2, i, box.new(0, 0, 0, 0, border_width=0)) array.set(labels1, i, label.new(0, 0, "", style=label.style_none, size=size.small)) hline(0) sym1 = input.symbol("NSE:RELIANCE", "Symbol 1") sym2 = input.symbol("NSE:HDFCBANK", "Symbol 2") sym3 = input.symbol("NSE:INFY", "Symbol 3") sym4 = input.symbol("NSE:ICICIBANK", "Symbol 4") sym5 = input.symbol("NSE:HDFC", "Symbol 5") sym6 = input.symbol("NSE:TCS", "Symbol 6") sym7 = input.symbol("NSE:KOTAKBANK", "Symbol 7") sym8 = input.symbol("NSE:ITC", "Symbol 8") sym9 = input.symbol("NSE:HINDUNILVR", "Symbol 9") sym10 = input.symbol("NSE:LT", "Symbol 10") sym11 = input.symbol("NSE:AXISBANK", "Symbol 11") sym12 = input.symbol("NSE:SBIN", "Symbol 12") sym13 = input.symbol("NSE:BHARTIARTL", "Symbol 13") sym14 = input.symbol("NSE:BAJFINANCE", "Symbol 14") sym15 = input.symbol("NSE:ASIANPAINT", "Symbol 15") sym16 = input.symbol("NSE:HCLTECH", "Symbol 16") sym17 = input.symbol("NSE:MARUTI", "Symbol 17") sym18 = input.symbol("NSE:M_M", "Symbol 18") sym19 = input.symbol("NSE:SUNPHARMA", "Symbol 19") sym20 = input.symbol("NSE:TITAN", "Symbol 20") sym21 = input.symbol("NSE:TATASTEEL", "Symbol 21") sym22 = input.symbol("NSE:POWERGRID", "Symbol 22") sym23 = input.symbol("NSE:TATAMOTORS", "Symbol 23") sym24 = input.symbol("NSE:BAJAJFINSV", "Symbol 24") sym25 = input.symbol("NSE:NTPC", "Symbol 25") sym26 = input.symbol("NSE:TECHM", "Symbol 26") sym27 = input.symbol("NSE:ULTRACEMCO", "Symbol 27") sym28 = input.symbol("NSE:WIPRO", "Symbol 28") sym29 = input.symbol("NSE:NESTLEIND", "Symbol 29") sym30 = input.symbol("NSE:HINDALCO", "Symbol 30") sym31 = input.symbol("NSE:INDUSINDBK", "Symbol 31") sym32 = input.symbol("NSE:HDFCLIFE", "Symbol 32") sym33 = input.symbol("NSE:ONGC", "Symbol 33") sym34 = input.symbol("NSE:GRASIM", "Symbol 34") sym35 = input.symbol("NSE:ADANIPORTS", "Symbol 35") sym36 = input.symbol("NSE:DRREDDY", "Symbol 36") sym37 = input.symbol("NSE:JSWSTEEL", "Symbol 37") sym38 = input.symbol("NSE:CIPLA", "Symbol 38") sym39 = input.symbol("NSE:SBILIFE", "Symbol 39") sym40 = input.symbol("NSE:BAJAJ_AUTO", "Symbol 40") ohlc(sym1, 1) ohlc(sym2, 2) ohlc(sym3, 3) ohlc(sym4, 4) ohlc(sym5, 5) ohlc(sym6, 6) ohlc(sym7, 7) ohlc(sym8, 8) ohlc(sym9, 9) ohlc(sym10, 10) ohlc(sym11, 11) ohlc(sym12, 12) ohlc(sym13, 13) ohlc(sym14, 14) ohlc(sym15, 15) ohlc(sym16, 16) ohlc(sym17, 17) ohlc(sym18, 18) ohlc(sym19, 19) ohlc(sym20, 20) ohlc(sym21, 21) ohlc(sym22, 22) ohlc(sym23, 23) ohlc(sym24, 24) ohlc(sym25, 25) ohlc(sym26, 26) ohlc(sym27, 27) ohlc(sym28, 28) ohlc(sym29, 29) ohlc(sym30, 30) ohlc(sym31, 31) ohlc(sym32, 32) ohlc(sym33, 33) ohlc(sym34, 34) ohlc(sym35, 35) ohlc(sym36, 36) ohlc(sym37, 37) ohlc(sym38, 38) ohlc(sym39, 39) ohlc(sym40, 40)
Naked Intrabar POC
https://www.tradingview.com/script/cgHGBnH9-Naked-Intrabar-POC/
rumpypumpydumpy
https://www.tradingview.com/u/rumpypumpydumpy/
944
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© rumpypumpydumpy //@version=5 indicator("Naked Intrabar POC", overlay = true, max_lines_count = 500) // ----------------------------------------------------------------------------- inp_tf = input.timeframe("1", title = "Sampling lower timeframe") inp_num_bins = input.int(250, title = "Sample bins") inp_type = input.string("Time", title = "POC Type", options = ["Time", "Volume"]) inp_hide_hit = input.bool(false, title = "Only Display Naked POCs?") inp_hit_col = input.color(color.gray, title = "POC Hit color") inp_naked_col = input.color(color.blue, title = "Naked POC color") inp_linewidth = input.int(1, title = "POC line width") inp_linestyle = input.string("Dashed", title = "POC Line style", options = ["Solid", "Dotted", "Dashed"]) inp_extend_poc = input.bool(true, title = "Extend Naked POCs?") inp_poc_dot_color = input.color(color.yellow, title = "Intrabar POC dot color") inp_show_hv_npoc = input.bool(false, title = "Display highest volume Naked POC?") inp_hv_npoc_lb = input.int(30, title = "Highest Volume Naked POC lookback", maxval = 500) inp_hv_npoc_col = input.color(color.red, title = "Highest Volume Naked POC color") // ----------------------------------------------------------------------------- [intrabar_highs, intrabar_lows, intrabar_vol] = request.security_lower_tf(syminfo.tickerid, inp_tf, [high, low, volume]) poc_linestyle = switch inp_linestyle "Solid" => line.style_solid "Dotted" => line.style_dotted "Dashed" => line.style_dashed float intrabar_poc = na // ----------------------------------------------------------------------------- size = array.size(intrabar_highs) if size > 0 float[] tpo_bins = array.new_float() for i = 0 to inp_num_bins - 1 array.push(tpo_bins, 0) inc = (high - low) / inp_num_bins num_vals = array.size(intrabar_highs) for i = 0 to inp_num_bins - 1 bin_bottom = low + i * inc bin_top = bin_bottom + inc for j = 0 to num_vals - 1 intrabar_high = array.get(intrabar_highs, j) intrabar_low = array.get(intrabar_lows, j) intrabar_volume = inp_type == "Time" ? 1 : array.get(intrabar_vol, j) inside_bin = intrabar_high <= bin_top and intrabar_low >= bin_bottom spans_bin = intrabar_high > bin_top and intrabar_low < bin_bottom up_bin = intrabar_high > bin_bottom and intrabar_high < bin_top and intrabar_low < bin_bottom dn_bin = intrabar_low < bin_top and intrabar_low > bin_bottom and intrabar_high > bin_top if inside_bin current = array.get(tpo_bins, i) array.set(tpo_bins, i, current + (1 * intrabar_volume)) else if spans_bin current = array.get(tpo_bins, i) val = (bin_top - bin_bottom) / (intrabar_high - intrabar_low) * intrabar_volume array.set(tpo_bins, i, current + val) else if up_bin current = array.get(tpo_bins, i) val = (intrabar_high - bin_bottom) / (intrabar_high - intrabar_low) * intrabar_volume array.set(tpo_bins, i, current + val) else if dn_bin current = array.get(tpo_bins, i) val = (bin_top - intrabar_low) / (intrabar_high - intrabar_low) * intrabar_volume array.set(tpo_bins, i, current + val) poc_val = array.max(tpo_bins) poc_index = array.indexof(tpo_bins, poc_val) intrabar_poc := low + inc * (poc_index + 0.5) // ----------------------------------------------------------------------------- plot(intrabar_poc, color = inp_poc_dot_color, linewidth = 2, style = plot.style_circles, title = "Intrabar POC") var line[] poc_lines = array.new_line() var bool[] poc_hit = array.new_bool() var int[] poc_index = array.new_int() var float[] volume_vals = array.new_float() if array.size(poc_lines) > 0 for i = array.size(poc_lines) - 1 to 0 temp_line = array.get(poc_lines, i) temp_poc_price = line.get_y1(temp_line) if low <= temp_poc_price and high >= temp_poc_price and not array.get(poc_hit, i) if inp_hide_hit array.remove(poc_hit, i) line.delete(temp_line) array.remove(poc_lines, i) array.remove(poc_index, i) array.remove(volume_vals, i) else array.set(poc_hit, i, true) line.set_color(temp_line, color = inp_hit_col) line.set_extend(temp_line, extend = extend.none) line.set_x2(temp_line, x = bar_index) array.unshift(poc_lines, line.new(x1 = bar_index, y1 = intrabar_poc, x2 = bar_index + 1, y2 = intrabar_poc, color = inp_naked_col, style = poc_linestyle, width = inp_linewidth, extend = inp_extend_poc ? extend.right : extend.none)) array.unshift(poc_hit, false) array.unshift(poc_index, bar_index) array.unshift(volume_vals, volume) if array.size(poc_lines) > 500 temp_line = array.pop(poc_lines) line.delete(temp_line) array.pop(poc_hit) array.pop(poc_index) array.pop(volume_vals) if array.size(poc_lines) > 0 for i = 0 to array.size(poc_lines) - 1 temp_line = array.get(poc_lines, i) if array.get(poc_hit, i) == false line.set_x2(temp_line, x = bar_index + 1) float highest_npoc_volume = 0.0 float hv_npoc = na if array.size(poc_index) > 0 for i = 0 to array.size(poc_index) - 1 temp_index = array.get(poc_index, i) temp_volume = array.get(volume_vals, i) if temp_index >= bar_index - inp_hv_npoc_lb if temp_volume > highest_npoc_volume and not array.get(poc_hit, i) highest_npoc_volume := temp_volume hv_npoc := intrabar_poc[bar_index - temp_index] else break plot(inp_show_hv_npoc ? hv_npoc : na, linewidth = 2, style = plot.style_circles, color = inp_hv_npoc_col, title = "Highest Volume Naked POC") // ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
Highlight last bar, work on all timeframe, v4 & v5 @magnumm
https://www.tradingview.com/script/6G29mH82-Highlight-last-bar-work-on-all-timeframe-v4-v5-magnumm/
magnumm
https://www.tradingview.com/u/magnumm/
15
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© magnumm // revision = 1 // Works on all time frame and for version 4 & 5. You just need to comment/uncomment. Can be added in your own scripts copy/pasting just one line. //___________________________ VERSION 5 ___________________________ //@version=5 indicator("Highlight Last Bar", shorttitle='Highlight Last Bar') bgcolor(barstate.isconfirmed ? na : color.new(color.yellow, transp=75)) //line to copy paste // //___________________________ VERSION 4 ___________________________ // //@version=4 // study("Highlight Last Bar", overlay=true) // bgcolor(barstate.isconfirmed ? na : color.new(color.yellow, transp=75)) //line to copy paste //DON'T FORGET TO HYDRATE
BTC Leading SOPR: Onchain
https://www.tradingview.com/script/dHJrC3sS-BTC-Leading-SOPR-Onchain/
cryptoonchain
https://www.tradingview.com/u/cryptoonchain/
148
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© MJShahsavar //@version=5 indicator("BTC Leading SOPR: Onchain", timeframe = "W") R = input.symbol("BTC_SOPR", "Symbol") src = request.security(R, 'D', close) D = ta.sma(src, 10) M = ta.sma(src, 100) G= D-M h1= hline (0.02) h2=hline (0.01) h3= hline (0.0, linewidth=2) h4= hline (-0.01) h5= hline (-0.02) fill (h1, h2, color.red, transp = 60) fill (h2, h3, color.orange, transp = 60) fill (h3, h4, color.aqua, transp = 60) fill (h4, h5, color.blue, transp = 60) plot (G, color= color.blue , linewidth=1)
RSI vs Longs/Shorts Margin Ratio Percentage Rank
https://www.tradingview.com/script/6i63iQPh-RSI-vs-Longs-Shorts-Margin-Ratio-Percentage-Rank/
EltAlt
https://www.tradingview.com/u/EltAlt/
94
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© EltAlt //@version=5 // -------------------------------------------------------------------------------------------------------------------- // // Authors: @EltAlt // Revision: v1.03 // Date: 2-August-2022 // // Description // ==================================================================================================================== // // This indicator should be used on a symbol that also has long and short margined tokens available. By default it // plots the RSI of the current token with a color based on percentage rank the RSI of BITFINEX:'token'LONGS divided // by BITFINEX:'token'SHORTS. If you are using a chart that does not have BITFINEX LONGS and SHORTS tokens it will // display the standard RSI. // // If you enter Manual Margined Long/Short Symbols you can select any Tradingview symbols for your Long and Short // tokens. I don't think you will get meaningful results unless you select a long and short margined token such as // BITFINEX:ETHUSDLONGS and BITFINEX:ETHUSDSHORTS. Even using margined tokens the results may not be meaningful, if // there is not enough trade volume in the token, or if they are being manipulated, so you must backtest everything. // // The four plot options are: // β€’ Colored RSI - RSI plotted with colors based on the Longs/Shorts ratio // β€’ Background Color - White RSI plot with Longs/Shorts ratio as background color // β€’ RSI + Ratio - White RSI with Longs/Shorts ratio plotted in color // β€’ RSI + Ratio Histogram - White RSI with Longs/Shorts ratio plotted as a histogram in color // // By default it also plots a short term moving average and it can also plot the raw ratio rather than the percentage // rank if selected, the raw ratio can be more useful on longer timeframe charts. // // Alerts can be triggered and or shown on the chart when the Ratio is Above / Below specified values, with the // option to filter by the RSI being beyond the displayed upper and lower limits and or the RSI above / below its // moving average. // // Alerts can now be triggered on RSI divergences, thanks DevLucem for the library! // // ==================================================================================================================== // // I would gladly accept any suggestions to improve the script. // If you encounter any problems please share them with me. // // Changlog // ==================================================================================================================== // // 1.00 β€’ First public release // 1.01 β€’ Added an automatic pair option // β€’ Got rid of the average, not needed // β€’ Added alerts // 1.02 β€’ Set long and short symbol defval to '' so BINANCE:BTCUSDLONGS doen't show up in the chart unless it is set. // β€’ Since the manual settings now default to '' it will be automatic unless a manual setting is entered, so Auto // setting is no longer required, // β€’ If the currency is USD, UST or BTC it will automatically use the chart pair for longs and shorts. // β€’ If the currency is EUR, GBP or JPY and the base is ETH or BTC it will automatically use the chart pair for // longs and shorts. // β€’ Otherwise it will use the USD pair for longs and shorts. // 1.03 β€’ Added histogram style. // β€’ Modified to just display the normal RSI where no BITFINEX LONGS exist. // β€’ Added @DevLucem Divergence library to alert on RSI divergences. // // // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ // // // ============ "RSI vs Longs/Shorts Margin Ratio Percentage Rank" indicator('RSI vs Longs/Shorts Margin Ratio Percentage Rank', shorttitle='RSI vs Longs/Shorts', overlay = false, timeframe='', timeframe_gaps=true) import DevLucem/Divergence/1 as Divergence // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ // ============ Inputs rsioption = 'Colored RSI' bkgoption = 'Background Color' ratoption = 'RSI + Ratio' histoption = 'RSI + Ratio Histogram' typetip = 'The four plot options are:\n Colored RSI - RSI plotted with colors based on the Longs/Shorts ratio\n Background Color - White RSI plot with Longs/Shorts ratio as background color\n RSI + Ratio - White RSI with Longs/Shorts ratio plotted in color\n RSI + Ratio Histogram - White RSI with Longs/Shorts ratio plotted as a histogram in color' symboltip = 'Longs and shorts will automatically be found if you are on a chart that has them available, shuch as BTCJPY.\n Automatic matching will be attempted for USD, UST, EUR, GBP, JPY or BTC Pairs.\n If you are using a different base such as BUSD or AUD it will attempt to match with the USD pair.\n Manually set tickers here if it is not matching anything or you want to manually match something else.\n While you can select any Tradingview symbols here I do not think you will get meaningful results unless you select a long and short margined token such as BITFINEX:BTCUSDLONGS and BITFINEX:BTCUSDSHORTS. Even using margined tokens the results may not be meaningful if there is not enough trade volume in the token, so you must backtest everything.' long = input.symbol ('', 'Manual Margined Long Symbol', tooltip = symboltip) short = input.symbol ('', 'Manual Margined Short Symbol') plottype = input.string (rsioption , 'Plot Style', options=[rsioption, bkgoption, ratoption, histoption], tooltip = typetip) plotbktab = input.int (defval = 60, maxval=100, minval=0, title = 'Transparency Above MA', inline='0') plotbktbe = input.int (defval = 75, maxval=100, minval=0, title = 'Below MA', inline='0') usepctrank = input.bool (true, 'Use the percentrank of the ratio?', inline='1') pctlbk = input.int (500, title='  Lookback', inline='1') plotrange = input.string ('RGB Spectrum', 'Color Type', options=['RGB Spectrum', 'RBlG Spectrum', 'RB Spectrum', 'RG Spectrum', 'Solid Color'], inline='2') plotcolor = input.color (#FFFF00, 'Solid Color', inline='2') plothilow = input.bool (true, 'Plot High/Low Lines', inline='2') length = input.int (14, 'Length', inline='1', group='RSI Settings') rsiupper = input.int (70, 'Upper', inline='1', group='RSI Settings') rsilower = input.int (30, 'Lower', inline='1', group='RSI Settings') plotma = input.bool (true, 'Plot RSI MA', inline='2', group='RSI Settings') malength = input.int (5, 'Length', inline='2', group='RSI Settings') matype = input.string ('EMA', 'Type', options=['SMA', 'EMA', 'VWMA'], inline='2', group='RSI Settings') alerts = input.bool (true, 'Plot Visable Alerts', inline='1', group='Alerts') a_rsibands = input.bool (true, 'RSI Beyond Bands', inline='2', group='Alerts') a_rsima = input.bool (true, 'RSI MA Filter', inline='2', group='Alerts') a_ratiobelow = input.int (5, 'Ratio Below', inline='3', group='Alerts') a_ratioabove = input.int (95, 'Ratio Above', inline='3', group='Alerts') a_div = input.bool (true, 'Alert on RSI Divergences', group='Alerts') // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ // ============ Functions f_color (_type, _solidcolor, _percent) => _color = switch _type 'RGB Spectrum' => _percent >= 50 ? color.from_gradient(_percent, 50, 100, #0AFF00, #FF2900): color.from_gradient(_percent, 0, 49, #0000FF, #0AFF00) 'RBlG Spectrum' => _percent >= 50 ? color.from_gradient(_percent, 50, 100, #000000, #FF2900): color.from_gradient(_percent, 0, 49, #0AFF00, #000000) 'RB Spectrum' => color.from_gradient(_percent, 0, 100, #0000FF, #FF2900) 'RG Spectrum' => color.from_gradient(_percent, 0, 100, #00FF00, #FF0000) 'Solid Color' => _solidcolor f_ma (_type, _source, _length) => _type == 'VWMA' ? ta.vwma ( _source, _length ) : _type == 'EMA' ? ta.ema ( _source, _length ) : ta.sma ( _source, _length ) f_percentrank(_source, _lookback) => _count = 0.0 for _i = 1 to _lookback by 1 _count += ( _source[_i] > _source ? 0 : 1 ) _count _return = ( _count / _lookback) * 100 // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ // ============ Calculations ticker = syminfo.ticker currency = syminfo.currency base = syminfo.basecurrency btfxticker = (currency == 'USD' or currency == 'UST' or currency == 'BTC' or (currency == 'EUR' and (base == 'BTC' or base == 'ETH')) or (currency == 'GBP' and (base == 'BTC' or base == 'ETH')) or (currency == 'JPY' and (base == 'BTC' or base == 'ETH')) ) ? ticker : base + 'USD' longs = request.security (long == '' ? ticker.new ('BITFINEX', btfxticker+'LONGS') : long, timeframe.period, close, ignore_invalid_symbol=true) shorts = request.security (short == '' ? ticker.new ('BITFINEX', btfxticker+'SHORTS') : short, timeframe.period, close, ignore_invalid_symbol=true) plotratio = longs and plottype == ratoption plothist = longs and plottype == histoption plotbkgrd = shorts and plottype == bkgoption rsiclose = ta.rsi (close, length) rsiratio = ta.rsi (longs / shorts, length) rsima = f_ma (matype, rsiclose, malength) pctrank = usepctrank ? f_percentrank (rsiratio, pctlbk) : na ratioplot = usepctrank ? pctrank : rsiratio ratio_color = longs ? f_color (plotrange, plotcolor, ratioplot) : color.white bottcolor = plotrange == 'RG Spectrum' or plotrange == 'RBlG Spectrum' ? color.green : color.blue [regular_bullish_div, hidden_bullish_div] = Divergence.bullish(rsiclose) [regular_bearish_div, hidden_bearish_div] = Divergence.bearish(rsiclose) // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ // ============ Alerts hghalert = (ratioplot > a_ratioabove) and (a_rsibands ? rsiclose > rsiupper : true) and (a_rsima ? rsiclose < rsima : true) lowalert = (ratioplot < a_ratiobelow) and (a_rsibands ? rsiclose < rsilower : true) and (a_rsima ? rsiclose > rsima : true) alertcondition (hghalert, title='RSI vs Longs/Shorts High Alert!', message='High Alert') alertcondition (lowalert, title='RSI vs Longs/Shorts Low Alert!', message='Low Alert') alertcondition (a_div and regular_bullish_div, title='RSI vs Longs/Shorts Regular Bullish Divergence Alert!', message='Regular Bullish Divergence') alertcondition (a_div and hidden_bullish_div, title='RSI vs Longs/Shorts Hidden Bullish Divergence Alert!', message='Hidden Bullish Divergence') alertcondition (a_div and regular_bearish_div, title='RSI vs Longs/Shorts Regular Bearish Divergence Alert!', message='Regular Bearish Divergence') alertcondition (a_div and hidden_bearish_div, title='RSI vs Longs/Shorts Hidden Bearish Divergence Alert!', message='Hidden Bearish Divergence') // β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’ // ============ Plots plotshape((rsiclose < rsilower) and (rsiclose > rsima) and (regular_bullish_div or hidden_bullish_div), 'spot bottom', shape.diamond, location.bottom, regular_bullish_div ? color.lime : color.new(color.lime, 50), size=size.tiny) plotshape((rsiclose > rsiupper) and (rsiclose < rsima) and (regular_bearish_div or hidden_bearish_div), 'spot top', shape.diamond, location.top, regular_bearish_div ? color.red : color.new(color.red, 50), size=size.tiny) plotshape (alerts ? hghalert : na, style=shape.triangledown, color=color.red, location=location.top, size=size.tiny, title='High Alert') plotshape (alerts ? lowalert : na, style=shape.triangleup, color=color.lime, location=location.bottom, size=size.tiny, title='Low Alert') bgcolor (plotbkgrd ? color.new(ratio_color, rsiclose > rsima ? plotbktab : plotbktbe) : na) p_bandTop = hline (plothilow ? 100 : na, '100', color.red, hline.style_solid) p_bandBot = hline (plothilow ? 0 : na, '0', bottcolor, hline.style_solid) p_bandUpp = hline (rsiupper, 'Upper Band', color.new(color.silver,50), hline.style_dashed) p_bandLow = hline (rsilower, 'Lower Band', color.new(color.silver,50), hline.style_dashed) fill(p_bandUpp, p_bandLow, color.new(color.silver,96), title = 'Background') plot(plotratio or plotbkgrd ? na : rsiclose, 'Ratio Color RSI', color=ratio_color, linewidth=2) p_ratio = plot(plotratio ? ratioplot : na, 'Long / Short Ratio', color=ratio_color) p_hist = plot(plothist ? ratioplot : na, 'Long / Short Ratio', color.new(ratio_color, rsiclose > rsima ? plotbktab : plotbktbe), style=plot.style_area, histbase=50) p_rsi = plot(plotratio or plotbkgrd or plothist ? rsiclose : na, 'RSI', color=color.white, linewidth=2) fill(p_ratio, p_rsi, color=color.new(ratio_color, rsiclose < rsima ? plotbktbe : plotbktab), fillgaps=true) plot(plotma ? rsima : na, 'RSI MA', color=color.silver, linewidth=1)
Wick Pressure/Close point inside the bar
https://www.tradingview.com/script/thwHBTry-Wick-Pressure-Close-point-inside-the-bar/
venkatadora
https://www.tradingview.com/u/venkatadora/
29
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© venkatadora //@version=5 indicator("wickpressure") //Period per = input(defval=21, title="Period") buypressure = (close/low) sellpressure = (high/close) wickscr = (buypressure/sellpressure) Escore = ta.hma (wickscr,per)/ta.stdev(wickscr,per) emaEscore = ta.hma(Escore,50) //Colors dcolor = Escore > emaEscore ? color.green : Escore < emaEscore ? color(color.maroon) : color(color.black) fcolor = Escore > 0 ? color(color.green) :Escore < 0 ? color(color.maroon) : color(color.black) plot(Escore,color=dcolor,linewidth= 3, title ="D3score", style = plot.style_area) plot(emaEscore, color= (color.yellow),linewidth=4,title ="emaEscore",style = plot.style_line)
PivotBoss ADR Levels
https://www.tradingview.com/script/YbOVWCw6-PivotBoss-ADR-Levels/
G-iOS
https://www.tradingview.com/u/G-iOS/
86
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© G-iOS //@version=4 study(title="PivotBoss ADR MZ PEMA Targets", shorttitle="PB_ADR/MZ/PEMA", overlay = true, max_bars_back=4000) // Rounding levels to min tick nround(x) => n = round(x / syminfo.mintick) * syminfo.mintick period = "D" //Input dp = input(true, title="Pivot Range", group = "PivotBoss") Bu = input(title = 'Bull Target ', defval = true, type = input.bool, group = "PivotBoss" ) Br = input(title = 'Bear Target ', defval = true, type = input.bool, group = "PivotBoss" ) cp = input(false, " CAMARILLA ",type=input.bool, inline="cam",group="PivotBoss") HL = input(title = 'Show High & Low ', defval = true, type = input.bool, group = "OHLC" ) dl = input(false, title="Show Yesterday OHLC", group = "OHLC") label_size = input("normal", options=["auto", "tiny", "small", "normal", "large", "huge"], title="Label size", group = "PivotBoss") l_size = label_size == "auto" ? size.auto : label_size == "tiny" ? size.tiny : label_size == "small" ? size.small : label_size == "normal" ? size.normal : label_size == "large" ? size.large : size.huge display_value = true //Calculation dhigh = security(syminfo.tickerid, period , high, lookahead=barmerge.lookahead_on) dlow = security(syminfo.tickerid, period , low, lookahead=barmerge.lookahead_on) // ADR POINTS //B1 = 0.0, B2 = 0.0, B0 = 0.0, B5 = 0.0, B6 = 0.0, B7 = 0.0, B8 = 0.0,B9 = 0.0,B3 = 0.0 //B4 = 0.0, ADR = 0.0 //color1 = color.green, //bars_sinse1 = 0 dayrange = dhigh - dlow dailyHigh1 = security(syminfo.tickerid,"D" , high[1],lookahead=barmerge.lookahead_on) dailyLow1 = security(syminfo.tickerid,"D" , low [1],lookahead=barmerge.lookahead_on) dailyHigh2 = security(syminfo.tickerid,"D" , high[2],lookahead=barmerge.lookahead_on) dailyLow2 = security(syminfo.tickerid,"D" , low [2],lookahead=barmerge.lookahead_on) dailyHigh3 = security(syminfo.tickerid,"D" , high[3],lookahead=barmerge.lookahead_on) dailyLow3 = security(syminfo.tickerid,"D" , low [3],lookahead=barmerge.lookahead_on) dailyHigh4 = security(syminfo.tickerid,"D" , high[4],lookahead=barmerge.lookahead_on) dailyLow4 = security(syminfo.tickerid,"D" , low [4],lookahead=barmerge.lookahead_on) dailyHigh5 = security(syminfo.tickerid,"D" , high[5],lookahead=barmerge.lookahead_on) dailyLow5 = security(syminfo.tickerid,"D" , low [5],lookahead=barmerge.lookahead_on) dailyHigh6 = security(syminfo.tickerid,"D" , high[6],lookahead=barmerge.lookahead_on) dailyLow6 = security(syminfo.tickerid,"D" , low [6],lookahead=barmerge.lookahead_on) dailyHigh7 = security(syminfo.tickerid,"D" , high[7],lookahead=barmerge.lookahead_on) dailyLow7 = security(syminfo.tickerid,"D" , low [7],lookahead=barmerge.lookahead_on) dailyHigh8 = security(syminfo.tickerid,"D" , high[8],lookahead=barmerge.lookahead_on) dailyLow8 = security(syminfo.tickerid,"D" , low [8],lookahead=barmerge.lookahead_on) dailyHigh9 = security(syminfo.tickerid,"D" , high[9],lookahead=barmerge.lookahead_on) dailyLow9 = security(syminfo.tickerid,"D" , low [9],lookahead=barmerge.lookahead_on) dayrange1 = dailyHigh1 - dailyLow1 dayrange2 = dailyHigh2 - dailyLow2 dayrange3 = dailyHigh3 - dailyLow3 dayrange4 = dailyHigh4 - dailyLow4 dayrange5 = dailyHigh5 - dailyLow5 dayrange6 = dailyHigh6 - dailyLow6 dayrange7 = dailyHigh7 - dailyLow7 dayrange8 = dailyHigh8 - dailyLow8 dayrange9 = dailyHigh9 - dailyLow9 adr_10 = (dayrange1+dayrange2+dayrange3+dayrange4+dayrange5+dayrange6+dayrange7+dayrange8+dayrange9+dayrange)/10 B0 = dlow + (adr_10*0.25) B1 = dlow + (adr_10*0.5) B2 = dlow + (adr_10*0.75) B3 = (dlow + adr_10) B4 = dlow + (adr_10*1.25) B5 = dhigh - (adr_10*0.25) B6 = dhigh - (adr_10*0.5) B7 = dhigh - (adr_10*0.75) B8 = (dhigh - adr_10) B9 = dhigh - (adr_10*1.25) //Plotting plot( HL ? dlow : na , title="DLow", style = plot.style_circles, color=color.green, transp=0) plot( HL ? dhigh : na, title="DHigh", style = plot.style_circles, color=color.red, transp=0) plot( Bu ? B0 : na , title="R25", color=B0 != B0[1] ? na : color.orange, linewidth=2,transp=0) plot( Bu ? B1 : na, title="R50", color=B1 != B1[1] ? na : color.green, linewidth=2, transp=0) plot( Bu ? B2 : na, title="R75", color=B2 != B2[1] ? na : color.green, linewidth=2, transp=0) plot( Bu ? B3 : na, title="R100", color=B3 != B3[1] ? na : color.white, linewidth=2, transp=0) plot( Bu ? B4 : na, title="R125", color=B4 != B4[1] ? na : color.blue, linewidth=2, transp=0) plot( Br ? B5 : na, title="S25", color=B5 != B5[1] ? na : color.orange, linewidth=2, transp=0) plot( Br ? B6 : na , title="S50", color=B6 != B6[1] ? na : color.red, linewidth=2, transp=0) plot( Br ? B7 : na , title="S75", color=B7 != B7[1] ? na : color.red, linewidth=2, transp=0) plot( Br ? B8 : na , title="S100", color=B8 != B8[1] ? na : color.white, linewidth=2, transp=0) plot( Br ? B9 : na , title="S125", color=B9 != B9[1] ? na : color.blue, linewidth=2, transp=0) label_vpp = label.new(bar_index, dhigh, text= HL ? (" HOD" + " " + tostring(nround(dhigh))) : " ", style= label.style_none, textcolor = color.red, size= l_size) label.delete(label_vpp[1]) label_vr2 = label.new(bar_index, dlow, text= HL ? (" LOD" + " " + tostring(nround(dlow))) : " ", style= label.style_none, textcolor = color.green, size= l_size) label.delete(label_vr2[1]) label_vs0 = label.new(bar_index, B0, text= Bu ? (" R-25% Scaling" + " " + tostring(nround(B0))) : " ", style= label.style_none, textcolor = color.orange,size= l_size) label.delete(label_vs0[1]) label_vs1 = label.new(bar_index, B1, text= Bu ? (" 50% Scaling" + " " + tostring(nround(B1))) : " ", style= label.style_none, textcolor = color.green ,size= l_size) label.delete(label_vs1[1]) label_vs2 = label.new(bar_index, B2, text= Bu ? (" 75% Primary" + " " + tostring(nround(B2))) : " ", style= label.style_none, textcolor = color.green,size= l_size) label.delete(label_vs2[1]) label_vs3 = label.new(bar_index, B3, text= Bu ? (" 100% Secondary" + " " + tostring(nround(B3))) : " ", style= label.style_none, textcolor = color.white,size= l_size) label.delete(label_vs3[1]) label_vs4 = label.new(bar_index, B4, text= Bu ? (" 125% Extended" + " " + tostring(nround(B4))) : " ", style= label.style_none, textcolor = color.blue,size= l_size) label.delete(label_vs4[1]) label_vt0 = label.new(bar_index, B5, text= Br ? (" S-25% Scaling" + " " + tostring(nround(B5))) : " ", style= label.style_none, textcolor = color.orange,size= l_size) label.delete(label_vt0[1]) label_vt1 = label.new(bar_index, B6, text= Br ? (" 50% Scaling" + " " + tostring(nround(B6))) : " ", style= label.style_none, textcolor = color.red,size= l_size) label.delete(label_vt1[1]) label_vt2 = label.new(bar_index, B7, text= Br ? (" 75% Primary" + " " + tostring(nround(B7))) : " ", style= label.style_none, textcolor = color.red,size= l_size) label.delete(label_vt2[1]) label_vt3 = label.new(bar_index, B8, text= Br ? (" 100% Secondary" + " " + tostring(nround(B8))) : " ", style= label.style_none, textcolor = color.white,size= l_size) label.delete(label_vt3[1]) label_vt4 = label.new(bar_index, B9, text= Br ? (" 125% Extended" + " " + tostring(nround(B9))) : " ", style= label.style_none, textcolor = color.blue,size= l_size) label.delete(label_vt4[1]) getSeries(e, timeFrame) => security(syminfo.tickerid, timeFrame, e, lookahead=barmerge.lookahead_on) is_today = year == year(timenow) and month == month(timenow) and dayofmonth == dayofmonth(timenow) //PEMA p = input(true, title="Show PEMA", group = "PEMA") TLineEMA = input(8, minval=1, title="Trigger Line", group = "PEMA") FastMA = input(defval=13, minval=1, title="Fast Line", group = "PEMA") MiddleMA = input(defval=21, minval=1, title="Middle Line", group = "PEMA") MiddleMA1 = input(defval=34, minval=1, title="Middle 2 Line", group = "PEMA") SlowMA = input(defval=55, minval=1, title="Slow Line", group = "PEMA") fPivot = ((high + low + close)/3) ema0 = ema(fPivot, TLineEMA) ema1 = ema(fPivot,FastMA) ema2 = ema(fPivot,MiddleMA) ema3 = ema(fPivot,MiddleMA1) ema4 = ema(fPivot,SlowMA) plot( p ? ema0 : na, color=color.red, title="T-Line EMA", linewidth=1) p11=plot(p and ema1 ? ema1:na,color=color.new(color.fuchsia, 0), style=plot.style_line,title='Fast', linewidth=1) p22=plot(p and ema2 ? ema2:na,color=color.new(color.green, 0),style=plot.style_line, title='Middle',linewidth=1) p33=plot(p and ema3 ? ema3:na,color=color.new(color.blue, 0), style=plot.style_line, title='Middle 2',linewidth=1,display= display.none) p44=plot(p and ema4 ? ema4:na,color=color.new(color.gray, 0), style=plot.style_line, title='Slow',linewidth=1,display= display.none) //fill(p11, p33, color=ema8>ema21 ? color.green:color.red, transp=90, editable=true ) // Money Zone Levels // ||-- Inputs: mz = input(false, title="Money Zone Levels", group = "Money Zone") dmz = input(false, title="Dev. Money Zone Levels", group = "Money Zone") session_timeframe = input("D" , options = ["D" , "W" , "M"], group = "Money Zone") percent_of_tpo = input(0.70,group = "Money Zone") tf_high = high tf_low = low tf_close = close // ||-- Bars since session started: session_bar_counter = bar_index - valuewhen(change(time(session_timeframe)) != 0, bar_index, 0) //plot(session_bar_counter) // ||-- session high, low, range: session_high = tf_high session_low = tf_low session_range = tf_high - tf_low session_high := nz(session_high[1], tf_high) session_low := nz(session_low[1], tf_low) session_range := nz(session_high - session_low, 0.0) // ||-- recalculate session high, low and range: if session_bar_counter == 0 session_high := tf_high session_low := tf_low session_range := tf_high - tf_low session_range if tf_high > session_high[1] session_high := tf_high session_range := session_high - session_low session_range if tf_low < session_low[1] session_low := tf_low session_range := session_high - session_low session_range //plot(series=session_high, title='Session High', color=blue) //plot(series=session_low, title='Session Low', color=blue) //plot(series=session_range, title='Session Range', color=black) // ||-- define tpo section range: tpo_section_range = session_range / 21 // ||-- function to get the frequency a specified range is visited: f_frequency_of_range(_src, _upper_range, _lower_range, _length) => _adjusted_length = _length < 1 ? 1 : _length _frequency = 0 for _i = 0 to _adjusted_length - 1 by 1 if _src[_i] >= _lower_range and _src[_i] <= _upper_range _frequency := _frequency + 1 _frequency _return = nz(_frequency, 0) // _adjusted_length _return // ||-- frequency the tpo range is visited: tpo_00 = f_frequency_of_range(tf_close, session_high, session_high - tpo_section_range * 1, session_bar_counter) tpo_01 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 1, session_high - tpo_section_range * 2, session_bar_counter) tpo_02 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 2, session_high - tpo_section_range * 3, session_bar_counter) tpo_03 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 3, session_high - tpo_section_range * 4, session_bar_counter) tpo_04 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 4, session_high - tpo_section_range * 5, session_bar_counter) tpo_05 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 5, session_high - tpo_section_range * 6, session_bar_counter) tpo_06 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 6, session_high - tpo_section_range * 7, session_bar_counter) tpo_07 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 7, session_high - tpo_section_range * 8, session_bar_counter) tpo_08 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 8, session_high - tpo_section_range * 9, session_bar_counter) tpo_09 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 9, session_high - tpo_section_range * 10, session_bar_counter) tpo_10 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 10, session_high - tpo_section_range * 11, session_bar_counter) tpo_11 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 11, session_high - tpo_section_range * 12, session_bar_counter) tpo_12 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 12, session_high - tpo_section_range * 13, session_bar_counter) tpo_13 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 13, session_high - tpo_section_range * 14, session_bar_counter) tpo_14 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 14, session_high - tpo_section_range * 15, session_bar_counter) tpo_15 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 15, session_high - tpo_section_range * 16, session_bar_counter) tpo_16 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 16, session_high - tpo_section_range * 17, session_bar_counter) tpo_17 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 17, session_high - tpo_section_range * 18, session_bar_counter) tpo_18 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 18, session_high - tpo_section_range * 19, session_bar_counter) tpo_19 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 19, session_high - tpo_section_range * 20, session_bar_counter) tpo_20 = f_frequency_of_range(tf_close, session_high - tpo_section_range * 20, session_high - tpo_section_range * 21, session_bar_counter) // ||-- function to retrieve a specific tpo value f_get_tpo_count_1(_value) => _return = 0.0 if _value == 0 _return := tpo_00 _return if _value == 1 _return := tpo_01 _return if _value == 2 _return := tpo_02 _return if _value == 3 _return := tpo_03 _return if _value == 4 _return := tpo_04 _return if _value == 5 _return := tpo_05 _return if _value == 6 _return := tpo_06 _return if _value == 7 _return := tpo_07 _return if _value == 8 _return := tpo_08 _return if _value == 9 _return := tpo_09 _return if _value == 10 _return := tpo_10 _return if _value == 11 _return := tpo_11 _return if _value == 12 _return := tpo_12 _return if _value == 13 _return := tpo_13 _return if _value == 14 _return := tpo_14 _return if _value == 15 _return := tpo_15 _return if _value == 16 _return := tpo_16 _return if _value == 17 _return := tpo_17 _return if _value == 18 _return := tpo_18 _return if _value == 19 _return := tpo_19 _return if _value == 20 _return := tpo_20 _return _return f_get_tpo_count_2(_value) => _return = 0.0 if _value == 0 _return := tpo_00 _return if _value == 1 _return := tpo_01 _return if _value == 2 _return := tpo_02 _return if _value == 3 _return := tpo_03 _return if _value == 4 _return := tpo_04 _return if _value == 5 _return := tpo_05 _return if _value == 6 _return := tpo_06 _return if _value == 7 _return := tpo_07 _return if _value == 8 _return := tpo_08 _return if _value == 9 _return := tpo_09 _return if _value == 10 _return := tpo_10 _return if _value == 11 _return := tpo_11 _return if _value == 12 _return := tpo_12 _return if _value == 13 _return := tpo_13 _return if _value == 14 _return := tpo_14 _return if _value == 15 _return := tpo_15 _return if _value == 16 _return := tpo_16 _return if _value == 17 _return := tpo_17 _return if _value == 18 _return := tpo_18 _return if _value == 19 _return := tpo_19 _return if _value == 20 _return := tpo_20 _return _return tpo_sum = 0.0 current_poc_position = 0.0 //Modified by Naga Chaitanya:) current_poc_value = 0.0 for _i = 0 to 20 by 1 _get_tpo_value = f_get_tpo_count_1(_i) tpo_sum := tpo_sum + _get_tpo_value if _get_tpo_value > current_poc_value current_poc_position := _i current_poc_value := _get_tpo_value current_poc_value //plot(series=tpo_sum, title='tpo_sum', color=red) poc_upper = session_high - tpo_section_range * current_poc_position poc_lower = session_high - tpo_section_range * (current_poc_position + 1) //plot(series=current_poc_position, title='current_poc_position', color=color.blue) //plot(series=current_poc_value, title='current_poc_value', color=color.blue) // ||-- get value area high/low vah_position = current_poc_position val_position = current_poc_position current_sum = current_poc_value for _i = 0 to 20 by 1 if current_sum < tpo_sum * percent_of_tpo vah_position := max(0, vah_position - 1) current_sum := current_sum + f_get_tpo_count_2(round(vah_position)) current_sum if current_sum < tpo_sum * percent_of_tpo val_position := min(20, val_position + 1) current_sum := current_sum + f_get_tpo_count_2(round(val_position)) current_sum vah_value = session_high - tpo_section_range * vah_position val_value = session_high - tpo_section_range * (val_position + 1) //plot(series=current_sum, title='SUM', color=color.red) //plot(series=valuewhen(session_bar_counter == 0, vah_value[1], 0), title='VAH', color=color.navy, trackprice=true, offset=1, show_last=1) //plot(series=valuewhen(session_bar_counter == 0, val_value[1], 0), title='VAL', color=color.navy, trackprice=true, offset=1, show_last=1) f_gapper(_return_value) => _return = _return_value if session_bar_counter == 0 _return := na _return _return series1=f_gapper(valuewhen(session_bar_counter == 0, vah_value[1], 0)) series2=f_gapper(valuewhen(session_bar_counter == 0, val_value[1], 0)) series3=f_gapper(valuewhen(session_bar_counter == 0, poc_upper[1], 0)) series4=f_gapper(valuewhen(session_bar_counter == 0, poc_lower[1], 0)) //Plotting plot(mz and series1 ? series1:na, title='MZ: VAH', color=color.new(color.green, 10), linewidth=3, style=plot.style_cross, transp=0) plot(mz and series2 ? series2:na, title='MZ: VAL', color=color.new(color.red, 10), linewidth=3, style=plot.style_cross, transp=0) plot(mz and series3 ? series3:na, title='MZ: POC Upper', color=color.new(color.white, 10), linewidth=3, style=plot.style_cross, transp=0) plot(mz and series4 ? series4:na, title='MZ: POC Lower', color=color.new(color.yellow, 10), linewidth=3, style=plot.style_cross, transp=0) label_vah = label.new(bar_index, series1, text=mz ? (" MZ : VAH" + " " + tostring(nround(series1))) : na, style= label.style_none, textcolor = color.green,size= l_size) label.delete(label_vah[1]) label_val = label.new(bar_index, series2, text=mz ? (" MZ : VAL" + " " + tostring(nround(series2))) : na, style= label.style_none, textcolor = color.red,size= l_size) label.delete(label_val[1]) label_pocu = label.new(bar_index, series3, text=mz ? (" MZ : POC-U" + " " + tostring(nround(series3))) : na, style= label.style_none, textcolor = color.white,size= l_size) label.delete(label_pocu[1]) label_pocl = label.new(bar_index, series4, text=mz ? (" MZ : POC-L" + " " + tostring(nround(series4))) : na, style= label.style_none, textcolor = color.yellow,size= l_size) label.delete(label_pocl[1]) //Dev plot(dmz ? vah_value : na, title='Dev. VAH', color=color.new(color.fuchsia, 30)) plot(dmz ? val_value : na, title='Dev. VAL', color=color.new(color.fuchsia, 30)) plot(dmz ? poc_upper : na, title='Dev. POC Upper', color=color.new (color.white, 30)) plot(dmz ? poc_lower : na, title='Dev. POC Lower', color=color.new (color.gray, 30)) label_dvah = label.new(bar_index, vah_value, text=dmz ? (" DMZ : VAH" + " " + tostring(nround(vah_value))) : na, style= label.style_none, textcolor = color.green,size= l_size) label.delete(label_dvah[1]) label_dval = label.new(bar_index, val_value, text=dmz ? (" DMZ : VAL" + " " + tostring(nround(val_value))) : na, style= label.style_none, textcolor = color.green,size= l_size) label.delete(label_dval[1]) label_dpocu = label.new(bar_index, poc_upper, text=dmz ? (" DMZ : POC-U" + " " + tostring(nround(poc_upper))) : na, style= label.style_none, textcolor = color.green,size= l_size) label.delete(label_dpocu[1]) label_dpocl = label.new(bar_index, poc_lower, text=dmz ? (" DMZ : POC-L" + " " + tostring(nround(poc_lower))) : na, style= label.style_none, textcolor = color.green,size= l_size) label.delete(label_dpocl[1]) // Analysis openabove = f_gapper(valuewhen(session_bar_counter == 0, vah_value[1], 0)) < valuewhen(session_bar_counter == 0, open, 0) openbelow = f_gapper(valuewhen(session_bar_counter == 0, val_value[1], 0)) > valuewhen(session_bar_counter == 0, open, 0) openbetween = (f_gapper(valuewhen(session_bar_counter == 0, vah_value[1], 0)) > valuewhen(session_bar_counter == 0, open, 0)) and (f_gapper(valuewhen(session_bar_counter == 0, val_value[1], 0)) < valuewhen(session_bar_counter == 0, open, 0)) //Previous pdhigh = security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on) pdlow = security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on) pdclose = security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on) pdopen = security(syminfo.tickerid, "D", open[1], lookahead=barmerge.lookahead_on) plot(dl and pdhigh ? pdhigh : na, title="Previous Day High", style=plot.style_line, color= pdhigh != pdhigh[1] ? na : color.fuchsia, transp=0) plot(dl and pdlow ? pdlow : na, title="Previous Day Low", style=plot.style_line, color= pdlow != pdlow[1] ? na : color.fuchsia, transp=0) plot(dl and pdclose ? pdclose : na, title="Previous Day Close", style=plot.style_circles, color=#FF9800, linewidth = 2, transp=0) plot(dl and pdopen ? pdopen : na, title="Previous Day open", style=plot.style_circles, color=#FF9800, linewidth = 2, transp=0) label_dh = dl ? label.new(bar_index, pdhigh, text=display_value ? (" yHI" + " ......." + tostring(nround(pdhigh))) : "........yHI", style= label.style_none, textcolor=#FF9800, size= l_size) : na label.delete(label_dh[1]) label_dl = dl ? label.new(bar_index, pdlow, text=display_value ? (" yLO" + " ......." + tostring(nround(pdlow))) : "........yLO", style= label.style_none, textcolor=#FF9800, size= l_size) : na label.delete(label_dl[1]) label_dc = dl? label.new(bar_index, pdclose, text=display_value ? (" yCL" + "....... " + tostring(nround(pdclose))) : "........yCL", style= label.style_none, textcolor=#FF9800, size= l_size) : na label.delete(label_dc[1]) label_do = dl ? label.new(bar_index, pdopen, text=display_value ? (" yOP" + "......." + tostring(nround(pdopen))) : "........yOP", style= label.style_none, textcolor=#FF9800, size= l_size) : na label.delete(label_do[1]) //BB - 3D BB = input(title = 'Show BB ', defval = false, type = input.bool, group = "BB - 3D" ) length = input(20,title ="BB Length" ,minval=1, group = "BB - 3D") src = input(close, title="Source", group = "BB - 3D") mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group = "BB - 3D") basis = sma(src, length) dev = mult * stdev(src, length) dev1 = (mult + 1) * stdev(src, length) dev0 = (mult - 1) * stdev(src, length) upper = basis + dev lower = basis - dev upper1 = basis + dev1 lower1 = basis - dev1 upper0 = basis + dev0 lower0 = basis - dev0 offset = input(0, "Offset", minval = -500, maxval = 500, group = "BB - 3D") plot(BB ? basis : na, "Basis", color=color.white, offset = offset) p1 = plot(BB ? upper : na, "Delta U", color=color.red, offset = offset) p2 = plot(BB ?lower : na, "Delta L", color=color.red, offset = offset) p3 = plot(BB ? upper1 : na, "Delta 1U", color=color.green, offset = offset) p4 = plot(BB ?lower1 : na, "Delta 1L", color=color.green, offset = offset) p5 = plot(BB ? upper0 : na, "Delta -1U", color=color.blue, offset = offset) p6 = plot(BB ?lower0 : na, "Delta -1L", color=color.blue, offset = offset) fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95)) //-------------------------------------------------------------------------------------- //CPR dpopen = security(syminfo.tickerid, "D", open[1], barmerge.gaps_off, barmerge.lookahead_on) dphigh = security(syminfo.tickerid, "D", high[1], barmerge.gaps_off, barmerge.lookahead_on) dplow = security(syminfo.tickerid, "D", low[1], barmerge.gaps_off, barmerge.lookahead_on) dpclose = security(syminfo.tickerid, "D", close[1], barmerge.gaps_off, barmerge.lookahead_on) dprange = dphigh - dplow pivot = (dphigh + dplow + dpclose) / 3.0 bc = (dphigh + dplow) / 2.0 tc = pivot - bc + pivot label_pp = dp ? label.new(bar_index, pivot, text=display_value ? (" P " + " " ) : "P", style= label.style_none, textcolor=color.fuchsia, size= l_size) : na label.delete(label_pp[1]) label_bc = dp ? label.new(bar_index, bc, text=display_value ? (" BC" + " " ) : "BC", style= label.style_none, textcolor=color.fuchsia, size= l_size) : na label.delete(label_bc[1]) label_tc = dp ? label.new(bar_index, tc, text=display_value ? (" TC" + " " ) : "TC", style= label.style_none, textcolor=color.fuchsia, size= l_size) : na label.delete(label_tc[1]) //Plotting plot(dp and pivot ? pivot : na, title="Pivot", color=pivot != pivot[1] ? na : color.fuchsia, linewidth=2,transp=0) plot(dp and bc ? bc : na, title="BC", color=bc != bc[1] ? na : color.fuchsia,style = plot.style_circles, linewidth=2,transp=0) plot(dp and tc ? tc : na, title="TC", color=tc != tc[1] ? na : color.fuchsia, style = plot.style_circles,linewidth=2,transp=0) //---------------------------------------------------------------------------------------- //Camarilla Pivot //disp_c_labels = input.bool(false, "Labels", inline="cam",group="SUPPORT AND RESISTANCE") //h3_show = input.bool(true, "H3", inline="H", group="SUPPORT AND RESISTANCE") //l3_show = input.bool(true, "L3", inline="L", group="SUPPORT AND RESISTANCE") //h4_show = input.bool(true, "H4", inline="H", group="SUPPORT AND RESISTANCE") //l4_show = input.bool(true, "L4", inline="L", group="SUPPORT AND RESISTANCE") //h5_show = input.bool(true, "H5", inline="H", group="SUPPORT AND RESISTANCE") //l5_show = input.bool(true, "L5", inline="L", group="SUPPORT AND RESISTANCE") //h6_show = input.bool(true, "H6", inline="H", group="SUPPORT AND RESISTANCE") //l6_show = input.bool(true, "L6", inline="L", group="SUPPORT AND RESISTANCE") //label_size1 = input.string("small", options=["auto", "tiny", "small", "normal", "large", "huge"], title="Label size", group="SUPPORT AND RESISTANCE") //l_size = label_size1 == "auto" ? size.auto : label_size == "tiny" ? size.tiny : label_size == "small" ? size.small : label_size == "normal" ? size.normal : label_size == "large" ? size.large : size.huge //Expanded Camarilla Pivots Formula with 5 S&R h1 = dpclose + dprange * (1.1 / 12) h2 = dpclose + dprange * (1.1 / 6) h3 = dpclose + dprange * (1.1 / 4) h4 = dpclose + dprange * (1.1 / 2) l1 = dpclose - dprange * (1.1 / 12) l2 = dpclose - dprange * (1.1 / 6) l3 = dpclose - dprange * (1.1 / 4) l4 = dpclose - dprange * (1.1 / 2) h5 = dphigh / dplow * dpclose l5 = dpclose - (h5 - dpclose) h6 = h5 + 1.168 * (h5 - h4) l6 = dpclose - (h6 - dpclose) //plot(cp ? h5 : na, title="H5",style = plot.style_linebr, color=h5 != h5[1] ? na : color.blue, transp=0) plot(cp ? h4 : na, title="H4", style = plot.style_linebr,color=h4 != h4[1] ? na :color.white, transp=0) plot(cp ? h3 : na, title="H3",style = plot.style_linebr, color=h3 != h3[1] ? na :color.red, transp=0) plot(cp ? l3 : na, title="L3",style = plot.style_linebr, color=l3 != l3[1] ? na :color.green, transp=0) plot(cp ? l4 : na, title="L4", style = plot.style_linebr,color=l4 != l4[1] ? na :color.white, transp=0) //plot(cp ? l5 : na, title="L5",style = plot.style_linebr, color=l5 != l5[1] ? na :color.blue, transp=0) //lot(cp ? h6 : na, title="H6", style = plot.style_linebr,color=h6 != h6[1] ? na :color.fuchsia, transp=0) //lot(cp ? l6 : na, title="L6",style = plot.style_linebr, color=l6 != l6[1] ? na :color.fuchsia, transp=0) label_h3 = cp ? label.new(bar_index, h3, text=display_value ? (" H3" + " " + tostring(nround(h3))) : "H3", style= label.style_none, textcolor=color.red, size= l_size) : na label.delete(label_h3[1]) label_h4 = cp ? label.new(bar_index, h4, text=display_value ? (" H4" + " " + tostring(nround(h4))) : "H4", style= label.style_none, textcolor=color.white, size= l_size) : na label.delete(label_h4[1]) label_h5 = cp ? label.new(bar_index, h5, text=display_value ? (" H5" + " " + tostring(nround(h5))) : "H5", style= label.style_none, textcolor=color.blue, size= l_size) : na label.delete(label_h5[1]) label_l3 = cp ? label.new(bar_index, l3, text=display_value ? (" L3" + " " + tostring(nround(l3))) : "L3", style= label.style_none, textcolor=color.green, size= l_size) : na label.delete(label_l3[1]) label_l4 = cp ? label.new(bar_index, l4, text=display_value ? (" L4" + " " + tostring(nround(l4))) : "L4", style= label.style_none, textcolor=color.white, size= l_size) : na label.delete(label_l4[1]) label_l5 = cp ? label.new(bar_index, l5, text=display_value ? (" L5" + " " + tostring(nround(l5))) : "L5", style= label.style_none, textcolor=color.blue, size= l_size) : na label.delete(label_l5[1]) label_l6 = cp ? label.new(bar_index, l6 , text=display_value ? (" L6" + " " + tostring(nround(l6))) : "L6", style= label.style_none, textcolor=color.fuchsia, size= l_size) : na label.delete(label_l6[1]) label_h6 = cp ? label.new(bar_index, h6 , text=display_value ? (" H6" + " " + tostring(nround(h6))) : "H6", style= label.style_none, textcolor=color.fuchsia, size= l_size) : na label.delete(label_h6[1])
Financial Deepening
https://www.tradingview.com/script/N0TCjkBk-Financial-Deepening/
ashleykjoyce72
https://www.tradingview.com/u/ashleykjoyce72/
6
study
4
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© ashleykjoyce72 //@version=4 study("Financial Deepening") M2 = security("FRED:M2SL", "W", close) GDP = security("FRED:GDP", "W", close) plot(M2/GDP, linewidth=2, color=color.red)
US/CA Bond Yield Curve
https://www.tradingview.com/script/NsPuqfqR-US-CA-Bond-Yield-Curve/
EsIstTurnt
https://www.tradingview.com/u/EsIstTurnt/
16
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© EsIstTurnt //@version=5 indicator("US/CA Bond Yield Curve") overlay = true tfInput = input.timeframe("D", "Timeframe") yield1=input.symbol("US02MY", "Symbol 1") yield2=input.symbol("CA02MY", "Symbol 2") yield3=input.symbol("US02Y", "Symbol 3") yield4=input.symbol("CA02Y", "Symbol 4") yield5=input.symbol("US10Y", "Symbol 5") yield6=input.symbol("CA10Y", "Symbol 6") yield7=input.symbol("US30Y","Symbol 7") yield8=input.symbol("CA30Y", "Symbol 8") USlinewidth=input.int(defval=2,minval=0,maxval=4,title='US Line Width') CAlinewidth=input.int(defval=1,minval=0,maxval=4,title='CA Line Width') curve1 = request.security(yield1, 'D', close) curve2 = request.security(yield2, 'D', close) curve3 = request.security(yield3, 'D', close) curve4 = request.security(yield4, 'D', close) curve5 = request.security(yield5, 'D', close) curve6 = request.security(yield6, 'D', close) curve7 = request.security(yield7, 'D', close) curve8 = request.security(yield8, 'D', close) col1 = color.new(color.teal, 55) col2 = color.new(color.lime, 55) col3 = color.new(color.green, 55) col4 = color.new(color.yellow, 55) col5 = color.new(color.orange, 55) col6 = color.new(color.red, 55) col7 = color.new(color.maroon, 55) col8 = color.new(color.purple, 55) col9 = color.new(color.navy, 55) col10 = color.new(color.blue, 55) col11 = color.new(color.white, 55) //,title='US Line Style' plot(curve1, color=col1 , linewidth=USlinewidth,style=plot.style_linebr) plot(curve2, color=col1 , linewidth=CAlinewidth,style=plot.style_linebr) plot(curve3, color=col4 , linewidth=USlinewidth,style=plot.style_linebr) plot(curve4, color=col4 , linewidth=CAlinewidth,style=plot.style_linebr) plot(curve5, color=col6 , linewidth=USlinewidth,style=plot.style_linebr) plot(curve6, color=col6 , linewidth=CAlinewidth,style=plot.style_linebr) plot(curve7, color=col10, linewidth=USlinewidth,style=plot.style_linebr) plot(curve8, color=col10, linewidth=CAlinewidth,style=plot.style_linebr)
ETH MA Channel
https://www.tradingview.com/script/krAj4OXg-ETH-MA-Channel/
cryptoonchain
https://www.tradingview.com/u/cryptoonchain/
64
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© MJShahsavar //@version=5 indicator("ETH MA Channel", timeframe = "W", overlay=true) a=ta.sma(close, 200) b=a*6 d=a*3 c=a*1.6 e=a*0.5 p1=plot(a, color=color.red, linewidth = 2 ) p2=plot(b,color= #0000FF, linewidth = 2) p3=plot(c,color= color.green, linewidth = 2) p4=plot(d,color= color.olive, linewidth = 2) p5=plot(e,color= color.olive, linewidth = 2) fill(p2, p4, color.new(color.red, 90)) fill(p1, p5, color.new(color.blue, 90))
Money Velocity Population Adjusted (MVPA)
https://www.tradingview.com/script/QYxQxi2Z-Money-Velocity-Population-Adjusted-MVPA/
EsIstTurnt
https://www.tradingview.com/u/EsIstTurnt/
21
study
5
MPL-2.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // Β© EsIstTurnt //@version=5 indicator("Money Velocity Population Adjusted",shorttitle='MVPA (GDPPC/(M2/POP))') tf=input.timeframe(defval='1W') //USA(BLUE) usgdppc =(request.security(input.symbol(defval='USGDPPC'),tf,close)) uspop =(request.security(input.symbol(defval='USGDP'),tf,close)) usm2 =(request.security(input.symbol(defval='USM2'),tf,close)) usv = ta.ema(usgdppc/(usm2/uspop),4) plot(usv,color=#3244f0,title='USA') //CANADA(RED) cagdppc=(request.security(input.symbol(defval='CAGDPPC'),tf,close)) capop =(request.security(input.symbol(defval='CAGDP'),tf,close)) cam2 =(request.security(input.symbol(defval='CAM2'),tf,close)) cav = ta.ema(cagdppc/(cam2/capop),4) plot(cav,color=#ff0000,title='CANADA') //EUROPE(GREEN) eugdppc=(request.security(input.symbol(defval='EUGDPPC'),tf,close)) eupop =(request.security(input.symbol(defval='EUGDP'),tf,close)) eum2 =(request.security(input.symbol(defval='EUM2'),tf,close)) euv = ta.ema(eugdppc/(eum2/eupop),4) plot(euv,color=#27f50c,title='EUROPEon UNION') //CHINA(YELLOW) cngdppc=(request.security(input.symbol(defval='CNGDPPC'),tf,close)) cnpop =(request.security(input.symbol(defval='CNGDP'),tf,close)) cnm2 =(request.security(input.symbol(defval='CNM2'),tf,close)) cnv = ta.ema(cngdppc/(cnm2/cnpop),4) plot(cnv,color=#e3f036,title='CHINA') //RUSSIA(WHITE) rugdppc=(request.security(input.symbol(defval='RUGDPPC'),tf,close)) rupop =(request.security(input.symbol(defval='RUGDP'),tf,close)) rum2 =(request.security(input.symbol(defval='RUM2'),tf,close)) ruv = ta.ema(rugdppc/(rum2/rupop),4) plot(ruv,color=#ffffff,title='RUSSIA(distorts chart lol)') //TURKEY(ORANGE) trgdppc=(request.security(input.symbol(defval='TRGDPPC'),tf,close)) trpop =(request.security(input.symbol(defval='TRGDP'),tf,close)) trm2 =(request.security(input.symbol(defval='TRM2'),tf,close)) trv = ta.ema(trgdppc/(trm2/trpop),4) plot(trv,color=#f5840c,title='TURKEY') //AUSTRALIA(PINK) augdppc=(request.security(input.symbol(defval='AUGDPPC'),tf,close)) aupop =(request.security(input.symbol(defval='AUGDP'),tf,close)) aum3 =(request.security(input.symbol(defval='AUM3'),tf,close)) auv = ta.ema(augdppc/(aum3/aupop),4) plot(auv,color=#d707de,title='AUSTRALIA(M3)') //GREAT BRITAIN(LIGHT BLUE) gbgdppc=(request.security(input.symbol(defval='GBGDPPC'),tf,close)) gbpop =(request.security(input.symbol(defval='GBGDP'),tf,close)) gbm2 =(request.security(input.symbol(defval='GBM2'),tf,close)) gbv = ta.ema(gbgdppc/(gbm2/gbpop),4) plot(gbv,color=#07c5de,title='BRITAIN') //INDIA(BROWN) ingdppc =(request.security(input.symbol(defval='INGDPPC'),tf,close)) inpop =(request.security(input.symbol(defval='INGDP'),tf,close)) inm2 =(request.security(input.symbol(defval='INM2'),tf,close)) inv = ta.ema(ingdppc/(inm2/inpop),4) plot(inv,color=#de3404,title='INDIA')