0% found this document useful (0 votes)
41 views10 pages

#2962FF #787B86 #787B86 #787B86

The document contains code for analyzing technical indicators like MFI, pivots, bullish/bearish signals etc. It defines variables and inputs for parameters like period lengths and lookback values. It then plots the MFI indicator and defines logic for regular/hidden bullish and bearish signals based on the MFI and price values. Labels are plotted when the conditions for the signals are met.

Uploaded by

2-states
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views10 pages

#2962FF #787B86 #787B86 #787B86

The document contains code for analyzing technical indicators like MFI, pivots, bullish/bearish signals etc. It defines variables and inputs for parameters like period lengths and lookback values. It then plots the MFI indicator and defines logic for regular/hidden bullish and bearish signals based on the MFI and price values. Labels are plotted when the conditions for the signals are met.

Uploaded by

2-states
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

// Price:

priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1)

bearCond = plotBear and priceHH and oscLH and phFound

plot(phFound ? osc[lbR] : na, offset=-lbR, title="Regular Bearish", linewidth=1, color=(bearCond ?


bearColor : noneColor), transp=0)

plotshape(bearCond ? osc[lbR] : na, offset=-lbR, title="Regular Bearish Label", text=" B ",


style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor, transp=0)

//------------------------------------------------------------------------------

// Hidden Bearish

// Osc: Higher High

len = input(title="MFI Period", minval=1, defval=10)


src = input(title="MFI Source", defval=close)
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)
osc = mfi(src, len)

plot(osc, title="MFI", linewidth=2, color=#2962FF)


hline(50, title="Middle Line", color=#787B86, linestyle=hline.style_dotted)
obLevel = hline(80, title="Overbought", color=#787B86, linestyle=hline.style_dotted)
osLevel = hline(20, title="Oversold", color=#787B86, linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=color.rgb(33, 150, 243, 90))

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

priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1)


bullCond = plotBull and priceLL and oscHL and plFound

plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=2,
color=(bullCond ? bullColor : noneColor)
)

plotshape(
bullCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish Label",
text=" Bull ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor
)

//------------------------------------------------------------------------------
// Hidden Bullish
// 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)
hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound

plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bullish",
linewidth=2,
color=(hiddenBullCond ? hiddenBullColor : noneColor)
)

plotshape(
hiddenBullCond ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bullish Label",
text=" H Bull ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor
)

//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High

oscLH = osc[lbR] < valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Higher High

priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1)

bearCond = plotBear and priceHH and oscLH and phFound

plot(
phFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bearish",
linewidth=2,
color=(bearCond ? bearColor : noneColor)
)

plotshape(
bearCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bearish Label",
text=" Bear ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor
)

//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High

oscHH = osc[lbR] > valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Lower High

priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1)

VWAP OVERSOLD", type=input.float)

RSI_VWAP = rsi(vwap(close), RSI_VWAP_length)

.price, size=size.small) :

, rsiRSI[1]-1, "BULL", color=color.green, textcolor=color.white, style=label.style_labelup,


yloc=yloc.price, size=size.small) :

divbullRSI := true

divbullRSI := true

label.new (bar_index-1, rsiRSI[1]-1, "BULL", color=color.green, textcolor=color.white,


style=label.style_labelup, yloc=yloc.price, size=size.small) :

pivothRSI ?
label.new (bar_index-2, max_rsiRSI+1, "PIVOT", color=color.blue, textcolor=color.white,
style=label.style_labeldown, yloc=yloc.price, size=size.small) :

pivotlRSI ?

if (minRSI[1] < minRSI[2]) and (rsiRSI[1] > min_rsiRSI) and (rsiRSI >= rsiRSI[1])

 If opening first five minute Candle Above R1 or Below S1


 Rate of Change 
 https://www.tradingview.com/script/PvzZIeoo-RESEARCH-Rate-of-
Change/


 Mean Absolute Deviation 
 https://www.tradingview.com/script/qXc06HaE-RESEARCH-Mean-
Absolute-Deviation/


 Custom Median vs Built-in Median 
 https://www.tradingview.com/script/yjQx0BVg-RESEARCH-Custom-
Median-vs-Built-in-Median/


 Quasi White Noise 
 https://www.tradingview.com/script/UWKXaj5O-RESEARCH-Quasi-
White-Noise/

 Rate of Change 
 https://www.tradingview.com/script/PvzZIeoo-RESEARCH-Rate-of-
Change/


 Mean Absolute Deviation 
 https://www.tradingview.com/script/qXc06HaE-RESEARCH-Mean-
Absolute-Deviation/


 Custom Median vs Built-in Median 
 https://www.tradingview.com/script/yjQx0BVg-RESEARCH-Custom-
Median-vs-Built-in-Median/


 Quasi White Noise 
 https://www.tradingview.com/script/UWKXaj5O-RESEARCH-Quasi-
White-Noise/


 Rate of Change 
 https://www.tradingview.com/script/PvzZIeoo-RESEARCH-Rate-of-
Change/


 Mean Absolute Deviation 
 https://www.tradingview.com/script/qXc06HaE-RESEARCH-Mean-
Absolute-Deviation/


 Custom Median vs Built-in Median 
 https://www.tradingview.com/script/yjQx0BVg-RESEARCH-Custom-
Median-vs-Built-in-Median/


 Quasi White Noise 
 https://www.tradingview.com/script/UWKXaj5O-RESEARCH-Quasi-
White-Noise/


Rate of Change 
https://www.tradingview.com/script/PvzZIeoo-RESEARCH-Rate-of-Change/

Mean Absolute Deviation 


https://www.tradingview.com/script/qXc06HaE-RESEARCH-Mean-Absolute-
Deviation/
Custom Median vs Built-in Median 
https://www.tradingview.com/script/yjQx0BVg-RESEARCH-Custom-Median-vs-
Built-in-Median/

Quasi White Noise 


https://www.tradingview.com/script/UWKXaj5O-RESEARCH-Quasi-White-
Noise/

SMA Crossover Prediction 


https://www.tradingview.com/script/aERsVfMF-RESEARCH-SMA-Crossover-
Prediction/
Rate of Change 
https://www.tradingview.com/script/PvzZIeoo-RESEARCH-Rate-of-
Change/

Mean Absolute Deviation 


https://www.tradingview.com/script/qXc06HaE-RESEARCH-Mean-
Absolute-Deviation/

Custom Median vs Built-in Median 


https://www.tradingview.com/script/yjQx0BVg-RESEARCH-Custom-
Median-vs-Built-in-Median/

Quasi White Noise 


https://www.tradingview.com/script/UWKXaj5O-RESEARCH-Quasi-
White-Noise/
SMA Crossover Prediction 
https://www.tradingview.com/script/aERsVfMF-RESEARCH-SMA-
Crossover-Prediction/

Percentrank Bug 
https://www.tradingview.com/script/GibJ8AAn-RESEARCH-Percentrank-
Bug/

Kendall Rank Correlation CoefficieIt Will Be a “TRENDING DAY”

 OPEN Between CPR- R1 OR CPR-S1


 If opening first five minute Candle are between CPR- R1 or CPR- S1
It Will Be a “RANGE BOUND DAY”. Until R1/S1 or Previous Day High/Low
Breaks

OPEN Exactly RSI_VWAP_length = input(17, "RSI-VWAP LENGTH")

RSI_VWAP_overSold = input(20, "RSI-VWAP OVERSOLD", type=input.float)

RSI_VWAP_overBought = input(80, "RSI-VWAP OVERBOUGHT", type=input.float)

// RSI with VWAP as source

RSI_VWAP = rsi(vwap(close), RSI_VWAP_length)

// Plotting, overlay=false

r=plot(RSI_VWAP, color = RSI_VWAP > RSI_VWAP_overBought ? color.red : RSI_VWAP <


RSI_VWAP_overSold ? color.lime : color.blue, title="rsi", linewidth=2, style=plot.style_line)

h1=plot(RSI_VWAP_overBought, color = color.gray, style=plot.style_stepline)

h2=plot(RSI_VWAP_overSold, color = color.gray, style=plot.style_stepline)

fill(r,h1, color = RSI_VWAP > RSI_VWAP_overBought ? color.red : na, transp = 60)

fill(r,h2, color = RSI_VWAP < RSI_VWAP_overSold ? color.lime : na, transp = 60)

rsiRSI = RSI_VWAP
// DIVS code

pivRSI = input(false,"Hide pivots?")

shrt = input(false,"Shorter labels?")

hidel = input(false, "Hide labels and color background")

xbarsRSI = input(defval=90, title="Div lookback period (bars)?", type=input.integer, minval=1)

hbRSI = abs(highestbars(rsiRSI, xbarsRSI)) // Finds bar with highest value in last X bars

lbRSI = abs(lowestbars(rsiRSI, xbarsRSI)) // Finds bar with lowest value in last X bars

// Defining variable values, mandatory in Pine 3

maxRSI = float(na)

max_rsiRSI = float(na)

minRSI = float(na)

min_rsiRSI = float(na)

pivothRSI = bool(na)

pivotlRSI = bool(na)

divbearRSI = bool(na)

divbullRSI = bool(na)

// If bar with lowest / highest is current bar, use it's value

maxRSI := hbRSI == 0 ? close : na(maxRSI[1]) ? close : maxRSI[1]

max_rsiRSI := hbRSI == 0 ? rsiRSI : na(max_rsiRSI[1]) ? rsiRSI : max_rsiRSI[1]

minRSI := lbRSI == 0 ? close : na(minRSI[1]) ? close : minRSI[1]

min_rsiRSI := lbRSI == 0 ? rsiRSI : na(min_rsiRSI[1]) ? rsiRSI : min_rsiRSI[1]

// Compare high of current bar being examined with previous bar's high

// If curr bar high is higher than the max bar high in the lookback window range

if close > maxRSI // we have a new high

maxRSI := close // change variable "max" to use current bar's high value

if rsiRSI > max_rsiRSI // we have a new high

max_rsiRSI := rsiRSI // change variable "max_rsi" to use current bar's RSI value
if close < minRSI // we have a new low

minRSI := close // change variable "min" to use current bar's low value

if rsiRSI < min_rsiRSI // we have a new low

min_rsiRSI := rsiRSI // change variable "min_rsi" to use current bar's RSI value

// Finds pivot point with at least 2 right candles with lower value

>= rsiRSI[1])

divbullRSI := true

// Alerts

You might also like