xel_arjona

Acc/DistAMA with FRACTAL DEVIATION BANDS by @XeL_Arjona

ACCUMULATION/DISTRIBUTION ADAPTIVE MOVING AVERAGE with FRACTAL DEVIATION BANDS
Ver. 2.5 @ 16.09.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:
  • Buy (Bull) and Sell (Bear) "Power Balance Algorithm" by:
    Stocks & Commodities V. 21:10 (68-72): "Bull And Bear Balance Indicator by Vadim Gimelfarb"
  • Fractal Deviation Bands by @XeL_Arjona.
  • Color Cloud Fill by @ChrisMoody

CHANGE LOG:
  • Following a "Fractal Approach" now the lookback window is hardcode correlated with a given timeframe. (Default @ 126 days as Half a Year / 252 bars)
  • Clean and speed up of Adaptive Moving Average Algo.
  • Fractal Deviation Band Cloud coloring smoothed.

>

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. Copyright 2015
从常用的脚本中删除 添加到常用的脚本
//	* ACCUMULATION/DISTRIBUTION ADAPTIVE MOVING AVERAGE with FRACTAL DEVIATION BANDS.
//    Ver. 2.5 @ 16.09.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:
//      + Buy (Bull) and Sell (Bear) "Power Balance Algorithm" by:
//          Stocks & Commodities V. 21:10 (68-72):
//          "Bull And Bear Balance Indicator by Vadim Gimelfarb"
//      + "Fractal Deviation Bands" idea by @XeL_Arjona.
//      + Color Cloud Fill Condition algorithm by @ChrisMoody
//
//      CHANGE LOG:
//
//      -  Following a "Fractal Approach" now the lookback window
//          is hardcode correlated with a given timeframe.
//          (Default @ 126 days as Half a Year / 252 bars)
//      -  Clean and speed up of Adaptive Moving Average Algo.
//      -  Fractal Deviation Band Cloud coloring smoothed.
//      
//            << THIS IS AN EXPERIMENTAL INDICATOR !! >>
//
//         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("Accumulation/DistributionAMA with FRACTAL DEVIATION BANDS by @XeL_Arjona", shorttitle="adFDB_XeL", overlay=true)
sbm = input(1, title="Harmonics: fibo(1) padovan(2)", defval=1, minval=1, maxval=2)
resi = input(title="Fixed Resolution @ :", type=resolution, defval="D")
p = input(title="Lookback on Fixed Resolution:", defval=126)
novol = input(false, title="Weight A/D Line without Volume:")
colb = input(false, title="Acc/Dist ColorBars:")
// MAIN GENERAL VARIABLES/FUNCTIONS
resb = resi
bc1 = #99ff99
bc2 = #4ccc4c
bc3 = #1a801a
bc4 = #004c0d
sc1 = #ffc0c0
sc2 = #ff8080
sc3 = #ff4040
sc4 = red
// N-Adaptive Moving Average
nama(array,periods,a) =>
    nmEma = nz(nmEma[1], array) + a * (array-nz(nmEma[1], array))
// 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
//Algebraic Constants for general calculations.
_phi = 1.618033  // Phi Number (Fibonacci Seq.)
_pn =  1.324718  // Plastic Number (Podovan Seq.)
Fm = iff(sbm==1,_phi,iff(sbm==2,_pn,0))
// Close Conditions for Pressure Algorithms
cl = close
op = open
hi = high
lo = low
// Bull And Bear "Power-Balance" by Vadim Gimelfarb Algorithm
BP =    iff(cl<op,          iff(cl[1]<op,   max(hi-cl[1], cl-lo), 
                                            max(hi-op, cl-lo)),
        iff(cl>op,          iff(cl[1]>op,   hi-lo, 
                                            max(op-cl[1], hi-lo)),
        iff(hi-cl>cl-lo,    iff(cl[1]<op,   max(hi-cl[1],cl-lo),
                                            hi-op),
        iff(hi-cl<cl-lo,    iff(cl[1]>op,   hi-lo,
                                            max(op-cl[1], hi-lo)),
        iff(cl[1]>op,       max(hi-op, cl-lo),
        iff(cl[1]<op,       max(op-cl[1], hi-lo),
        hi-lo))))))
SP =    iff(cl<op,          iff(cl[1]>op,   max(cl[1]-op, hi-lo),
                                            hi-lo),
        iff(cl>op,          iff(cl[1]>op,   max(cl[1]-lo, hi-cl),
                                            max(op-lo, hi-cl)),
        iff(hi-cl>cl-lo,    iff(cl[1]>op,   max(cl[1]-op, hi-lo),
                                            hi-lo),
        iff(hi-cl<cl-lo,    iff(cl[1]>op,   max(cl[1]-lo, hi-cl),
                                            op-lo),
        iff(cl[1]>op,       max(cl[1]-op, hi-lo),
        iff(cl[1]<op,       max(op-lo, hi-cl),
        hi-lo))))))
TP = BP+SP
// GENERAL CALCULATION VARIABLES FOR STUDIES
// Workaround condition for non-reported volume securities.
evol = volume
vol = na(evol) ? 1 : iff(evol <= 0, 1, evol)
// Buy&Sell Pressure Volume (Accumulation-Distribution)
BPV = novol ? BP/TP : (BP/TP)*vol
SPV = novol ? SP/TP : (SP/TP)*vol
TPV = BPV+SPV
bpS = sum(BPV,p)
bpSum = security(tickerid,resb,bpS)
spS = sum(SPV,p)
spSum = security(tickerid,resb,spS)
// Volume Pressures Weighted Averages (Volatility nEMA)
alpha = 2/(p+1) // Original EWMA alpha - Use any Alpha Weighting of your choice to Adapt the Avg.
bpMavg = nama(BPV*(close),p,alpha) / nama(TPV,p,alpha)*2
spMavg = nama(SPV*(close),p,alpha) / nama(TPV,p,alpha)*2
VPMavg = avg(bpMavg,spMavg)
// Fractal Deviation Bands (Morphic Multiplier)
vortex = security(tickerid,resb,VPMavg)
dev = Fm
FDBvt = BolTop(vortex,p,dev)
TB1 = security(tickerid,resb,FDBvt) 
FDB1t = BolTop(FDBvt,p,dev)
TB2 = security(tickerid,resb,FDB1t)
FDB2t = BolTop(FDB1t,p,dev)
TB3 = security(tickerid,resb,FDB2t)
FDB3t = BolTop(FDB2t,p,dev)
TB4 = security(tickerid,resb,FDB3t)
FDBvb = BolBot(vortex,p,dev)
BB1 = security(tickerid,resb,FDBvb)
FDB1b = BolBot(FDBvb,p,dev)
BB2 = security(tickerid,resb,FDB1b)
FDB2b = BolBot(FDB1b,p,dev)
BB3 = security(tickerid,resb,FDB2b)
FDB3b = BolBot(FDB2b,p,dev)
BB4 = security(tickerid,resb,FDB3b)
// PLOT DIRECTIVES
TrendCol = bpSum > spSum ? black : bpSum == spSum ? gray : #ff0000
VortexCol = close >= vortex ? green : red
//Center Avg Line
va = plot(vortex, color=VortexCol, title='Vortex', style=line, linewidth=2, transp=0)
//Fractal Bands
t1 = plot(TB1, color=bc4, editable=false)
t2 = plot(TB2, color=bc3, editable=false)
t3 = plot(TB3, color=bc2, editable=false)
t4 = plot(TB4, color=bc1, editable=false)
b1 = plot(BB1, color=sc4, editable=false)
b2 = plot(BB2, color=sc3, editable=false)
b3 = plot(BB3, color=sc2, editable=false)
b4 = plot(BB4, color=sc1, editable=false)
// Cloud Background
fill(va, t1, color=bc1, transp=81, title='BullZ1')
fill(t1, t2, color=bc2, transp=81, title='BullZ2')
fill(t2, t3, color=bc3, transp=81, title='BullZ3')
fill(t3, t4, color=bc4, transp=81, title='BullZ4')
fill(va, b1, color=sc1, transp=81, title='BearZ1')
fill(b1, b2, color=sc2, transp=81, title='BearZ2')
fill(b2, b3, color=sc3, transp=81, title='BearZ3')
fill(b3, b4, color=sc4, transp=81, title='BearZ4')
barcolor(colb ? TrendCol:na, editable=false)
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 网站规则 版主 网站 & 经纪商解决方案 插件 图表解决方案 寻求帮助 功能请求 博客 & 新闻 常见问题 维基百科 Twitter
概述 个人资料设置 账号和账单 寻求帮助 已发表观点 粉丝 正在关注 私人消息 聊天 退出