#### markos

##### Well-known member

**VIP**

Mr StanL loved to teach. He also gave us the 200 page Manual that can be found in the Tutorials. Please read all of the notes throughout this script. Stan left us clues. The reason the bubbles are on the chart is to show what each indicators setting is along with what is does.

*On the chart, line 3.5 and 28 need the code adjusted. This code is in a lower, just push it up. Please work with it and learn from it. Have fun exploring!*
Code:

```
# OneGlance by StanL Version 1.0 5/1/14 Recovered from BOC's OneNote
# V1.1 Markos 1-10-2020 Changed then if colorUPTICK else colorDOWNTICK TO color green else color red also shortened some bubbles. Via UI I changed the weight of the lines to better fit them.#
#
# Hint:The 'OneGlance' study evaluates 13 criteria in a bullish(green)/bearish(red) dashboard presentation. All study parameters and the bullish-bearish-triggers may be set via inputs.
# OVERVIEW: 'OneGlance' is by StanL 4/30/14. Emphasis has been put on clarity and flexibility: clarity via bubbles and labels; flexibility via input-setable parameters and triggers to match your trading style. The info bubbles in rdite studies often state the default values buil into TOS' studies.
# USAGE: 'OneGlance' uses up a lot of a chart's real estate and is much more readable when not squeezed; perhaps as an only lower study. One viewing option, when comparing a 'OneGlance' item to a corresponding full TOS chart, is to turn off the price data in 'chart Settings'. Depending on your vision quality and space availability, you may find a magnifier usage useful (google Magnifixer freeware).
# POINT-OF-VIEW: 'OneGlance' is oriented (parameters and triggers) towards defining the bullish aspects of the studies used. Realize that if a study is not bullish, then it is not necessarily bearish. If you are bearish oriented, i.e. looking for short-opportunities, the modifying of parameters and triggers can enhance you bearish orientation.
# FUTURE: Although 'OneGlance' already uses a lot of real estate, there is no limit to additional studies being added except for space. Also, depending on your coding skills, certain user-preferred studies may be extracted to form a more-specific abridged 'OneGlance' utilizing less chart real estate and just the studies that you are most interested in.
#INPUTS: Because of the multitude of studies, the input list in 'Edit Studies' is long but components have been titled to make them self explanatory and with info-bubbles to further identify TOS default values.
#
declare lower; #This is a lower study that you push up. un-select volume button, select left axis. Have No Studies on chart but this one.
input showlabels = yes;#hint showlabels:Toggles labels on/off.
def c = close;
def h = high;
def l = low;
def o = open;
#Polarized Fractal Efficiency
#===========================
input PFE_length = 20;#hint PFE_length:The length used in calculating the Polarized Fractal Efficiency. TOS default is 10.
input PFE_smoothingLength = 5;#hint PFE_smoothingLength:TOS default is 5.
input PFE_trig = 50;#hint PFE_trig:The value that triggers the PFE from Bullish to bearish.
def diffpfe = c - c[PFE_length - 1];
def val = 100 * Sqrt(Sqr(diffpfe) + Sqr(PFE_length)) / Sum(Sqrt(1 + Sqr(c - c[1])), PFE_length - 1);
def PFE = ExpAverage(if diffpfe > 0 then val else -val, PFE_smoothingLength);
plot PFE_Line = 17.5;
PFE_Line.SetPaintingStrategy(PaintingStrategy.SQUARES);#was line vs squares
PFE_Line.SetLineWeight(5);
PFE_Line.AssignValueColor(if PFE > PFE_trig then Color.Green else Color.Red);
#== end ==
#MomentumPercent
#=================
input MOM_Pct_trig = 0.00;#Hint MOM_Pct_trig:The percent value that toggles the chart between green and red. Normal is 0.00 %.
input MomPctLength = 5;#Hint MomPctLength:The offset length (bars back) that the current bar is compared to calculate this Momentum Percent. TOS default is 10.
def mom_pct = MomentumPercent(length = MomPctLength)."Momentum, %" - 100;
plot MomPct_Line = 21;
MomPct_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
MomPct_Line.SetLineWeight(5);
MomPct_Line.AssignValueColor(if mom_pct >= MOM_Pct_trig then Color.Green else Color.Red);
#=== end ====
#Ichimoku Study
#==============
#NOTES: One major bullish indication in this study is when the Tenkan excaads the Kijun. Their default lengths of 26 and 9 may be shortened to increase response sensitivity. There are other bullish Ichimoku indicators.
input tenkan_period = 9;#hint tenkan_period:The agg-bars used to calculate the tenkan value. TOS' default is 9.
input kijun_period = 26;#hint kijun_period:The agg-bars used to calculate the kijun value. TOs' default is 26.
plot Ichi_Line = 24.5;
Ichi_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
Ichi_Line.SetLineWeight(5);
Ichi_Line.AssignValueColor(if Ichimoku(tenkan_period, kijun_period)."Tenkan" > Ichimoku(tenkan_period, kijun_period)."Kijun" then Color.Green else Color.Red);
#=== end ===
#===== RSI ======
input RSI_length = 14;#hint RSI_length:The number of bars used in the calculation. TOS' default value is 14. Shorten for a faster response.
input RSI_OB = 70;#hint RSI_OB:The RSI overbought value. TOS' default is 70.
input RSI_OS = 30;#hint RSI_OS:The RSI oversold value. TOS' default = 30.
#input price = close;
input RSILowTrig = 50;#hint RSILowTrig:The trigger is between this 'RSILowTrig' value and 100 and is rising for the last 'rsi_UpBars' bars.
input rsi_UpBars = 3;#hint rsi_UpBars: The number of consecutive rising bars used to evaluated the trigger. Note that using 0 can expose you to a RSI that is falling down from the OverBought line.
def rsi_here = reference RSI(RSI_length, RSI_OB, RSI_OS, c)."RSI";
def RSI_trig = if (Between(rsi_here, RSILowTrig, 100) && Sum(rsi_here < rsi_here[1], rsi_UpBars) == rsi_UpBars) then 1 else 0;
#def HullMA = HullMovingAvg(Price = Hull_price, length = Hull_length, displace = Hull_displace).HMA;
plot rsi_Line = 28;
rsi_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
rsi_Line.SetLineWeight(5);
#def HullMA = HullMovingAvg(Price = Hull_price, length = Hull_length, displace = Hull_displace).HMA;
rsi_Line.AssignValueColor(if RSI_trig then Color.Green else Color.Red);
#== end ==
#Bollinger Bands MOBO(MOmentum BreakOut)
#============================================
#Explanation of how this works. +/- 0.8 std deviation Bollinger Bands are the criteris for bullish/bearish plots. When the close rises above the upper band the signal is bullish and stays bullish until the close moves below the lower band when the plot turns to bearish and remains bearish until the close rises above the upper band.
input MOBO_length = 10;#hint MOBO_length:The agg-bars used in the standard deviation(SD) calculation to define the upper and lower bands.
input Num_Dev_Dn = -0.8;#hint Num_Dev_Dn:The SD of the lower band. Similar to the 2,0 SD used in the Bollinger Bands
input Num_Dev_up = 0.8;#hint Num_Dev_up:The SD of the upper band. Similar to the 2,0 SD used in the Bollinger Bands
def sDev = StDev(data = c, length = MOBO_length);
def Midmobo = Average(c, length = MOBO_length);
def Lowermobo = Midmobo + Num_Dev_Dn * sDev;
def Uppermobo = Midmobo + Num_Dev_up * sDev;
def upmobo = if upmobo[1] == 0 and c >= Uppermobo then 1 else if upmobo[1] == 1 and c > Lowermobo then 1 else 0;
def upmo = if upmobo and c > Uppermobo then 1 else 0;
def dnmo = if !upmobo and c > Lowermobo then 1 else 0;
plot MOBO_Line = 31.5;
MOBO_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
MOBO_Line.SetLineWeight(5);
MOBO_Line.AssignValueColor(if upmobo == 1 then Color.Green else Color.Red);
#=== end ===
#==== Squeeze by Mobius @ My Trade =====
def nK = 1.5;
def nBB = 2.0;
def lengthsqueeze = 20;
def BBHalfWidth = StDev(c, lengthsqueeze);
def KCHalfWidth = nK * Average(TrueRange(h, c, l), lengthsqueeze);
def isSqueezed = nBB * BBHalfWidth / KCHalfWidth < 1;
plot BBS_Ind = if isSqueezed then 50 else 50;
BBS_Ind.AssignValueColor(if isSqueezed then Color.DARK_ORANGE else Color.WHITE);
BBS_Ind.SetPaintingStrategy(PaintingStrategy.POINTS);
BBS_Ind.SetLineWeight(3);
BBS_Ind.HideBubble();
#=== end ===
#== Line Spacer ===
plot line55 = 55;#Used to manage space to set labels above this value.
line55.SetDefaultColor(Color.Black);#Insert color to match your background to make line invisible
#== end ==
#==== DMI_Oscillator ====
input DMIO_Length = 10;#hint DMIO_Length:The agg-bars used to calculate the DMI_Oscillator. TOS' default is 10.
input DMIO_trig = 0;#hint DMIO_trig:The trigger value that toggles bullish/bearish. Low values risk a turn down to below 0. Persistent values above 10-15 would be considered a moderate/strong bullish indication.
def DMI_OSC_here = reference DMI_Oscillator(length = DMIO_Length).Osc;
plot DMIO_Line = 14;
DMIO_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
DMIO_Line.SetLineWeight(5);
DMIO_Line.AssignValueColor(if DMI_OSC_here > DMIO_trig then Color.Green else Color.Red);
#=== end ===
#==== ADX Indicator ====
input ADX_Length = 10;#hint ADX_Length: Length used in the ADX calculation of the trigger ADX. TOS' default is 14. You may want to use 10 to be consistent with the DMI_Oscillator.
input ADX_trig = 15;#hint ADX_trig:The bullish ADX value that toggles the bull/bear chart display. You may use any value of a bullish ADX to suit your preference. A strong ADX is >= 25 especially if it persists.
def ADX_here = Round(reference ADX(length = ADX_Length), 1);
def DMI_Pos = if DMI(ADX_Length)."DI+" > DMI(ADX_Length)."DI-" then 1 else 0;# DMI+ > DMI-
plot ADX_Line = 10.5;
ADX_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
ADX_Line.SetLineWeight(5);
ADX_Line.AssignValueColor(if DMI_Pos && ADX_here >= ADX_trig then Color.Green else Color.Red);
#== end ==
# TrueStrengthIndex
#===================
input TSI_trig = 0 ;#hint TSI_trig:The value that toggles bull/bear. TSI has a 'TSI(value)' and a 'signal' line with a zero line. This deals with the 'TSI(value)' being above the zero line. An earlier trigger could be had by analysis as was done with the MACD herein.
def TSI_here = reference TrueStrengthIndex(25, 13, 8, "WMA").TSI;
plot TSI_Line = 7;
TSI_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
TSI_Line.SetLineWeight(5);
TSI_Line.AssignValueColor(if TSI_here > TSI_trig then Color.Green else Color.Red);
#=== end ===
#Dynamic Momentum Index
#=======================
#Note: This is similar to the RSI but is more sensitive/responsive
input DYMI_length = 14;#hint DYMI_length:The length usd for this calculation. TOS default is 14.
input DYMI_trig = 70;#hint DYMI_trig:The trigger value used to toggle the Bullish/bearish indication.
def DYMI_here = DynamicMomentumIndex(DYMILength = DYMI_length).DYMI;
plot DYMI_Line = 3.5;
DYMI_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
DYMI_Line.SetLineWeight(5);
DYMI_Line.AssignValueColor(if DYMI_here >= DYMI_trig then Color.Green else Color.Red);
#== end ====
#====== MACD =======
#========= Note about the two MACD indicators below =======
# HOTES: People use the MACD for decision making in two ways. The first below is when the MACD line crosses above the signal line. This is also when the MACD histogram goes above zero. This method gives early indications.
#The second frequent use of the MACD is when the MACD itself (value) crosses aboce the zero line. This is a less risky use of the MACD but may sacrifice early entry and related profits.
#==== end of notes ========
#====== MACD.value is above MACD.avg (signal line)======
input fastLength_1 = 12;#hint fastLength_1:For the MACD plot that evaluates the MACD.Value being above the MACD.Avg (signal line).
input slowLength_1 = 26;#hint slowLength_1:For the MACD plot that evaluates the MACD.Value being above the MACD.Avg (signal line).
input MACDLength_1 = 9;#hint MACDLength_1:For the MACD plot that evaluates the MACD.Value being above the MACD.Avg (signal line).
input AverageType_1 = {SMA, default EMA};#hint AverageType_1:For the MACD plot that evaluates the MACD.Value being above the MACD.Avg (signal line).
def macd_Val_1 = MACD(fastLength_1, slowLength_1, MACDLength_1, AverageType_1).Value;
def macd_Avg1 = MACD(fastLength_1, slowLength_1, MACDLength_1, AverageType_1).Avg;
def MACD_trig = if MACD().value > MACD().avg then 1 else 0;
#def MACD_Value = MACD(MACDLength = MACDLength, AverageType = "EMA").Diff;
plot Macd_Line1 = 35;
Macd_Line1.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
Macd_Line1.SetLineWeight(5);
Macd_Line1.AssignValueColor(if macd_Val_1 > macd_Avg1 then Color.Green else Color.Red);
#== end ====
#==== MACD value is above zero ====
#NOTE that the fast and slow length may been shortened for faster response. These inputs have a '_2' after the standard MACD parameters to distinguish them from the MACD.
input fastLength_2 = 12;#hint fastLength_2:For the MACD plot that evaluates the MACD.Value being above the zero line. The value may be altered for faster response.
input slowLength_2 = 26;#hint slowLength_2:For the MACD plot that evaluates the MACD.Value being above the zero line. The value may be altered for faster response.
input MACDLength_2 = 9;#hint MACDLength_2:For the MACD plot that evaluates the MACD.Value being above the zero line. The value may be altered for faster response.
input AverageType_2 = {SMA, default EMA};#hint AverageType_2:For the MACD plot that evaluates the MACD.Value being above the zero line. The value may be altered for faster/slower response. This selects tha average type to be used.
input macdVal_trig = 0;#hint macdVal_trig:For the MACD plot that evaluates the MACD value being above the zero line. The normal default value is 0, i.e. the zero line, but may be altered here.
def MACDValue_2 = MACD(fastLength_2, slowLength_2, MACDLength_2, AverageType_2).Value;
plot MACD_Line2 = 38.5;
MACD_Line2.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
MACD_Line2.SetLineWeight(5);
MACD_Line2.AssignValueColor(if MACDValue_2 >= macdVal_trig then Color.Green else Color.Red);
#== end ==
#======= HullMovingAvg ==========
input Hull_price = close;#hint Hull_price:The price basis of the HMA.
input Hull_length = 20;#hint Hull_length:The agg-bars used in the HMA calculation.
input Hull_displace = 0;#hint Hull_displace: Displacement of the HMA in agg-bars
def HullMA = HullMovingAvg(Price = Hull_price, length = Hull_length, displace = Hull_displace).HMA;
plot Hull_Line = 42;
Hull_Line.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
Hull_Line.SetLineWeight(5);
Hull_Line.AssignValueColor(if HullMA > HullMA[1] then Color.Green else Color.Red);
#== end ==
#Define variables used to place a bubble
#========================================
#Input Offset = BarNumber() / 2;
def barNum = BarNumber();
def offset = 50;
def LastBar = !IsNaN(open) and IsNaN(open [-1] ) ;
def BubbleLocation = LastBar[offset];
def FirstBar = if barNum == 1 then 1 else 0;
def FirstBarValue = if barNum == 1 then 1 else 0;
def LastBarValue = if LastBar then barNum else 0;
def MidBar = if LastBar then barNum == (BarNumber() / 2) else 0;
#example
#addchartbubble(LastBar,45, "This is a last bar bubble", color.White);
#==========================================
#======== Bubbles ==============
AddChartBubble(FirstBar, 42, " HullMA(" + Hull_length + "). " + "Bullish when HMA > previous HMA.", Color.white);
AddChartBubble(FirstBar, 35, " MACD(" + fastLength_1 + "," + slowLength_1 + "," + MACDLength_1 + "," + AverageType_1 + "). Trigger = MACD().value > MACD().avg", Color.PINK);
AddChartBubble(FirstBar, 38.5, " MACD.Value(" + fastLength_2 + "," + slowLength_2 + "," + MACDLength_2 + "," + AverageType_2 + ")" + "Bullish when MACD.Value is > zero line. Trigger = " + macdVal_trig + "( Normally 0)", Color.PINK);
AddChartBubble(FirstBar, 17.5 , " Polarized Fractal Efficiency (" + PFE_length + "). " + "Trend UP = 0 to 100. Trigger = " + PFE_trig, Color.WHITE);
AddChartBubble(FirstBar, 21, " MomentumPercent(" + MomPctLength + "). Bullish when > 0 % & for long periods. Trigger = " + MOM_Pct_trig + " percent", Color.CYAN);
AddChartBubble(FirstBar, 24.5, " Ichimoku(" + tenkan_period + ", " + kijun_period + "). Bullish trigger = when tenkan > kijun. The more the diff, the stronger the trend.", Color.WHITE);
AddChartBubble(FirstBar, 28, " RSI(" + RSI_length + ")." + " Trigger = RSI is between " + RSILowTrig + " and 100 and is rising for last " + rsi_UpBars + " bars", Color.CYAN);
AddChartBubble(FirstBar, 31.5, " Bollinger Bands(+/- " + Num_Dev_up + " SD)" + " MOmentum Break Out (MOBO(" + MOBO_length + "))." + " Trigger = close above upper band until close below lower band.", Color.WHITE);
AddChartBubble(FirstBar, 14, " DMI_Oscillator(" + DMIO_Length + "). Bullish DMI = green = >0: Bearish DMI = red. Trigger = " + DMIO_trig, Color.PINK);
AddChartBubble(FirstBar, 10.5, " ADX(" + ADX_Length + "). Bullish ADX = green: Bearish ADX = red. Strong bullish ADX trend is > 25. Trigger = " + ADX_trig, Color.PINK);
AddChartBubble(FirstBar, 7, " TrueStrengthIndex(25,13,8,'WMA')." + " Bullish TSI = green & 0 to +50. Bearish TSI = red & 0 to -50. Trigger = " + TSI_trig, Color.CYAN);
AddChartBubble(FirstBar, 50, " DARK_ORANGE dot denotes SQUEEZE", Color.WHITE);
AddChartBubble(FirstBar, 3.5, " DynamicMomentumIndex-DYMI(" + DYMI_length + "). Overbought = 70: Oversold = 30. Trigger = " + DYMI_trig, Color.CYAN);
#== end ==
#== Labels ==
#Count of Periods in consecutive squeeze
rec count = if isSqueezed then count[1] + 1 else 0;
AddLabel(showlabels, if isSqueezed then "Squeeze is on for " + count + " bars" else "No Squeeze is on", if isSqueezed then Color.RED else Color.WHITE);
AddLabel(showlabels, "HullMovingAvg(" + Hull_length + ") = " + Round(HullMA, 2), if HullMA > HullMA[1] then Color.GREEN else Color.RED);
AddLabel(showlabels, "MACD.Value(" + Round(macd_Val_1, 1) + ") cross above MACD.Avg(" + Round(macd_Avg1, 1) + ")(signal) = " + if Round(macd_Val_1, 1) > Round(macd_Avg1, 1) then "true" else "not true", if Round(macd_Val_1, 1) > Round(macd_Avg1, 1) then Color.GREEN else Color.LIGHT_RED);
AddLabel(showlabels, "MACD.Value(" + Round(MACDValue_2, 1) + ") cross above 0 line = " + if Round(MACDValue_2, 1) >= 0 then "true" else "not true", if Round(MACDValue_2, 1) >= 0 then Color.GREEN else Color.LIGHT_RED);
AddLabel(showlabels, if upmobo and c < Uppermobo then "MOBO close is between(" + Num_Dev_up + " SD) bands"
else if upmo then "MOBO is above upper(" + Num_Dev_up + " SD) band"
else if dnmo then "MOBO is below lower(" + Num_Dev_up + " SD) band"
else "", Color.GREEN);
AddLabel(showlabels, "RSI(" + RSI_length + ") = " + Round(rsi_here, 1), if RSI_trig then Color.GREEN else Color.RED);
AddLabel(showlabels, "Ichimoku(" + tenkan_period + ", " + kijun_period + "):" + "Tenkan / Kijan = " + Ichimoku().Tenkan + " / " + Ichimoku().kijun, if Ichimoku()."Tenkan" > Ichimoku()."Kijun" then Color.GREEN else Color.RED);
AddLabel(showlabels, "MomentumPercent(" + MomPctLength + ") = " + Round(mom_pct, 2) + " %", if mom_pct >= MOM_Pct_trig then Color.GREEN else Color.RED);
AddLabel(showlabels, "Polarized Fractal Eff(" + PFE_length + ") = " + Round(PFE, 0), if PFE >= PFE_trig then Color.GREEN else Color.RED);
AddLabel(showlabels, "DMI Osc(" + DMIO_Length + ") = " + Round(DMI_OSC_here, 1), if DMI_OSC_here >= DMIO_trig then Color.GREEN else Color.RED);
AddLabel(showlabels, "ADX(" + ADX_Length + ") = " + ADX_here, if ADX_here >= ADX_trig && DMI_Pos then Color.GREEN else Color.RED);
AddLabel(showlabels, "TSI = " + Round(TSI_here, 1), if TSI_here >= TSI_trig then Color.GREEN else Color.RED);
AddLabel(showlabels, "DYMI(" + DYMI_length + ") = " + Round(DYMI_here, 1), if DYMI_here >= DYMI_trig then Color.GREEN else Color.RED);
#END#
#== end ==
# End of Code
```

Last edited by a moderator: