Heiken Ashi Entry/Exit System For ThinkOrSwim

MikeLikesAnacottSteel

New member
VIP
This strategy consists of several indicators formulated into a single system, primarily using a MT4 indicator called Heiken Ashi Entry/Exit that I converted for ToS. It can work on all timeframes, but it is exponentially effective on 1h, 4h, & 1d charts for swing trading. It's recommended that this system is used for trading high-trending instruments - I use it only on QQQ, SPY, /ES, & AAPL. Don't force this system on trading any stock/instrument on any timeframe. All indicators/settings and rules for this system will be explained with setup shown in a sequential order. However, preferences for the specific settings are to each trader's own. All examples will be based on a 100d chart of 1h bars; traders should be aware that indicator settings might vary depending on the timeframe being used.

#Converted MT4 HeikinAshi_EntryExit Indicator
#MikeLikesAnacottSteel
#8-27-2022
#MT4 indicator source: https://forex-station.com/app.php/attach/file/3349947

input MaMethod1 = AverageType.EXPONENTIAL;
input MaPeriod = 40;
input MaMethod2 = AverageType.EXPONENTIAL;
input MaPeriod2 = 1;

def maOpen = MovingAverage(MaMethod1, Open, MaPeriod);
def maClose = MovingAverage(MaMethod1, Close, MaPeriod);
def maLow = MovingAverage(MaMethod1, Low, MaPeriod);
def maHigh = MovingAverage(MaMethod1, High, MaPeriod);

def haClose=(maOpen+maHigh+maLow+maClose)/4;
def haOpen=(GetValue(haOpen, 1)+GetValue(haClose, 1))/2;
def haHigh=Max(maHigh, Max(haOpen, haClose));
def haLow=Min(maLow, Min(haOpen, haClose));

def ExtMapBuffer7;
def ExtMapBuffer8;

if(haOpen<haClose)
{
ExtMapBuffer7=haLow;
ExtMapBuffer8=haHigh;
}
else
{
ExtMapBuffer7=haHigh;
ExtMapBuffer8=haLow;
}

def ExtMapBuffer5=haOpen;
def ExtMapBuffer6=haClose;

Plot ExtMapBuffer1 = MovingAverage(MaMethod2, ExtMapBuffer7, MaPeriod2);
Plot ExtMapBuffer2 = MovingAverage(MaMethod2, ExtMapBuffer8, MaPeriod2);
Plot ExtMapBuffer3 = MovingAverage(MaMethod2, ExtMapBuffer5, MaPeriod2);
Plot ExtMapBuffer4 = MovingAverage(MaMethod2, ExtMapBuffer6, MaPeriod2);

ExtMapBuffer1.SetDefaultColor(Color.RED);
ExtMapBuffer1.SetPaintingStrategy(PaintingStrategy.LINE);
ExtMapBuffer1.SetLineWeight(1);

ExtMapBuffer2.SetDefaultColor(Color.BLUE);
ExtMapBuffer2.SetPaintingStrategy(PaintingStrategy.LINE);
ExtMapBuffer2.SetLineWeight(1);

ExtMapBuffer3.SetDefaultColor(Color.RED);
ExtMapBuffer3.SetPaintingStrategy(PaintingStrategy.LINE);
ExtMapBuffer3.SetLineWeight(1);

ExtMapBuffer4.SetDefaultColor(Color.BLUE);
ExtMapBuffer4.SetPaintingStrategy(PaintingStrategy.LINE);
ExtMapBuffer4.SetLineWeight(1);

AddCloud(ExtMapBuffer1, ExtMapBuffer2, CreateColor(255,0,102), CreateColor(0, 102, 255));
AddCloud(ExtMapBuffer1, ExtMapBuffer4, CreateColor(255,0,102), CreateColor(0, 102, 255));
AddCloud(ExtMapBuffer2, ExtMapBuffer1, CreateColor(0, 1-2, 255), CreateColor(255,0,102));
AddCloud(ExtMapBuffer2, ExtMapBuffer3, CreateColor(0, 102, 255), CreateColor(255,0,102));
AddCloud(ExtMapBuffer3, ExtMapBuffer4, CreateColor(255,0,102), CreateColor(0, 102, 255));
Plot #1 slow: Exponential w/ period1 of 250, Exponential w/ period2 of 200
Plot #2 medium: Exponential w/ period1 of 200, Exponential w/ period2 of 50
Plot #3 fast: Exponential w/ period1 of 50, Exponential w/ period2 of 20

*Indicator provides excellent support/resistance for swing trading, as well as showing the short, middle, & long term trends

sGPt3fC.png
[/IMG]

Credit to Sam4COK:
#study("NSDT HAMA Candles", overlay=true)
#//The follow gradient code is taken from the Pinecoders Gradient Framework example.
#//https://www.tradingview.com/script/hqH4YIFa-Color-Gradient-Framework-PineCoders/
#https://www.tradingview.com/script/k7nrF2oI-NSDT-HAMA-Candles/
# included SSL Channel https://www.tradingview.com/script/6y9SkpnV-SSL-Channel/
# Youtube strategy
#Converted by Sam4Cok @ 07/2022
#Ver 1.1 by Sam4Cok @ 07/2022 -- Added Filters (ADX / TDFI / Range Indicator and options to Show/Hide indicators
#Ver 1.2 by Sam4COK @ 07/2022 -- Added Background Color, RSI Filter, signal enhancment.

#//INPUTS
input ColorBar = no;
input showArrow = yes;
input BackgroundColor = no;
### NSDT ###
input TrendSource = close;
input HAMALength = 69;
input HAMAType = {default EMA, WMA, SMA, HMA};
input HAMABar = yes;
input HAMAMa = yes;
#//MA INFO
input OpenLength = 25; #"Length Open"
input OpenType = {default EMA, SMA, WMA, HMA}; #"Type Open"
input HighLength = 20; #"Length High"
input HighType = {default EMA, SMA, WMA, HMA}; #"Type High"
input LowLength = 20; #"Low"
input LowType = {default EMA, SMA, WMA, HMA}; #"Type Low"
input CloseLength = 20; #"Length Close"
input CloseType = {default EMA, SMA, WMA, HMA}; #"Close"
### SSL1Source ###
input ShowSSL = yes; #(true, "Highlight State ?")
input SSLWicks = no;#(false, "Take Wicks into Account ?")
input SSLType = {WMA, default SMA, EMA, HMA};
input SSL_MaLength = 69; #"MA "Channel ?
### RSI ###
input RSIFilter = no;
input RSILength = 30;
input RSIMovAvg = 200;
### TDFI ###
input TDFIFilter = no;
input TDFIPeriod = 11; # "Lookback"
input TDFIAbove = 0.03; # "Filter High"
input TDFIBelow = -0.03; # "Filter Low"
### ADX ###
input ADXFilter = no;
input ADXLength = 11;
input ADXLimit = 20;
### Range Indicator
input RangeIndicatorFilter = no;
input RILength = 11;
input RangeLimit = 20;
input RangeSmoothing = 5;
##################
def na = Double.NaN;
########## Colors ########
DefineGlobalColor("Bull" , CreateColor(38, 166, 154)); # HAMA GREEN - Teal
DefineGlobalColor("Bear" , CreateColor(239, 83, 80)); # HAMA Red
DefineGlobalColor("WeakBull" , CreateColor(204, 204, 0)); # HAMA DARK Yellow
DefineGlobalColor("WeakBear" , CreateColor(255, 128, 0)); # HAMA Orange
DefineGlobalColor("Neutral" , CreateColor(255, 255, 0)); # HAMA Yellow

DefineGlobalColor("BullBar" , CreateColor(0, 255, 0)); # GREEN
DefineGlobalColor("WeakBullBar" , CreateColor(0, 128, 0)); # Dark GREEN
DefineGlobalColor("BearBar" , CreateColor(255, 0, 0)); # Red
DefineGlobalColor("WeakBearBar" , CreateColor(128, 0, 0)); # DARK RED
DefineGlobalColor("NeutralBar" , CreateColor(255, 255, 0)); # yellow

DefineGlobalColor("BGBull" , CreateColor (153, 255, 153));
DefineGlobalColor("BGBear" , CreateColor (255, 153, 153));
#////////////////////////////////////////////////////////////////////////////////
#mat(source, length, type) =>
script mat {
input source = close;
input length = 69;
input type = "EMA";
def mat;
mat =
if type == "SMA" then SimpleMovingAvg(source, length) else
if type == "EMA" then ExpAverage(source, length) else
if type == "WMA" then WMA(source, length) else
if type == "HMA" then WMA(2 * WMA(source, length / 2) - WMA(source, length), Round(Sqrt(length)))
else Double.NaN;
plot result = mat;
}

def ma = WMA(TrendSource, HAMALength);

#//GRADIENT AREA
def center = ExpAverage(ma, 3);
def xUp = ma crosses above center;
def xDn = ma crosses below center;
def chg = ma - ma[1];
def up = chg > 0;
def dn = chg < 0;
def srcBull = ma > center;
def srcBear = ma < center;

#### TREND####
def StrongUP = srcBull and up;
def WeakUp = srcBull and dn;
def StrongDN = srcBear and dn;
def WeakDN = srcBear and up;
def Neutral = xUp or xDn or !StrongUP and !StrongDN and !WeakUp and !WeakDN;

def SourceClose = (open + high + low + close) / 4;
def LengthClose = CloseLength;

def SourceOpen = CompoundValue(1, (SourceOpen[1] + SourceClose[1]) / 2, SourceClose) ;
def LengthOpen = OpenLength;

def SourceHigh = Max(Max(high, SourceOpen), SourceClose);
def LengthHigh = HighLength;

def SourceLow = Min(Min(low, SourceOpen), SourceClose);
def LengthLow = LowLength;

#funcCalcMA1(type1, src1, len1) =>
script funcCalcMA1 {
input type1 = "EMA";
input src1 = close;
input len1 = 0;
def funcCalcMA1;
funcCalcMA1 = if type1 == "SMA" then SimpleMovingAvg(src1, len1) else
if type1 == "EMA" then ExpAverage(src1, len1) else WMA(src1, len1);
plot result = funcCalcMA1;
}
#funcCalcOpen(TypeOpen, SourceOpen, LengthOpen) =>
script funcCalcOpen {
input TypeOpen = "EMA";
input SourceOpen = close;
input LengthOpen = 0;
def funcCalcOpen;
funcCalcOpen = if TypeOpen == "SMA" then SimpleMovingAvg(SourceOpen, LengthOpen) else
if TypeOpen == "EMA" then ExpAverage(SourceOpen, LengthOpen) else WMA(SourceOpen, LengthOpen);
plot result = funcCalcOpen;
}
#funcCalcHigh(TypeHigh, SourceHigh, LengthHigh) =>
script funcCalcHigh {
input TypeHigh = "EMA";
input SourceHigh = close;
input LengthHigh = 0;
def funcCalcHigh;
funcCalcHigh = if TypeHigh == "SMA" then SimpleMovingAvg(SourceHigh, LengthHigh) else
if TypeHigh == "EMA" then ExpAverage(SourceHigh, LengthHigh) else WMA(SourceHigh, LengthHigh);
plot result = funcCalcHigh;
}
#funcCalcLow(TypeLow, SourceLow, LengthLow) =>
script funcCalcLow {
input TypeLow = "EMA";
input SourceLow = close;
input LengthLow = 0;
def funcCalcLow;
funcCalcLow = if TypeLow == "SMA" then SimpleMovingAvg(SourceLow, LengthLow) else
if TypeLow == "EMA" then ExpAverage(SourceLow, LengthLow) else WMA(SourceLow, LengthLow);
plot result = funcCalcLow;
}
#funcCalcClose(TypeClose, SourceClose, LengthClose) =>
script funcCalcClose {
input TypeClose = "EMA";
input SourceClose = close;
input LengthClose = 0;
def funcCalcClose;
funcCalcClose = if TypeClose == "SMA" then SimpleMovingAvg(SourceClose, LengthClose) else
if TypeClose == "EMA" then ExpAverage(SourceClose, LengthClose) else WMA(SourceClose, LengthClose);
plot result = funcCalcClose;
}

# Plot the new Chart
def CandleOpen = funcCalcOpen(OpenType, SourceOpen, LengthOpen);
def CandleHigh = funcCalcHigh(HighType, SourceHigh, LengthHigh);
def CandleLow = funcCalcLow(LowType, SourceLow, LengthLow);
def CandleClose = funcCalcClose(CloseType, SourceClose, LengthClose);

def MAValue = funcCalcMA1(HAMAType, TrendSource, HAMALength);

plot MALine = if HAMAMa then MAValue else na;
MALine.SetStyle(Curve.FIRM);
MALine.AssignValueColor( if StrongUP then GlobalColor("Bull") else
if WeakUp then GlobalColor("WeakBull") else
if StrongDN then GlobalColor("Bear") else
if WeakDN then GlobalColor("WeakBear") else GlobalColor("Neutral"));
MALine.SetLineWeight(1);

# Plot STRONG UP
def UpO1;
def UpH1;
def UpL1;
def UpC1;
if StrongUP and HAMABar
then {
UpO1 = if CandleOpen < CandleClose then CandleClose else CandleOpen;
UpH1 = if CandleHigh > CandleClose then CandleClose else CandleHigh;
UpL1 = if CandleLow < CandleOpen then CandleOpen else CandleLow;
UpC1 = if CandleOpen < CandleClose then CandleOpen else CandleClose;
} else
{
UpO1 = na;
UpH1 = na;
UpL1 = na;
UpC1 = na;
}
# Plot WEAK UP
def UpO;
def UpH;
def UpL;
def UpC;
if WeakUp and HAMABar
then {
UpO = if CandleOpen < CandleClose then CandleClose else CandleOpen;
UpH = if CandleHigh > CandleClose then CandleClose else CandleHigh;
UpL = if CandleLow < CandleOpen then CandleOpen else CandleLow;
UpC = if CandleOpen < CandleClose then CandleOpen else CandleClose;
} else
{
UpO = na;
UpH = na;
UpL = na;
UpC = na;
}
# Plot WEAK DOWN
def DnO;
def DnH;
def DnL;
def DnC;
if WeakDN and HAMABar
then {
DnO = if CandleOpen < CandleClose then CandleClose else CandleOpen;
DnH = if CandleHigh > CandleOpen then CandleOpen else CandleHigh;
DnL = if CandleLow < CandleClose then CandleClose else CandleLow;
DnC = if CandleOpen < CandleClose then CandleOpen else CandleClose;
} else
{
DnO = na;
DnH = na;
DnL = na;
DnC = na;
}
# Plot STRONG DOWN
def DnO1;
def DnH1;
def DnL1;
def DnC1;
if StrongDN and HAMABar
then {
DnO1 = if CandleOpen < CandleClose then CandleClose else CandleOpen;
DnH1 = if CandleHigh > CandleOpen then CandleOpen else CandleHigh;
DnL1 = if CandleLow < CandleClose then CandleClose else CandleLow;
DnC1 = if CandleOpen < CandleClose then CandleOpen else CandleClose;
} else
{
DnO1 = na;
DnH1 = na;
DnL1 = na;
DnC1 = na;
}
# Plot Neutral
def NuO;
def NuH;
def NuL;
def NuC;
if Neutral and HAMABar
then {
NuO = if CandleOpen < CandleClose then CandleClose else CandleOpen;
NuH = if CandleHigh > CandleOpen then CandleOpen else CandleHigh;
NuL = if CandleLow < CandleClose then CandleClose else CandleLow;
NuC = if CandleOpen < CandleClose then CandleOpen else CandleClose;
} else
{
NuO = na;
NuH = na;
NuL = na;
NuC = na;
}
# Plot the new Chart
AddChart(high = UpH1, low = UpL1, open = UpO1, close = UpC1,
type = ChartType.CANDLE, growcolor = GlobalColor("Bull"));
AddChart(high = UpH , low = UpL , open = UpO, close = UpC,
type = ChartType.CANDLE, growcolor = GlobalColor("WeakBull"));

AddChart(high = DnH1, low = DnL1, open = DnO1, close = DnC1,
type = ChartType.CANDLE, growcolor = GlobalColor("Bear"));
AddChart(high = DnH , low = DnL , open = DnO, close = DnC,
type = ChartType.CANDLE, growcolor = GlobalColor("WeakBear"));

AddChart(high = NuH , low = NuL , open = NuO, close = NuC,
type = ChartType.CANDLE, growcolor = GlobalColor("Neutral"));
########
#indicator("SSL Channel", by MissTricky)
#https://www.tradingview.com/script/6y9SkpnV-SSL-Channel/
def ma1 = mat(high,SSL_MaLength, SSLType);
def ma2 = mat(low ,SSL_MaLength, SSLType);

def Hlv1 = if (if SSLWicks then high else close) > ma1 then 1 else
if (if SSLWicks then low else close) < ma2 then -1 else Hlv1[1];
def Hlv = Hlv1;

def sslUp = if Hlv < 0 then ma2 else ma1;
def sslDown = if Hlv < 0 then ma1 else ma2;

def SSLBull = Hlv1 > 0 and Hlv1[1] < 0;
def SSLBear = Hlv1 < 0 and Hlv1[1] > 0;

plot highLine = if ShowSSL then sslUp else na;
plot lowLine = if ShowSSL then sslDown else na;

highLine.AssignValueColor(if Hlv > 0 then Color.GREEN else color.RED);
lowLine.AssignValueColor( if Hlv > 0 then Color.GREEN else color.RED);

highLine.AssignValueColor(if Hlv > 0 then Color.GREEN else Color.RED);
lowLine.AssignValueColor( if Hlv > 0 then Color.GREEN else Color.RED);

AddCloud (highLine, lowLine, Color.DARK_GREEN, Color.DARK_RED, no);

##### RSI
def RSIup = WildersAverage(Max(close - close[1], 0), rsiLength);
def RSIdown = WildersAverage(-Min(close - close[1], 0), rsiLength);
def RSIvalue = if RSIdown == 0 then 100 else if RSIup == 0 then 0 else 100 - (100 / (1 + RSIup / RSIdown));
def RSIAvg = SimpleMovingAvg(RSIvalue, RSIMovAvg);
def RSI = if RSIvalue > RSIAvg then 1 else
if RSIvalue < RSIAvg then -1 else na;

##### TDFI
def mma = ExpAverage(close * 1000, TDFIPeriod);
def smma = ExpAverage(mma, TDFIPeriod);
def impetmma = mma - mma[1];
def impetsmma = smma - smma[1];
def divma = AbsValue(mma - smma);
def averimpet = (impetmma + impetsmma) / 2;
def tdf = Power(divma, 1) * Power(averimpet, 3);
def TDFIvalue = tdf / Highest(AbsValue(tdf), TDFIPeriod * 3);
def TDFI = if TDFIvalue > TDFIAbove then 1 else
if TDFIvalue < TDFIBelow then -1 else na;

###### ADX Filter
def ADXvalue = DMI(ADXLength, AverageType.WILDERS).ADX;
def ADX = if ADXvalue >= ADXlimit then 1 else na;

###### Range Indicator
def data = TrueRange(high, close, low) / if close > close[1] then (close - close[1]) else 1;
def hData = Highest(data, RILength);
def lData = Lowest(data, RILength);
def range = 100 * (data - lData) / if hData > lData then (hData - lData) else 1;
def RIvalue = ExpAverage(range, RangeSmoothing);
def RI = if RIvalue >= Rangelimit then 1 else na;

### Signal###
def UpOpen = if CandleOpen < CandleClose then CandleClose else CandleOpen;
def UpHigh = if CandleHigh > CandleClose then CandleClose else CandleHigh;
def UpLow = if CandleLow < CandleOpen then CandleOpen else CandleLow;
def UpClose= if CandleOpen < CandleClose then CandleOpen else CandleClose;

def DnOpen = if CandleOpen < CandleClose then CandleClose else CandleOpen;
def DnHigh = if CandleHigh > CandleOpen then CandleOpen else CandleHigh;
def DnLow = if CandleLow < CandleClose then CandleClose else CandleLow;
def DnClose= if CandleOpen < CandleClose then CandleOpen else CandleClose;

def HAMAHigh = close > CandleLow;
def HAMALow = low < DnLow;

def SigUp = if TDFIFilter then (SSLBull and close > MAValue and HAMAHigh and TDFI > 0)
else (SSLBull and close > MAValue and HAMAHigh);
def SigUp1 = if ADXFilter then SigUp and ADX else SigUp;
def SigUp2 = if RangeIndicatorFilter then SigUp1 and RI else SigUp1;
def SignalUp = if RSIFilter then SigUp2 and RSI > 0 else SigUp2;

def SigDN = if TDFIFilter then (SSLBear and close < MAValue and HAMALow and TDFI < 0)
else (SSLBear and close < MAValue and HAMALow);
def SigDn1 = if ADXFilter then SigDn and ADX else SigDn;
def SigDn2 = if RangeIndicatorFilter then SigDn1 and RI else SigDn1;
def SignalDn = if RSIFilter then SigDn2 and RSI < 0 else SigDn2;

plot Arrow_Up = if showArrow and SignalUp then low else na;
plot Arrow_Dn = if showArrow and SignalDn then high else na;

Arrow_Up.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Arrow_Up.SetDefaultColor(Color.WHITE);
Arrow_Up.SetLineWeight(3);

Arrow_Dn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Arrow_Dn.SetDefaultColor(Color.YELLOW);
Arrow_Dn.SetLineWeight(3);

##### Background & Price Color
AssignPriceColor(if ColorBar then
if Neutral then GlobalColor("NeutralBar") else
if StrongUP and close < UpHigh then GlobalColor("WeakBullBar") else
if StrongUP and close > UpHigh then GlobalColor("BullBar") else
if StrongDN and close < DnLow then GlobalColor("BearBar") else
if StrongDN and close > DnLow then GlobalColor("WeakBearBar") else
Color.DARK_ORANGE else Color.CURRENT);

AssignBackgroundColor(if BackgroundColor then
if StrongUP and close > UpHigh then GlobalColor("BGBull") else
if StrongDN and close < DnLow then GlobalColor("BGBear") else
Color.CURRENT else Color.CURRENT);

### ENd ####

2) Settings for NSDT HAMA Candles:
Trend source - close
HAMA length - 10
HAMA type - HMA
HAMA bar - yes
HAMA ma - yes
Open, High, Low, Close length - 10
Open, High, Low, Close types - HMA
All filters & other plots- off
All globals/colors - only red/blue - no various colors for neutral & different bear/bull bars etc to eliminate extra noise for swing trading. If it's a bear bar it's red & if it's a bull bar it's blue. Neutral bars are blue.

*Indicator works in unison with the ribbons & eliminates more noise

RTAmeS5.png
[/IMG]

Credit to Linus:
## START STUDY
## SuperTrend
## linus, 2014-07-21, v0.5

#hint: thinkScript adaptation of SuperTrend. /n The speed of the trend changes are controlled by adjusting the ATR input parameters.

#hint atrMult: Multiple to scale the Average True Range (ATR) value. (Smaller numbers will produce faster trend changes.)
input atrMult = 2.5;

#hint atrLength: ATR moving average period length.
input atrLength = 14;

#hint atrType: ATR moving average type.
input atrType = AverageType.WILDERS;

#hint pivot: Bar pivot used for trend points. (Default is hl2)
input pivot = hl2;

#hint label: Show Profit/Loss label.
input label = Yes;

#hint prompt: Text to show in front of label.
input prompt = "";

#hint bubbles: Show Profit/Loss bubbles.
input bubbles = Yes;

def atr = MovingAverage(atrType, TrueRange(high, close, low), atrLength) * atrMult;

def prUp = pivot + atr;
def prDn = pivot - atr;

# rTrend stores the current trend value and direction. (The direction is currently up if rTrend[1] is positive and down if rTrend[1] is negative, therefore AbsValue is used to compare rTrend values when the trend is down.)

def rTrend = compoundValue(1,
# Trending Up
if rTrend[1] > 0 then
# If close is below trend then switch to downtrend (negative)
if close < Max(prDn[1], rTrend[1]) then -prUp
# ...else adjust new uptrend value.
else Max(prDn, rTrend[1])
# Trending Down
else if rTrend[1] < 0 then
# If close is above trend then switch to uptrend (positive)
if close > Min(prUp[1], AbsValue(rTrend[1])) then prDn
# ...else adjust new downtrend value.
else -Min(prUp, AbsValue(rTrend[1]))
else rTrend[1]
, pivot);

# The Trend plot skips a bar whenever the trend direction changes.
plot Trend = if Sign(rTrend) == Sign(rTrend[1]) then absValue(rTrend) else Double.NaN;
Trend.DefineColor("Up", Color.CYAN);
Trend.DefineColor("Dn", Color.MAGENTA);
Trend.AssignValueColor(if rTrend > 0 then Trend.Color("Up") else Trend.Color("Dn"));
Trend.HideBubble();

# Show arrows when the trend changes:

plot Up = if rTrend crosses above 0 then rTrend else Double.NaN;
Up.SetDefaultColor(Trend.Color("Up"));
Up.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Up.SetLineWeight(2);
Up.HideBubble();

plot Dn = if rTrend crosses below 0 then AbsValue(rTrend) else Double.NaN;
Dn.SetDefaultColor(Trend.Color("Dn"));
Dn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Dn.SetLineWeight(2);
Dn.HideBubble();

def orderDir = compoundValue(1, if !isNaN(Up) then 1 else if !isNaN(Dn) then -1 else orderDir[1], 0);

def isOrder = orderDir crosses 0;

def orderCount = compoundValue(1, if isNaN(isOrder) then 0 else if isOrder then orderCount[1] + 1 else orderCount[1], 0);

def orderPrice = if isOrder then if isNaN(open[-1]) then close else open[-1] else orderPrice[1];
def profitLoss = if !isOrder or orderCount == 1 then 0 else if orderDir > 0 then orderPrice[1] - orderPrice else if orderDir < 0 then orderPrice - orderPrice[1] else 0;
def profitLossSum = compoundValue(1, if isNaN(isOrder) then 0 else if isOrder then profitLossSum[1] + profitLoss else profitLossSum[1], 0);

AddLabel(label, prompt + orderCount + " orders | P/L " + AsDollars((profitLossSum / tickSize()) * tickValue()), if profitLossSum > 0 then Color.GREEN else if profitLossSum < 0 then Color.RED else Color.GRAY);

AddChartBubble(bubbles and isOrder and orderDir > 0, low, profitLoss, Color.GREEN, 0);
AddChartBubble(bubbles and isOrder and orderDir < 0, high, profitLoss, Color.RED, 1);

## END STUDY

3) Settings for SuperTrend:
ATR mult - 2.5
ATR length - 14
ATR type - Hull
Pivot - close

*Indicator's importance speaks for itself

MsmFm4b.png
[/IMG]

Credit to BenTen:
# MTF Moving Average

input Period = aggregationPeriod.HOUR;
input AvgType = averageType.SIMPLE;
input Length = 50;
input priceclose = close;

plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.setdefaultcolor(color.yellow);

4) Settings for MTF Moving Average:
Period - day
Type - exponential
Length - 10
Priceclose - close

*Indicator might not be necessary, but the stepped display helps provide solid visual from a different perspective in terms of trend w/ the fast ribbon

QMTF3Ir.png
[/IMG]

