OPEN-SOURCE SCRIPT

Stochastic with False bar R2-2 by JustUncleL updated to Ver 5

Update JustUncleL to version 5 from version 3
//version=3

study("Stochastic with False bar R2-2 by JustUncleL", overlay=false)

//
// Revision: R2-2
// Original Author: JustUncleL
//
// Description:
// This study project is an implementation of the "Stochastic False BAR indicator.
// The standard Stoch buy/sell indications come from Stoch crosses about the
// overbought/oversold zones 80/20. This does not work all the time and you get
// stuck in the OB/OS zones.
// So "False BAR" (Black) indicates when it is unsafe to take Stochastic cross over trades.
// Where the false bar does not appear (aqua), the overbought / oversold conditions
// of the Stochastic can be considered higher-probability reversal areas and,
// thus, trading opportunities.
//
// Revisions:
// R2 - Added options to enable/disable False Bar lines and Stoch trends.
// - Added options to modify upper and lower limits of false bar Stoch and
// trading stochastic trend.
// - Added option to show the trading Stochastic as coloured Ribbon.
// - Added name titles for all plots
// - Added Background highlighting for False Bar.
//
// R1 - Original Version
//

// === INPUTS ===
ShowFalseBar = input(true,title="Show False Bar Lines")
ShowFalseStoch = input(false,title="Show False Bar Stochastic Trend")
FBStochLen = input(45, minval=2, title ="False Bar Stochastic Length")
FBsmoothK = input(4, minval=1, title = "False Bar Smooth K")
FBsmoothD = input(2, minval=1, title = "False Bar Smooth D")
FBupperLimit = input(80,minval=50,maxval=100,title="False Bar Stoch Upper Limit")
FBlowerLimit = input(20,minval=0,maxval=50,title="False Bar Stoch Lower Limit")
//
StochLen = input(8, minval=2, title = "Stoch Length")
smoothK = input(3, minval=1, title = "Smooth K")
smoothD = input(3, minval=1, title = "Smooth D")
upperLimit = input(80,minval=50,maxval=100,title="Stoch Upper Limit")
lowerLimit = input(20,minval=0,maxval=50,title="Stoch Lower Limit")
showRibbon = input(true,title="Show Stochastic as Coloured Ribbon")

// === /INPUTS ===

// === SERIES ===
// Stoch value - False Bar
FBStochK = sma(stoch(close, high, low, FBStochLen), FBsmoothK)
FBStochD = sma(FBStochK, FBsmoothD)

// Stoch values
StochK = sma(stoch(close, high, low, StochLen), smoothK)
StochD = sma(StochK, smoothD)
// === /SERIES ===

// === PLOTTING ===
//
hl=hline(lowerLimit, title="Lower Limit", color=green,linewidth=2,linestyle=dashed)
hc=hline(50, title="50 Centre", color=gray,linewidth=1,linestyle=dashed)
hh=hline(upperLimit, title="Upper Limit", color=maroon,linewidth=2,linestyle=dashed)
fill(hl,hh,color=blue,transp=90)
//
c1=FBStochK>FBupperLimit?black:aqua
a1=plot( ShowFalseBar?100:na, color=c1, transp=40, linewidth=1,title="FB Upper Line 1")
b1=plot( ShowFalseBar?105:na, color=c1, transp=40, linewidth=1, title="FB Upper Line 2")
fill(a1,b1,color=c1,transp=40,title="FB Upper Line Fill")
bgcolor(ShowFalseBar and FBStochK>FBupperLimit?black:na, transp=85)
//
c2=FBStochK<FBlowerLimit?black:aqua
a2=plot( ShowFalseBar?0:na, color=c2, transp=40, linewidth=1,title="FB Lower Line 1")
b2=plot( ShowFalseBar?-5:na, color=c2, transp=40, linewidth=1,title="FB Lower Line 2")
fill(a2,b2,color=c2,transp=40,title="FB Lower Line Fill")
bgcolor(ShowFalseBar and FBStochK<FBlowerLimit?black:na, transp=85)
//
plot( StochK,"StoK", color=green, linewidth=1,transp=20)
plot( StochD,"StoD", color=red, linewidth=1,transp=20)
pk=plot( showRibbon?StochK:na,"StoK Ribbon", color=green, linewidth=1,transp=100)
pd=plot( showRibbon?StochD:na,"StoD Ribbon", color=red, linewidth=1,transp=100)
fill(pk,pd,color=StochK>=StochD?green:red,transp=80,title="Sto Ribbon Fill")

//
c3=FBStochK>FBStochD?aqua:red
a3=plot( ShowFalseStoch?FBStochK:na,"FB StoK", color=c3, transp=0, linewidth=1)
b3=plot( ShowFalseStoch?FBStochD:na,"FB StoD", color=c3, transp=0, linewidth=1)
fill(a3,b3,color=c3,transp=0,title="FB Sto Fill")
// === /PLOTTING ===

// eof
Moving AveragesOscillatorsSimple Moving Average (SMA)

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian