```
# Study Name: Quad_Momentum_Intraday
# Mobius
# V01.01.2012 Revised 03.12.2017
#hint: <b>This Study is for intraday trading only. The study uses Consolidated TICK, Advance Decline, Volume Breadth and Price for Trend Momentum. When all 4 agree the study plots a directional marker and colors the candles blue for ascending or yellow for descending price. The markers and candle color can be turned on and off with user inputs. The "n" input is for momentum length calculations.\n Trading Note: Look for the candle color or trend marker to "stop plotting" for indication trend may be slowing, possibly changing.\n Highest and best use is with a pivot study and a multiple contract Risk On / Risk off money management approach.
declare hide_on_daily;
input n = 8; #hint n: Length for Momentum calculations.
input CandleColor = yes;
input TrendMarkers = no;
input ShowData = yes;
input TickSymb = {default "$TIKSP", "$TICK", "$TICK/Q"};
input ADSymb = {default "$ADSPD", "$ADD", "$ADQD"};
input VolSymb = {default "$VOLSPD", "$VOLQD", "$VOLID"};
def tick = if IsNaN(close(TickSymb))
then tick[1]
else close(TickSymb);
def AD = if IsNaN(close(ADSymb))
then AD[1]
else close(ADSymb);
def Breadth = if IsNaN(close(VolSymb))
then Breadth[1]
else close(VolSymb);
def price = close;
def Hrs = Floor(9.5 + SecondsFromTime(0930) / 60 / 60) - 1;
def Min = ((9.5 + SecondsFromTime(930) / 60 / 60) % 1) * 60;
def active = if SecondsFromTime(0930) >= 0 and
SecondsTillTime(1600) >= 0
then 1
else 0;
def lowestAD = if active and !active[1]
then AD
else if active and
AD < lowestAD[1]
then AD
else lowestAD[1];
def AD_low_Time_Hrs = if AD == lowestAD
then Hrs
else AD_low_Time_Hrs[1];
def AD_low_Time_min = if AD == lowestAD
then Min
else AD_low_Time_min[1];
def highestAD = if active and !active[1]
then AD
else if active and
AD > highestAD[1]
then AD
else highestAD[1];
def AD_high_Time_Hrs = if AD == highestAD
then Hrs
else AD_high_Time_Hrs[1];
def AD_high_Time_min = if AD == highestAD
then Min
else AD_high_Time_min[1];
def sumAD = if active and !active[1]
then AD
else if active
then sumAD[1] + AD
else sumAD[1];
def barLength = if active and !active[1]
then 1
else if active
then barLength[1] + 1
else barLength[1];
def MA_AD = sumAD / barLength;
def CumTick = fold i = 0 to active
with p
while active
do CumTick[1] + tick;
def CumTickMomo = (CumTick - Lowest(CumTick, n)) /
(Highest(CumTick, n) - Lowest(CumTick, n));
def ADMomo = (AD - Lowest(AD, n)) /
(Highest(AD, n) - Lowest(AD, n));
def BreadthMomo = (Breadth - Lowest(Breadth, n)) /
(Highest(Breadth, n) - Lowest(Breadth, n));
def PriceMomo = (price - Lowest(price, n)) /
(Highest(price, n) - Lowest(price, n));
plot QuadTrendUp = if CumTickMomo > .5 and
ADMomo > .5 and
BreadthMomo > .5 and
PriceMomo > .5
then low - TickSize()
else Double.NaN;
QuadTrendUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
QuadTrendUp.SetLineWeight(1);
QuadTrendUp.SetDefaultColor(Color.GREEN);
QuadTrendUp.SetHiding(!TrendMarkers);
plot QuadTrendDn = if CumTickMomo < .5 and
ADMomo < .5 and
BreadthMomo < .5 and
PriceMomo < .5
then high + TickSize()
else Double.NaN;
QuadTrendDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
QuadTrendDn.SetLineWeight(1);
QuadTrendDn.SetDefaultColor(Color.RED);
QuadTrendDn.SetHiding(!TrendMarkers);
def Range = Highest(high, n) - Lowest(low, n);
AssignPriceColor(if CandleColor and !IsNaN(QuadTrendUp)
then CreateColor(25,49,250)
else if CandleColor and !IsNaN(QuadTrendDn)
then Color.YELLOW
else Color.CURRENT);
AddLabel(ShowData, "Quad Data: " +
" Tick = " + tick +
" || AD = " + AD +
" Highest AD = " + highestAD + " At: " + AD_high_Time_Hrs + ":" + AD_high_Time_min +
" Lowest AD = " + lowestAD + " At: " + AD_low_Time_Hrs + ":" + AD_low_Time_min +
" Avg AD = " + Round(MA_AD, 0) +
" || Breadth = " + Round(Breadth / 1000000, 2) + "m" +
" || Range("+ n + ") = " + AsDollars(Round(Range / TickSize(), 0) * TickSize()),
if !IsNaN(QuadTrendUp)
then CreateColor(25,49,250)
else if !IsNaN(QuadTrendDn)
then Color.YELLOW
else Color.WHITE);
# End Code Quad_Momentum_Intraday
```