Credit to Mobius:
# Limbo_Bars
# Mobius
# V05.02.2016
# Added Labels for Epocs and near term fibonacci retracements
#hint:<b> Limbo Bars</b>\n Limbo series: Closing for each year in chart aggregation (gray short dashed lines)\n Clustered Multiple year closings (Solid gray thick lines)\n Highest to lowest Fib Sequence for chart agg (thin light green lines)\n Highest to lowest Fib Sequence for adjustable Stochastic Pivots (long gray dashes)\n Sub-Fib Sequences for Current years 68.2 to 100 and 0 (small dashes)
declare Once_per_bar;
input numBars = 21; #hint numbars: bars for near term fib levels
input ClusterValue_1 = 1480.00; #hint ClusterValue_1: Multiple year closing proximity line
input ClusterValue_2 = 1425.00; #hint ClusterValue_2: Multiple year closing proximity line
input ClusterValue_3 = 1250.00; #hint ClusterValue_3: Multiple year closing proximity line
input ClusterValue_4 = 890.00; #hint ClusterValue_4: Multiple year closing proximity line
input showValues = no;
input showBarNumbers = no;
input TrendResistanceStart = 0;
input TrendResistanceEnd = 0;
input TrendSupportStart = 0;
input TrendSupportEnd = 0;
input BubbleOn = yes;
# Study Definitions
def o = open;
def h = high;
def l = low;
def c = close;
def bar = BarNumber();
def yearstart = GetYear() * 10000 + 101;
def tradingDays = CountTradingDays(yearstart, GetYYYYMMDD());
def Coeff_1 = .236;
def Coeff_2 = .382;
def Coeff_3 = .500;
def Coeff_4 = .618;
def Coeff_5 = .786;
#Epoc definitions: Years closing values for the last 20 years
script Epoc {
input year = 1;
def bar = barNumber();
def yearone = CompoundValue(1, if GetYear() == GetLastYear() - year
then bar[1] + 2
else yearone[1], 1);
def y1 = CompoundValue(1, if bar == yearone
then (close[1])
else y1[1], Double.NaN);
plot y1Line = if IsNaN(y1) then Double.NaN else y1;
}
# Start Epocs Plot Sequence
plot y1L = Epoc(year = 1);
y1L.SetStyle(Curve.SHORT_DASH);
y1L.SetDefaultColor(CreateColor(50, 75, 10));
y1L.SetLineWeight(2);
AddChartBubble(if BubbleOn then y1L and isNaN(y1L[1]) else double.nan, y1L, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y2Line = Epoc(year = 2);
y2Line.SetStyle(Curve.SHORT_DASH);
y2Line.SetDefaultColor(CreateColor(50, 75, 10));
y2Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y2Line and isNaN(y2Line[1]) else double.nan, y2Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y3Line = Epoc(year = 3);
y3Line.SetStyle(Curve.SHORT_DASH);
y3Line.SetDefaultColor(CreateColor(50, 75, 10));
y3Line.SetLineWeight(1);
AddChartBubble(if BubbleOn then y3Line and isNaN(y3Line[1]) else double.nan, y3Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y4Line = Epoc(year = 4);
y4Line.SetStyle(Curve.SHORT_DASH);
y4Line.SetDefaultColor(CreateColor(50, 75, 10));
y4Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y4Line and isNaN(y4Line[1]) else double.nan, y4Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y5Line = Epoc(year = 5);
y5Line.SetStyle(Curve.SHORT_DASH);
y5Line.SetDefaultColor(CreateColor(50, 75, 10));
y5Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y5Line and isNaN(y5Line[1]) else double.nan, y5Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y6Line = Epoc(year = 6);
y6Line.SetStyle(Curve.SHORT_DASH);
y6Line.SetDefaultColor(CreateColor(50, 75, 10));
y6Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y6Line and isNaN(y6Line[1]) else double.nan, y6Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y7Line = Epoc(year = 7);
y7Line.SetStyle(Curve.SHORT_DASH);
y7Line.SetDefaultColor(CreateColor(50, 75, 10));
y7Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y7Line and isNaN(y7Line[1]) else double.nan, y7Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y8Line = Epoc(year = 8);
y8Line.SetStyle(Curve.SHORT_DASH);
y8Line.SetDefaultColor(CreateColor(50, 75, 10));
y8Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y8Line and isNaN(y8Line[1]) else double.nan, y8Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y9Line = Epoc(year = 9);
y9Line.SetStyle(Curve.SHORT_DASH);
y9Line.SetDefaultColor(CreateColor(50, 75, 10));
y9Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y9Line and isNaN(y9Line[1]) else double.nan, y9Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y10Line = Epoc(year = 10);
y10Line.SetStyle(Curve.SHORT_DASH);
y10Line.SetDefaultColor(CreateColor(50, 75, 10));
y10Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y10Line and isNaN(y10Line[1]) else double.nan, y10Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y11Line = Epoc(year = 11);
y11Line.SetStyle(Curve.SHORT_DASH);
y11Line.SetDefaultColor(CreateColor(50, 75, 10));
y11Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y11Line and isNaN(y11Line[1]) else double.nan, y11Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y12Line = Epoc(year = 12);
y12Line.SetStyle(Curve.SHORT_DASH);
y12Line.SetDefaultColor(CreateColor(50, 75, 10));
y12Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y12Line and isNaN(y12Line[1]) else double.nan, y12Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y13Line = Epoc(year = 13);
y13Line.SetStyle(Curve.SHORT_DASH);
y13Line.SetDefaultColor(CreateColor(50, 75, 10));
y13Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y13Line and isNaN(y13Line[1]) else double.nan, y13Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y14Line = Epoc(year = 14);
y14Line.SetStyle(Curve.SHORT_DASH);
y14Line.SetDefaultColor(CreateColor(50, 75, 10));
y14Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y14Line and isNaN(y14Line[1]) else double.nan, y14Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y15Line = Epoc(year = 15);
y15Line.SetStyle(Curve.SHORT_DASH);
y15Line.SetDefaultColor(CreateColor(50, 75, 10));
y15Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y15Line and isNaN(y15Line[1]) else double.nan, y15Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y16Line = Epoc(year = 16);
y16Line.SetStyle(Curve.SHORT_DASH);
y16Line.SetDefaultColor(CreateColor(50, 75, 10));
y16Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y16Line and isNaN(y16Line[1]) else double.nan, y16Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y17Line = Epoc(year = 17);
y17Line.SetStyle(Curve.SHORT_DASH);
y17Line.SetDefaultColor(CreateColor(50, 75, 10));
y17Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y17Line and isNaN(y17Line[1]) else double.nan, y17Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y18Line = Epoc(year = 18);
y18Line.SetStyle(Curve.SHORT_DASH);
y18Line.SetDefaultColor(CreateColor(50, 75, 10));
y18Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y18Line and isNaN(y18Line[1]) else double.nan, y18Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y19Line = Epoc(year = 19);
y19Line.SetStyle(Curve.SHORT_DASH);
y19Line.SetDefaultColor(CreateColor(50, 75, 10));
y19Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y19Line and isNaN(y19Line[1]) else double.nan, y19Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
plot y20Line = Epoc(year = 20);
y20Line.SetStyle(Curve.SHORT_DASH);
y20Line.SetDefaultColor(CreateColor(50, 75, 10));
y20Line.SetLineWeight(2);
AddChartBubble(if BubbleOn then y20Line and isNaN(y20Line[1]) else double.nan, y20Line, AsPrice(getYear()) + " Open", CreateColor(50, 75, 10));
# End Year Lines
# Plot Year Closing Cluster Values
Plot Cluster1 = ClusterValue_1;
Cluster1.SetStyle(Curve.Firm);
Cluster1.SetLineWeight(3);
Cluster1.SetDefaultColor(CreateColor(50,50,50));
Plot Cluster2 = ClusterValue_2;
Cluster2.SetStyle(Curve.Firm);
Cluster2.SetLineWeight(3);
Cluster2.SetDefaultColor(CreateColor(50,50,50));
Plot Cluster3 = ClusterValue_3;
Cluster3.SetStyle(Curve.Firm);
Cluster3.SetLineWeight(3);
Cluster3.SetDefaultColor(CreateColor(50,50,50));
Plot Cluster4 = ClusterValue_4;
Cluster4.SetStyle(Curve.Firm);
Cluster4.SetLineWeight(3);
Cluster4.SetDefaultColor(CreateColor(50,50,50));
# First Wave Fibonacci Retracement
script Fibs {
input C0 = 0.000;
def o = open;
def h = high;
def l = low;
# Get highest and lowest on chart
def a = HighestAll(h);
def b = LowestAll(l);
# Get the bar numbers at the highest and lowest points
def barnumber = BarNumber();
def c = if h == a
then barnumber
else Double.NaN;
def d = if l == b
then barnumber
else Double.NaN;
def highnumber = CompoundValue(1, if IsNaN(c)
then highnumber[1]
else c, c);
def highnumberall = HighestAll(highnumber);
def lownumber = CompoundValue(1, if IsNaN(d)
then lownumber[1]
else d, d);
def lownumberall = LowestAll(lownumber);
# Determine Slope Delta
def upward = highnumberall > lownumberall;
def downward = highnumberall < lownumberall;
# Define X
def x = AbsValue(lownumberall - highnumberall );
# Get Slope for either direction
def slope = (a - b) / x;
def slopelow = (b - a) / x;
# Get Day
def day = GetDay();
def month = GetMonth();
def year = GetYear();
def lastDay = GetLastDay();
def lastmonth = GetLastMonth();
def lastyear = GetLastYear();
def isToday = If(day == lastDay and
month == lastmonth and
year == lastyear, 1, 0);
def istodaybarnumber = HighestAll(if isToday
then barnumber
else Double.NaN);
# Calculations for line between extremes
def line = b + (slope * (barnumber - lownumber));
def linelow = a + (slopelow * (barnumber - highnumber));
def currentlinelow = if barnumber <= lownumberall
then linelow
else Double.NaN;
def currentline = if barnumber <= highnumberall
then line
else Double.NaN;
def FibFan = if downward
then currentlinelow
else if upward
then currentline
else Double.NaN;
# Rise of line between Extremes
def range = a - b;
plot Fib1 = fold i = 1 to 100
with p = FibFan
while (downward and
barnumber >= highnumberall and
barnumber <= istodaybarnumber)
or
(upward and
barnumber >= lownumberall and
barnumber <= istodaybarnumber)
do if downward
then HighestAll((b + (range * C0)))
else if upward
then HighestAll(a - (range * C0))
else Double.NaN;
}
# Start Plot Sequence
input C0 = 0.000;
input C1 = .236;
input C2 = .382;
input C3 = .500;
input C4 = .618;
input C5 = .786;
input C6 = 1.000;

def TotalBars = HighestAll(bar);
def HHbar = if high == highestAll(high)
then bar
else HHbar[1];
def LLbar = if low == lowestAll(low)
then bar
else LLbar[1];
def firstBar = if HHbar > LLbar
then LLbar
else if HHbar < LLbar
then HHbar
else Double.NaN;
def BubbleLocation = if bar - (firstBar + HHbar) == LLBar
then LLbar
else if bar - (firstBar + LLbar) == HHBar
then HHbar
else double.nan;
plot fib1 = Round(fibs(C0 = C0), 3);
fib1.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib1
, (c0 * 100) + "% $" + fib1, color.gray, yes);
plot fib2 = Round(fibs(C0 = C1), 3);
fib2.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib2
, (c1 * 100) + "% $" + fib2, color.gray, yes);
plot fib3 = Round(fibs(C0 = C2), 3);
fib3.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib3
, concat( (c2 * 100), "%"), color.gray, yes);
plot fib4 = Round(fibs(C0 = C3), 3);
fib4.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib4
, (c3 * 100) + "% $" + fib4, color.gray, yes);
plot fib5 = Round(fibs(C0 = C4), 3);
fib5.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib5
, (c4 * 100) + "% $" + fib5 , color.gray, yes);
plot fib6 = Round(fibs(C0 = C5), 3);
fib6.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib6
, (c5 * 100) + "% $" + fib6, color.gray, yes);
plot fib7 = Round(fibs(C0 = C6), 3);
fib7.SetDefaultColor(Color.Red);
AddChartBubble((if BubbleOn then BubbleLocation else double.nan), fib7
, (c6 * 100) + "% $" + fib7, color.gray, yes);
# Second Wave Fib Series
def UserSetResistance = TrendResistanceStart > 0 and
TrendResistanceEnd > 0;
def UserSetSupport = TrendSupportStart > 0 and
TrendSupportEnd > 0;
def PH;
def PL;
def isHigherThanNextBars = fold i = 1 to numBars + 1
with p = 1
while p
do h > GetValue(h, -i);
PH = if UserSetResistance and
( bar == TrendResistanceStart or
bar == TrendResistanceEnd )
then h
else if !UserSetResistance and
(bar > numBars and
h == Highest(h, numBars) and
isHigherThanNextBars)
then h
else Double.NaN;
def isLowerThanNextBars = fold j = 1 to numBars + 1
with q = 1
while q
do l < GetValue(low, -j);
PL = if UserSetSupport and
( bar == TrendSupportStart or
bar == TrendSupportEnd )
then l
else if !UserSetSupport and
(bar > numBars and
l == Lowest(l, numBars) and
isLowerThanNextBars)
then l
else Double.NaN;
def PHBar = if UserSetResistance
then TrendResistanceEnd
else if !IsNaN(PH)
then bar
else PHBar[1];
def PLBar = if UserSetSupport
then TrendSupportEnd
else if !IsNaN(PL)
then bar
else PLBar[1];
def PHL = if !IsNaN(PH)
then PH
else PHL[1];
def priorPHBar = if UserSetResistance
then TrendResistanceStart
else if PHL != PHL[1]
then PHBar[1]
else priorPHBar[1];
def PLL = if !IsNaN(PL)
then PL
else PLL[1];
def priorPLBar = if UserSetSupport
then TrendSupportStart
else if PLL != PLL[1]
then PLBar[1]
else priorPLBar[1];
def isFinalTwoHighPivots = bar >= HighestAll(priorPHBar);
def isFinalTwoLowPivots = bar >= HighestAll(priorPLBar);
def ResistanceFinishOffset = if isFinalTwoHighPivots
then bar - PHBar
else 0;
def ResistanceStartOffset = if isFinalTwoHighPivots
then bar - priorPHBar
else 0;
def ResistanceSlope = (GetValue(PH, ResistanceFinishOffset) -
GetValue(PH, ResistanceStartOffset)) /
(PHBar - priorPHBar);
def SupportFinishOffset = if isFinalTwoLowPivots
then bar - PLBar
else 0;
def SupportStartOffset = if isFinalTwoLowPivots
then bar - priorPLBar
else 0;
def SupportSlope = (GetValue(PL, SupportFinishOffset) -
GetValue(PL, SupportStartOffset)) /
(PLBar - priorPLBar);
def ResistanceExtend = if bar == HighestAll(PHBar)
then 1
else ResistanceExtend[1];
def SupportExtend = if bar == HighestAll(PLBar)
then 1
else SupportExtend[1];
plot pivotHigh = if isFinalTwoHighPivots
then PH
else Double.NaN;
def pivotHighLine = if PHL > 0 and
isFinalTwoHighPivots
then PHL
else double.NaN;
plot ResistanceLine = pivotHigh;
plot ResistanceExtension = if ResistanceExtend
then (bar - PHBar) * ResistanceSlope + PHL
else Double.NaN;
plot pivotLow = if isFinalTwoLowPivots
then PL
else Double.NaN;
def pivotLowLine = if PLL > 0 and
isFinalTwoLowPivots
then PLL
else double.NaN;
plot SupportLine = pivotLow;
plot SupportExtension = if SupportExtend
then (bar - PLBar) * SupportSlope + PLL
else Double.NaN;
plot BN = bar;
plot A_H = if isNaN(PivotHighline)
then PivotHighLine[1]
else HighestAll(PivotHighLine);
A_H.SetDefaultColor(Color.Yellow);
plot X_L = if isNaN(PivotLowLine)
then PivotLowLine[1]
else LowestAll(PivotLowLine);
X_L.SetDefaultColor(Color.Yellow);
def A = A_H;
def B = X_L;
def X = ( ((c - X_L) / (A_H - X_L))) + c;
plot SeventyEight = (((a - b) * Coeff_5) + B);
plot SixtyOne = (((a - B) * Coeff_4) + B);
plot Fifty = (a + B) * Coeff_3;
plot ThirtyEight = ((a - B) * Coeff_2) + B;
plot TwentyThree = ((a - B) * Coeff_1) + B;
pivotHigh.SetDefaultColor(Color.Yellow);
pivotHigh.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
pivotHigh.SetHiding(!showValues);
pivotLow.SetDefaultColor(Color.Yellow);
pivotLow.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
pivotLow.SetHiding(!showValues);
ResistanceLine.EnableApproximation();
ResistanceLine.SetDefaultColor(GetColor(5));
ResistanceExtension.SetDefaultColor(GetColor(5));
SupportLine.EnableApproximation();
SupportLine.SetDefaultColor(GetColor(5));
SupportExtension.SetDefaultColor(GetColor(5));
BN.SetDefaultColor(GetColor(0));
BN.SetHiding(!showBarNumbers);
BN.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
SeventyEight.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
SeventyEight.SetDefaultColor(Color.Yellow);
SixtyOne.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
SixtyOne.SetDefaultColor(Color.Yellow);
Fifty.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Fifty.SetDefaultColor(Color.Yellow);
ThirtyEight.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ThirtyEight.SetDefaultColor(Color.Yellow);
TwentyThree.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TwentyThree.SetDefaultColor(Color.Yellow);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
A_H,
"Fib " + 1,
color.yellow,
yes);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
SeventyEight,
"Fib " + Coeff_5,
color.yellow,
yes);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
SixtyOne,
"Fib " + Coeff_4,
color.yellow,
yes);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
Fifty,
"Fib " + Coeff_3,
color.yellow,
yes);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
ThirtyEight,
"Fib " + Coeff_2,
color.yellow,
yes);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
TwentyThree,
"Fib " + Coeff_1,
color.yellow,
yes);
AddChartBubble(if BubbleOn then isNaN(close[10]) and !isNaN(close[11]) else double.nan,
X_L,
"Fib " + 0,
color.yellow,
yes);
# Fibonacci Time Series
def bar1 = firstbar;
def bars = CompoundValue(1, if isNaN(bars[1])
then firstbar + 2
else if bar >= firstbar + 2
then bars[1] + 1
else 0,firstbar +2);
def coeff = Sqrt(5);
def n = Floor(log(bars * coeff + 0.5) / log((1 + Sqrt(5)) / 2));
def inSeries = n != n[1] and bars >= firstbar;
def Series = if inSeries
then bars
else Double.NaN;
#AddVerticalLine(Series, "FTS: ( " + Series + ")", Color.Blue, Curve.Short_Dash);
# End Code Limbo Bars V05

5) Settings for Limbo Bars:
Plot #1 - bars for fib 1-7 & AH-XL - 55 (purple & yellow)
Plot #2 - bars for AH-XL - 21 (white & no fib plot)
Plot #1 & Plot #2 - everything else deselected

*Indicator is vital to help strengthen resistance/support signals along with the ribbons, especially the when price/bar hits both at the same time in terms of confluence

pNoliUq.png
[/IMG]

Credit to DaysOff:
# MTF Moving Average Slope Histogram
# DaysOff

declare lower;

input price = close;
input length = 20;
input agg = AggregationPeriod.FIFTEEN_MIN;


def avg = hullMovingAvg(close(period = agg), length);
plot height = avg - avg[length];

height.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
height.DefineColor("height >= 0" , Color.GREEN);
height.DefineColor("height < 0", Color.RED);
height.assignValueColor(if height >= 0 then height.color("height >= 0") else height.color("height < 0"));

6) Settings for MTF Moving Average Slope Histogram:
Plot #1 - price Close, length 5, agg 4h
Plot #2 - price Close, length 5, agg 1d
Plot #3 - price Close, length 5, agg 1w
*Note that I don't include the timeframe that is the same as the chart, in this case a 1h slope indicator. I start the slope indicator with the next sequential timeframe being 4h; it's just a personal preference of mine.

