Professional Documents
Culture Documents
Fractal PFCC
Fractal PFCC
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
//
// Details and background information on "PFCC - Pivot Fractal Chaos Channel" and
how to use this indicator can be found in the description of this indicator.
//
// The code is briefly commented. Please feel free to use or further customize
it ... And, of course, I would be happy to be named and/or linked.
// If you're satisfied, maybe buy me a coffee ;-)
//
// I'm curious to see how this indicator will develop with more ideas - Please keep
me updated by commenting below or by sending me a message.
//
// consilus @ https://www.tradingview.com/u/consilus/
//
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
//@version=4
study(title="PFCC - Pivot Fractal Chaos Channel (dv63o)", overlay=true,
max_bars_back=2000, max_labels_count=500)
// --------------------------------------------------
// Pivot Fractal Chaos Channel
// --------------------------------------------------
// Data to use / Returns:
// - PFCC_UpperBand_Value
// - PFCC_LowerBand_Value
// - PFCC_Signal_OrderDirection (-1, 0, 1) [<> 0 when price crosses the Pivot
Fractal Chaos Channel]
// - PFCC_Signal_Price2Channel (-1, 0, 1) [based on position of price to Pivot
Fractal Chaos Channel]
// --------------------------------------------------
// --------------------------------------------------
// Inputs
// --------------------------------------------------
PFCC_Set_LengthLeft = input(title="Pivot Length left side", defval=15, minval=1,
maxval=999, group="PFCC - Pivot Fractal Chaos Channel [by consilus]")
PFCC_Set_LengthRight = input(title="Pivot Length right side", defval=15, minval=1,
maxval=999, group="PFCC - Pivot Fractal Chaos Channel [by consilus]")
// --------------------------------------------------
// Calculation
// --------------------------------------------------
PFCC_High_Value = pivothigh(high, PFCC_Set_LengthLeft, PFCC_Set_LengthRight)
PFCC_Low_Value = pivotlow(low, PFCC_Set_LengthLeft, PFCC_Set_LengthRight)
PFCC_UpperBand_Value = 0.0
PFCC_UpperBand_Value := na(PFCC_High_Value) ? PFCC_UpperBand_Value[1] :
high[PFCC_Set_LengthRight]
PFCC_LowerBand_Value = 0.0
PFCC_LowerBand_Value := na(PFCC_Low_Value) ? PFCC_LowerBand_Value[1] :
low[PFCC_Set_LengthRight]
// --------------------------------------------------
// Signals
// --------------------------------------------------
PFCC_Signal_OrderDirection = (close <= PFCC_LowerBand_Value and open >=
PFCC_LowerBand_Value) ? -1 : (close >= PFCC_UpperBand_Value and open <=
PFCC_UpperBand_Value) ? 1 : 0
// --------------------------------------------------
// Plotting
// --------------------------------------------------
color_Bullish = color.new(#2196F3, 0)
color_Bearish = color.new(#FFEB3B, 0)
color_Neutral = color.new(#CCCCCC, 0)
// Barcolor
barcolor(title="PFCC Barcolor (when price crosses the Pivot Fractal Chaos
Channel)", color=color_PFCC_BarColor)
// Triangles
plotshape(PFCC_Signal_OrderDirection > 0, title="PFCC CROSS UP",
style=shape.triangleup, location=location.abovebar, color=color_Bullish,
size=size.tiny)
plotshape(PFCC_Signal_OrderDirection < 0, title="PFCC CROSS DOWN",
style=shape.triangledown, location=location.abovebar, color=color_Bearish,
size=size.tiny)
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// ALERTS
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
setting_rule_alert = input("once per bar close", "The triggering frequency for
alerts", options=["once per bar close", "once per bar"], tooltip="To use alerts,
select 'Any alert() function call' in the 'Create Alert' dialog. If you change the
triggering frequency, create the alert from scratch to be on the safe side.",
group="Alerts")
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// EOF
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #