xel_arjona

McGinley Dynamic with FRACTAL DEVIATION BANDS by @XeL_Arjona

McGINLEY DYNAMIC with FRACTAL DEVIATION BANDS.
Ver. 1.0.beta.25.08.2015
By Ricardo M Arjona @XeL_Arjona


DISCLAIMER

The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets. -- The embedded code and ideas within this work are FREELY AND PUBLICLY available on the Web for NON LUCRATIVE ACTIVITIES and must remain as is.

WHAT IS THIS?

This is my first adaptation of the FRACTAL DEVIATION BANDS to the "McGinley Dynamic Line". Be advised that the nature of this line tend to need some adjustments at the "Smooth Factor" if you see a flat line with tiny values.

Pine Script code MOD's and adaptations by @XeL_Arjona with special mention in regard of:
  • Morphic Numbers: (PHI & Plastic) Pine Script adaptation from it's algebraic generation formulas by @XeL_Arjona.

  • FRACTAL DEVIATION BANDS: main idea by @XeL_Arjona

ALL NEW IDEAS OR MODIFICATIONS to these indicator(s) are Welcome in favor to deploy a better and more accurate readings. I will be very glad to be notified at Twitter or TradingVew accounts at: @XeL_Arjona. Any important addition to this work MUST REMAIN PUBLIC by means of CreativeCommons CC             & TradingView.
2015
Remove from Favorite Scripts Add to Favorite Scripts
//	* MCGINLEY DYNAMIC with FRACTAL DEVIATION BANDS.
//    Ver. 1.0.beta.25.08.2015
//    By Ricardo M Arjona @XeL_Arjona
//	
//		DISCLAIMER:
//
//      The Following indicator/code IS NOT intended to be
//      a formal investment advice or recommendation by the
//      author, nor should be construed as such. Users
//      will be fully responsible by their use regarding 
//      their own trading vehicles/assets.
//
//		The embedded code and ideas within this work are 
//		FREELY AND PUBLICLY available on the Web
//		for NON LUCRATIVE ACTIVITIES and must remain as is.
//
//		Pine Script code MOD's and adaptations by @XeL_Arjona 
//      with special mention in regard of:
//      + "Morphic Numbers" (PHI & Plastic) Pine Script addaptation
//          from it's algebraic generation formulas by @XeL_Arjona
//      + "Fractal Deviation Bands" idea by @XeL_Arjona.
//      + Color Cloud Fill Condition algorithm by @ChrisMoody
//
//         ALL NEW IDEAS OR MODIFICATIONS to these indicator(s) are
//      Welcome in favor to deploy a better and more accurate readings.
//      I will be very glad to be notified at Twitter or TradingVew
//      accounts at:   @XeL_Arjona
//
//      Any important addition to this work MUST REMAIN
//      PUBLIC by means of CreativeCommons CC & TradingView.
//      2015
//		
//////////////////////////////////////////////////////////////////
study("McGinley Dynamic with FRACTAL DEVIATION BANDS by @XeL_Arjona", shorttitle="mdFDB_XeL", overlay=true)
p = input(title="Smooth Factor:", defval=10)
src = input(title="Source", type=source, defval=close)
smn = input(false, title="Switch PHI Multiplier to PN:")
// McGinley Dynamic Line
md(S, N) => 
    mg = na(mg[1]) ? ema(S, N) : mg[1] + (S - mg[1]) / (N * pow(S/mg[1], 4))
// N Root Function
nroot(index,number) =>
    cond_r = index == 0 or number == 0 or number < 0
    If_True = 0
    If_False = (exp((1/index) * log(number)))
    iff(cond_r, If_True, If_False)
// Bollinger Bands Function
BolTop(array,per,mult) =>
    std = stdev(array,per)*mult
    bbt = array + std
BolBot(array,per,mult) =>
    std = stdev(array,per)*mult
    bbb = array - std
//Morphic Number Constants for FRACTAL Multipliers.
_phi = (1+sqrt(5))/2  // Phi Number (Fibonacci Seq.)
_pn = (nroot(3,(108 + 12*sqrt(69))) + nroot(3,(108 - 12*sqrt(69))))/6  // Plastic Number (Podovan Seq.)
Fm = smn ? _pn : _phi
vortex = md(src,p)
// Fractal Deviation Bands (Morphic Multiplier)
FDBvt = BolTop(vortex,p,Fm)   // Add As many layers
FDB1t = BolTop(FDBvt,p,Fm)    //  of fractal bands at
FDB2t = BolTop(FDB1t,p,Fm)    //  will.  Each band
FDB3t = BolTop(FDB2t,p,Fm)
FDBvb = BolBot(vortex,p,Fm)   //  is calculated having
FDB1b = BolBot(FDBvb,p,Fm)    //  as base the last one and
FDB2b = BolBot(FDB1b,p,Fm)    //  multiplied by morphic const.
FDB3b = BolBot(FDB2b,p,Fm)
// PLOT DIRECTIVES
CondCol = close > vortex ? green : red
//Center Avg Line
va = plot(vortex, color=CondCol, title='Vortex', style=line, linewidth=2, transp=0)
//Fractal Bands
t1 = plot(FDBvt, color=green, editable=false)
t2 = plot(FDB1t, color=green, editable=false)
t3 = plot(FDB2t, color=green, editable=false)
t4 = plot(FDB3t, color=green, editable=false)
b1 = plot(FDBvb, color=red, editable=false)
b2 = plot(FDB1b, color=red, editable=false)
b3 = plot(FDB2b, color=red, editable=false)
b4 = plot(FDB3b, color=red, editable=false)
// Cloud Background
fill(va, t1, color=green, transp=66, title='BullZ1')
fill(t1, t2, color=green, transp=75, title='BullZ2')
fill(t2, t3, color=green, transp=84, title='BullZ3')
fill(t3, t4, color=green, transp=93, title='BullZ4')
fill(va, b1, color=red, transp=66, title='BearZ1')
fill(b1, b2, color=red, transp=75, title='BearZ2')
fill(b2, b3, color=red, transp=84, title='BearZ3')
fill(b3, b4, color=red, transp=93, title='BearZ4')
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out