*Indicator is 100% essential for a swing trading system - when you swing trade you are essentially trading the slopes

MurECLO.png
[/IMG]

Rules for Heiken Ashi Entry/Exit system (see pic below for reference when going over each rule):

1) Taking positions/trades during strong bearish trend: when the highest timeframe (week) is bearish (red) for the lower MTF slope study - sell/short the rips when the price/bar meets resistance at the fast moving Heiken Ashi ribbon with SuperTrend down signal - as noted by white circles. You want the middle timeframe (day) to be bearish (red) or relatively flat if weak bullish (blue). The sell/short signal is stronger when the price/bar meets resistance at both the ribbon and fib level at the same time as you can see at circles 3 and 4 - this helps making confident trades since the the middle 1d timeframe is weak bullish/flat/blue at those specific points. If price/bar meets both indicators of resistance, I use it as confirmation to negate the weak bullish signal and enter my short/sell position. You will notice that for circles 1 and 5, the highest timeframe (week) slope changed. For circle 1, the slope went from bullish/blue to neutral/black - but you know this is still mostmlikely confirmation of the transition to a strong bearish trend since the price/bar broke below all 3 ribbons earlier. For circle 5, the bearish slope moved up one level indicating a possible start to a more bullish trend - if you still took this trade it might have ended in a loss or broke even, but this is why you have your stops - let the winners ride and cut the losses short. You would have had 4/5 winners.

2) Taking positions/trades during weak/neutral bearish/bullish trend: when price/bars break through 1st major resistance ribbon/level, I still sell/short the rips if there are still 2 upper resistance levels/ribbons to break through. I scale my profits and sell 1/3rd of my position on first profitable bar (in this case the first profitable down bar since I'm shorting/selling), the next 1/3rd on the next profitable bar, and the last 1/3rd at my stop. In circle 6, you will see that the price action was sandwiched and bouncing between the two ribbons, which resulted in a classic bull trap. This is why I always sell the last 1/3rd of my position at the next stop if price/bars are between to ribbons like this - in hopes of catching major profits if in fact a big sell off does occur from the bull trap. The same goes for the opposite - I'll buy the dip if there are still 2 lower resistance levels/ribbons to break through, but will sell the last 1/3rd of my position at the next stop in hopes of catching profits from a bear trap. In the rectangle below circle 6, one thing to look for is a sudden increase in the 4h & 1d timeframes bullish/blue bars - this sudden and not gradual increase in the 2 lower timeframes is an indication that a bull trap might be in the near future. Same goes for the opposite resulting in a bear trap.

3) Taking positions/trades during the start of an overall trend change: at circle 7 all 3 of the slopes are newly blue - I always take these trades & let them ride to the next stop. 95% of the time this means your next buy or sell trade will be when the overall trend has changed to strong bullish/bearish w/ price/bar being above or below all 3 ribbons. Same goes for the opposite in taking short positions if all 3 slopes are newly red. This is why it's important to use this system for high-trending instruments and not just any stock/instrument as you will get false signals from the 3 slope indicators if there isn't confluence.

4) Taking positions/trades during strong bullish trend: the opposite of the first rule mentioned above. If you do buy the dip from a SuperTrend signal without the price/bar hitting resistance level/ribbon or fib, make sure to use your stops to cut your losses as shown in circles 10 & 11, but let the winners ride as shown in circles 8 & 9.

Bonus note: pay attention to circle 6 & the price action after circle 11 - just as there was a rapid breakthrough of the 1st resistance level/ribbon leading up to circle 6, there was also a rapid breakthrough of the 1st resistance level/ribbon after circle 11. However, notice the price/bars also rapidly broke through the 2nd resistance level/ribbon with the 3rd resistance level/ribbon now being tested. The fib level is practically at the same level as circle 6 - this could be a bear trap soon. This is just another thing to be aware of when recent price action is highly active in contact with resistance levels that are parallel to a past area of high confluence like circle 6.

jC2ig76.png
[/IMG]
 
Thank you so much for sharing.
I am still unclear on your Limbo Bars settings. Do you mind to elaborate what is AH-XL - 55 and AH-XL - 21?

plot #1 - bars for fib 1-7 & AH-XL - 55 (purple & yellow)
Plot #2 - bars for AH-XL - 21 (white & no fib plot)
Plot #1 & Plot #2 - everything else deselected

Much Appreciated
 
Very interesting. Is there any way you could share the grid- setup via a TOS link? I'm having a hard time changing some of the colors that you had suggested to blue and red, in addition to the Limbo Bar settings states above
 
This is quite a visual masterpiece. Thank you. Is there any way to scan for when MTF ribbons all become the same color (directional unity)?
 
So I am having issues displaying the ribbons on the first section. Would you happen to know if anything is missing?
 
This is a really cool setup I appreciate you lot. If only you had a video explaining it in depth.
 
I really do like the HeikinAshi_EntryExit Indicator. Tried adding vertical lines but failed after several attempts. Same with breakout signals. Those did not display either. Was hoping that you or any of the other talented scripters here could correct my verticals and arrows scripts so that each will display on the chart. As always, we learn from our mistakes. I truly appreciate any help with this one. http://tos.mx/klig41Q
 
I really do like the HeikinAshi_EntryExit Indicator. Tried adding vertical lines but failed after several attempts. Same with breakout signals. Those did not display either. Was hoping that you or any of the other talented scripters here could correct my verticals and arrows scripts so that each will display on the chart. As always, we learn from our mistakes. I truly appreciate any help with this one. http://tos.mx/klig41Q
When I click on your link I get this error:
Your connection isn't private
Attackers might be trying to steal your information from tos.mx (for example, passwords, messages, or credit cards).
NET::ERR_CERT_DATE_INVALID

what am I doing wrong? How am I supposed to get your shared chart?

Never mind... I figure out my mistake. Links can't be open directly. I have to use the TOS Open Shared Item.
Thanks for sharing!
 
Last edited:
Where can I find the complete code for this.
I think that is it in >> "Click to expand" isn't it up at the top ? >> I see what you mean ... building it really from each section. I guess when its done its done right. Perhaps someone can share it ?
 
Last edited:
When I click on your link I get this error:
Your connection isn't private
Attackers might be trying to steal your information from tos.mx (for example, passwords, messages, or credit cards).
NET::ERR_CERT_DATE_INVALID

what am I doing wrong? How am I supposed to get your shared chart?

Never mind... I figure out my mistake. Links can't be open directly. I have to use the TOS Open Shared Item.
Thanks for sharing!
I don't see any breakout signals being triggered. Perhaps I have the settings incorrect. Can you see the breakout signals ? I can add verticals if the breakouts are triggering.
 
Very interesting. Is there any way you could share the grid- setup via a TOS link? I'm having a hard time changing some of the colors that you had suggested to blue and red, in addition to the Limbo Bar settings states above
Try this: http://tos.mx/7abmQ3m

I think I captured everything from the first post.

Note: I think I found a typo in the code of the HeikenAshi Entry/Exit Indicator:
AddCloud(ExtMapBuffer2, ExtMapBuffer1, CreateColor(0, 1-2, 255), CreateColor(255,0,102));
should be
AddCloud(ExtMapBuffer2, ExtMapBuffer1, CreateColor(0, 102, 255), CreateColor(255,0,102));
 
Love this indictor; however it is deemed too complicated by tos to use it in an alert or scan. What can be turned off (#) but such that the red-green ribbon and arrows still work, so that we no longer get the "orange triangle" complication warning?

To answer my own question, it looks like the ribbon is green and there is an up arrow when price is > macd zeroline, otherwise it's red with a down arrow. Is this correct?

If you pull this indicator into a watchlist as a column, what does the number represent?
 
Last edited by a moderator:
The setup/explanation is real good but was wondering if anyone has tried this setup? Hows the experience/results been?
 
Try this: http://tos.mx/7abmQ3m

I think I captured everything from the first post.

Note: I think I found a typo in the code of the HeikenAshi Entry/Exit Indicator:
AddCloud(ExtMapBuffer2, ExtMapBuffer1, CreateColor(0, 1-2, 255), CreateColor(255,0,102));
should be
AddCloud(ExtMapBuffer2, ExtMapBuffer1, CreateColor(0, 102, 255), CreateColor(255,0,102));
Thank you Zetta for that correction. Still I got 2 ribbons and not 3. I do not know what is missing?
 
Really liking the Heiken Ashi Ribbons with the settings. Question- I'm getting an error warning in the upper left of the chart:

Color parameter outside of expected range: Green

Anybody know what this means or how to fix?

edit Got answered in the Questions Forum:

AddCloud(ExtMapBuffer2, ExtMapBuffer1, CreateColor(0, 1-2, 255), CreateColor(255,0,102));

In the above line 1-2 needs to be changed to 102. The chart should no longer have loading problems.
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
473 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top