input timeFrame = {default day};
input showOnlyToday = no;
def day = GetDay();
def lastday = GetLastDay();
def isToday = If(day >= lastday, 1, 0);
def shouldPlot = If(showOnlyToday and isToday, 1, If(!showOnlyToday, 1, 0));
#-----------------------------
#input paintBars = yes;
#-------------
plot UpperVolatility = isToday;
plot LowerVolatility = !isToday;
#-----------------------
UpperVolatility.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
UpperVolatility.SetLineWeight(3);
UpperVolatility.SetDefaultColor(Color.GREEN);
UpperVolatility.Hide();
#----------------------------
LowerVolatility.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
LowerVolatility.SetLineWeight(3);
LowerVolatility.SetDefaultColor(Color.RED);
LowerVolatility.Hide();
#------------------------------------------
#( today bars )
DefineGlobalColor("up", Color.GREEN);
DefineGlobalColor("dwn", Color.RED);
# ( not today bars )
DefineGlobalColor("invisi", Color.BLACK);
# if not paint bars then paint normal ... if condition1 then bullish scheme ... if condition2 then bearish scheme ... else normal
AssignPriceColor(
if !showOnlyToday
#!paintBars
then Color.CURRENT
else
# ( is today then normal paint )
if UpperVolatility
then
if close > open then GlobalColor("up") else GlobalColor("dwn")
#globalColor( "up"winking smiley
else
# ( is not today then black)
if LowerVolatility
then GlobalColor( "invisi")
else Color.CURRENT);
def today = GetDay() == GetLastDay();
plot dailyHigh = if !today then Double.NaN else high(period = "day" );
plot dailyLow = if !today then Double.NaN else low(period = "day" );
#-----------------------------
# ___________________________________________________________
# ________________ DAY/ HI-LOW / VOLUME ____________________
# ___________________________________________________________
#
input show_label = yes;
input show_bubble = no;
def period_Type = AggregationPeriod.DAY;
def begin = close(period = period_Type)[1];
def end = close(period = period_Type);
def NetChg = end - begin;
def PctChg = (end / begin) - 1;
def DayVolume = volume(period = "DAY");
AddLabel(show_label, " V: " + DayVolume + " " , if DayVolume > 0 then CreateColor( 224, 224, 224)
else if DayVolume == 0 then CreateColor(224, 224, 224) else Color.LIGHT_GRAY);
def bar = if IsNaN(close)
then if yes
then bar[1]
else Double.NaN
else BarNumber();
def ThisBar = HighestAll(bar);
def barCount = if bar == ThisBar
then close
else Double.NaN;
#####------EMA2
input price = close;
#input length9 = 9;
input length34 = 34;
input length144 = 144;
input displace = 0;
input showBreakoutSignals = no;
#def AvgExp9 = ExpAverage(price[-displace], length9);
def AvgExp34 = ExpAverage(price[-displace], length34);
def AvgExp144 = ExpAverage(price[-displace], length144);
input averageType = AverageType.EXPONENTIAL;
plot fastAvg = MovingAverage(averageType, price[-displace], Length34);
plot slowAvg = MovingAverage(averageType, price[-displace], Length144);
fastAvg.SetDefaultColor(GetColor(1));
slowAvg.SetDefaultColor(GetColor(0));
AddLabel(yes, if fastAvg < slowAvg then "Trending Down" else "");
#Alert( fastAvg < slowAvg , "Trending Down ", Alert.BAR, Sound.Ring);
AddLabel(fastAvg > slowAvg, "Trending Up ", Color.LIGHT_GREEN);
#Alert( fastAvg > slowAvg , "Trending Up ", Alert.BAR, Sound.Ring);
#End Code