###############WEEK###############
def open_week;
def high_week;
def low_week;
def close_week;
def Volume_week;
if GetAggregationPeriod() <= AggregationPeriod.WEEK {
open_week = open(period = AggregationPeriod.WEEK);
high_week = high(period = AggregationPeriod.WEEK);
low_week = low(period = AggregationPeriod.WEEK);
close_week = close(period = AggregationPeriod.WEEK);
Volume_week = volume(period = AggregationPeriod.WEEK);
} else {
open_week = Double.NaN;
high_week = Double.NaN;
low_week = Double.NaN;
close_week = Double.NaN;
Volume_week = Double.NaN;
}
###############DAY###############
def open_day;
def high_day;
def low_day;
def close_day;
def Volume_day;
if GetAggregationPeriod() <= AggregationPeriod.DAY {
open_day = open(period = AggregationPeriod.DAY);
high_day = high(period = AggregationPeriod.DAY);
low_day = low(period = AggregationPeriod.DAY);
close_day = close(period = AggregationPeriod.DAY);
Volume_day = volume(period = AggregationPeriod.DAY);
} else {
open_day = Double.NaN;
high_day = Double.NaN;
low_day = Double.NaN;
close_day = Double.NaN;
Volume_day = Double.NaN;
}
###############4HR###############
def open_four_hours;
def high_four_hours;
def low_four_hours;
def close_four_hours;
def Volume_four_hours;
if GetAggregationPeriod() <= AggregationPeriod.FOUR_HOURS {
open_four_hours = open(period = AggregationPeriod.FOUR_HOURS);
high_four_hours = high(period = AggregationPeriod.FOUR_HOURS);
low_four_hours = low(period = AggregationPeriod.FOUR_HOURS);
close_four_hours = close(period = AggregationPeriod.FOUR_HOURS);
Volume_four_hours = volume(period = AggregationPeriod.FOUR_HOURS);
} else {
open_four_hours = Double.NaN;
high_four_hours = Double.NaN;
low_four_hours = Double.NaN;
close_four_hours = Double.NaN;
Volume_four_hours = Double.NaN;
}
###############2HR###############
def open_two_hours;
def high_two_hours;
def low_two_hours;
def close_two_hours;
def Volume_two_hours;
if GetAggregationPeriod() <= AggregationPeriod.TWO_HOURS {
open_two_hours = open(period = AggregationPeriod.TWO_HOURS);
high_two_hours = high(period = AggregationPeriod.TWO_HOURS);
low_two_hours = low(period = AggregationPeriod.TWO_HOURS);
close_two_hours = close(period = AggregationPeriod.TWO_HOURS);
Volume_two_hours = volume(period = AggregationPeriod.TWO_HOURS);
} else {
open_two_hours = Double.NaN;
high_two_hours = Double.NaN;
low_two_hours = Double.NaN;
close_two_hours = Double.NaN;
Volume_two_hours = Double.NaN;
}
###############1HR###############
def open_hour;
def high_hour;
def low_hour;
def close_hour;
def Volume_hour;
if GetAggregationPeriod() <= AggregationPeriod.HOUR {
open_hour = open(period = AggregationPeriod.HOUR);
high_hour = high(period = AggregationPeriod.HOUR);
low_hour = low(period = AggregationPeriod.HOUR);
close_hour = close(period = AggregationPeriod.HOUR);
Volume_hour = volume(period = AggregationPeriod.HOUR);
} else {
open_hour = Double.NaN;
high_hour = Double.NaN;
low_hour = Double.NaN;
close_hour = Double.NaN;
Volume_hour = Double.NaN;
}
###############30Min###############
def open_thirty_min;
def high_thirty_min;
def low_thirty_min;
def close_thirty_min;
def Volume_thirty_min;
if GetAggregationPeriod() <= AggregationPeriod.THIRTY_MIN {
open_thirty_min = open(period = AggregationPeriod.THIRTY_MIN);
high_thirty_min = high(period = AggregationPeriod.THIRTY_MIN);
low_thirty_min = low(period = AggregationPeriod.THIRTY_MIN);
close_thirty_min = close(period = AggregationPeriod.THIRTY_MIN);
Volume_thirty_min = volume(period = AggregationPeriod.THIRTY_MIN);
} else {
open_thirty_min = Double.NaN;
high_thirty_min = Double.NaN;
low_thirty_min = Double.NaN;
close_thirty_min = Double.NaN;
Volume_thirty_min = Double.NaN;
}
###############15Min###############
def open_fifteen_min;
def high_fifteen_min;
def low_fifteen_min;
def close_fifteen_min;
def Volume_fifteen_min;
if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN {
open_fifteen_min = open(period = AggregationPeriod.FIFTEEN_MIN);
high_fifteen_min = high(period = AggregationPeriod.FIFTEEN_MIN);
low_fifteen_min = low(period = AggregationPeriod.FIFTEEN_MIN);
close_fifteen_min = close(period = AggregationPeriod.FIFTEEN_MIN);
Volume_fifteen_min = volume(period = AggregationPeriod.FIFTEEN_MIN);
} else {
open_fifteen_min = Double.NaN;
high_fifteen_min = Double.NaN;
low_fifteen_min = Double.NaN;
close_fifteen_min = Double.NaN;
Volume_fifteen_min = Double.NaN;
}
########################WEEK CODE###########################
def cond1W = close_week[2] < open_week[2];
def cond2W = close_week[1] > open_week[1] and (high_week[1] - low_week[1]) > (high_week[2] - low_week[2]) * 2;
def cond3W = low_week > high_week[2] + .01;
def cond4W = if IsNaN(close_week)
then cond4W[1]
else if cond1W && cond2W && cond3W
then high_week[2]
else cond4W[1];
plot Week_bull = cond4W;
Week_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Week_bull.SetDefaultColor(Color.LIGHT_GREEN);
def cond1Wa = close_week[2] > open_week[2];
def cond2Wa = close_week[1] < open_week[1] and (high_week[1] - low_week[1]) > (high_week[2] - low_week[2]) * 2;
def cond3Wa = high_week < low_week[2] - .01;
def cond4Wa = if IsNaN(close_week)
then cond4W[1]
else if cond1Wa && cond2Wa && cond3Wa
then low_week[2]
else cond4Wa[1];
plot Week_bear = cond4Wa;
Week_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Week_bear.SetDefaultColor(Color.PINK);
AddChartBubble(Week_bull <> Week_bull[1], Week_bull, Concat("W= $", Week_bull), Color.ORANGE);
AddChartBubble(Week_bear <> Week_bear[1], Week_bear, Concat("W = $", Week_bear), Color.ORANGE);
########################DAY CODE###########################
def cond1D = close_day[2] < open_day[2];
def cond2D = close_day[1] > open_day[1] and (high_day[1] - low_day[1]) > (high_day[2] - low_day[2]) * 2;
def cond3D = low_day > high_day[2] + .01;
def cond4D = if IsNaN(close_day)
then cond4D[1]
else if cond1D && cond2D && cond3D
then high_day[2]
else cond4D[1];
plot Day_bull = cond4D;
Day_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Day_bull.SetDefaultColor(Color.LIGHT_GREEN);
def cond1Da = close_day[2] > open_day[2];
def cond2Da = close_day[1] < open_day[1] and (high_day[1] - low_day[1]) > (high_day[2] - low_day[2]) * 2;
def cond3Da = high_day < low_day[2] - .01;
def cond4Da = if IsNaN(close_day)
then cond4D[1]
else if cond1Da && cond2Da && cond3Da
then low_day[2]
else cond4Da[1];
plot Day_bear = cond4Da;
Day_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Day_bear.SetDefaultColor(Color.PINK);
AddChartBubble(Day_bull <> Day_bull[1], Day_bull, Concat("D= $", Day_bull), Color.ORANGE);
AddChartBubble(Day_bear <> Day_bear[1], Day_bear, Concat("D = $", Day_bear), Color.ORANGE);
#######################FOUR HOUR CODE###########################
def cond1_4H = close_four_hours[2] < open_four_hours[2];
def cond2_4H = close_four_hours[1] > open_four_hours[1] and (high_four_hours[1] - low_four_hours[1]) > (high_four_hours[2] - low_four_hours[2]) * 2;
def cond3_4H = low_four_hours > high_four_hours[2] + .01;
def cond4_4H = if IsNaN(close_four_hours)
then cond4_4H[1]
else if cond1_4H && cond2_4H && cond3_4H
then high_four_hours[2]
else cond4_4H[1];
plot Four_hours_bull = cond4_4H;
Four_hours_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Four_hours_bull.SetDefaultColor(Color.LIGHT_GREEN);
def cond1_4Ha = close_four_hours[2] > open_four_hours[2];
def cond2_4Ha = close_four_hours[1] < open_four_hours[1] and (high_four_hours[1] - low_four_hours[1]) > (high_four_hours[2] - low_four_hours[2]) * 2;
def cond3_4Ha = high_four_hours < low_four_hours[2] - .01;
def cond4_4Ha = if IsNaN(close_four_hours)
then cond4_4H[1]
else if cond1_4Ha && cond2_4Ha && cond3_4Ha
then low_four_hours[2]
else cond4_4Ha[1];
plot Four_hours_bear = cond4_4Ha;
Four_hours_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Four_hours_bear.SetDefaultColor(Color.PINK);
AddChartBubble(Four_hours_bull <> Four_hours_bull[1], Four_hours_bull, Concat("4H= $", Four_hours_bull), Color.ORANGE);
AddChartBubble(Four_hours_bear <> Four_hours_bear[1], Four_hours_bear, Concat("4H = $", Four_hours_bear), Color.ORANGE);
#######################TWO HOUR CODE###########################
def cond1_2_2H = close_two_hours[2] < open_two_hours[2];
def cond2_2H = close_two_hours[1] > open_two_hours[1] and (high_two_hours[1] - low_two_hours[1]) > (high_two_hours[2] - low_two_hours[2]) * 2;
def cond3_2H = low_two_hours > high_two_hours[2] + .01;
def cond4_2H = if IsNaN(close_two_hours)
then cond4_2H[1]
else if cond1_2_2H && cond2_2H && cond3_2H
then high_two_hours[2]
else cond4_2H[1];
plot Two_Hours_bull = cond4_2H;
Two_Hours_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Two_Hours_bull.SetDefaultColor(Color.LIGHT_GREEN);
def cond1_2_2Ha = close_two_hours[2] > open_two_hours[2];
def cond2_2Ha = close_two_hours[1] < open_two_hours[1] and (high_two_hours[1] - low_two_hours[1]) > (high_two_hours[2] - low_two_hours[2]) * 2;
def cond3_2Ha = high_two_hours < low_two_hours[2] - .01;
def cond4_2Ha = if IsNaN(close_two_hours)
then cond4_2Ha[1]
else if cond1_2_2Ha && cond2_2Ha && cond3_2Ha
then low_two_hours[2]
else cond4_2Ha[1];
plot Two_Hours_bear = cond4_2Ha;
Two_Hours_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Two_Hours_bear.SetDefaultColor(Color.PINK);
AddChartBubble(Two_Hours_bull <> Two_Hours_bull[1], Two_Hours_bull, Concat("2H= $", Two_Hours_bull), Color.ORANGE);
AddChartBubble(Two_Hours_bear <> Two_Hours_bear[1], Two_Hours_bear, Concat("2H = $", Two_Hours_bear), Color.ORANGE);
#######################HOUR CODE###########################
def cond1H = close_hour[2] < open_hour[2];
def cond2H = close_hour[1] > open_hour[1] and (high_hour[1] - low_hour[1]) > (high_hour[2] - low_hour[2]) * 2;
def cond3H = low_hour > high_hour[2] + .01;
def cond4H = if IsNaN(close_hour)
then cond4H[1]
else if cond1H && cond2H && cond3H
then high_hour[2]
else cond4H[1];
plot Hour_bull = cond4H;
Hour_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Hour_bull.SetDefaultColor(Color.LIGHT_GREEN);
def cond1Ha = close_hour[2] > open_hour[2];
def cond2Ha = close_hour[1] < open_hour[1] and (high_hour[1] - low_hour[1]) > (high_hour[2] - low_hour[2]) * 2;
def cond3Ha = high_hour < low_hour[2] - .01;
def cond4Ha = if IsNaN(close_hour)
then cond4Ha[1]
else if cond1Ha && cond2Ha && cond3Ha
then low_hour[2]
else cond4Ha[1];
plot Hour_bear = cond4Ha;
Hour_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Hour_bear.SetDefaultColor(Color.PINK);
AddChartBubble(Hour_bull <> Hour_bull[1], Hour_bull, Concat("H= $", Hour_bull), Color.ORANGE);
AddChartBubble(Hour_bear <> Hour_bear[1], Hour_bear, Concat("H = $", Hour_bear), Color.ORANGE);
#######################30 MIN CODE###########################
def cond1_30M = close_thirty_min[2] < open_thirty_min[2];
def cond2_30M = close_thirty_min[1] > open_thirty_min[1] and (high_thirty_min[1] - low_thirty_min[1]) > (high_thirty_min[2] - low_thirty_min[2]) * 2;
def cond3_30M = low_thirty_min > high_thirty_min[2] + .01;
def cond4_30M = if IsNaN(close_thirty_min)
then cond4_30M[1]
else if cond1_30M && cond2_30M && cond3_30M
then high_thirty_min[2]
else cond4_30M[1];
plot Thirty_min_bull = cond4_30M;
Thirty_min_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#Thirty_min_bull.SetDefaultColor(Color.Light_green);
def cond1_30Ma = close_thirty_min[2] > open_thirty_min[2];
def cond2_30Ma = close_thirty_min[1] < open_thirty_min[1] and (high_thirty_min[1] - low_thirty_min[1]) > (high_thirty_min[2] - low_thirty_min[2]) * 2;
def cond3_30Ma = high_thirty_min < low_thirty_min[2] - .01;
def cond4_30Ma = if IsNaN(close_thirty_min)
then cond4_30M[1]
else if cond1_30Ma && cond2_30Ma && cond3_30Ma
then low_thirty_min[2]
else cond4_30Ma[1];
plot Thirty_min_bear = cond4_30Ma;
Thirty_min_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#Thirty_min_bear.SetDefaultColor(Color.Pink);
AddChartBubble(Thirty_min_bull <> Thirty_min_bull[1], Thirty_min_bull, Concat("30M= $", Thirty_min_bull), Color.ORANGE);
AddChartBubble(Thirty_min_bear <> Thirty_min_bear[1], Thirty_min_bear, Concat("30M = $", Thirty_min_bear), Color.ORANGE);
#######################15 MIN CODE###########################
def cond1_15M = close_fifteen_min[2] < open_fifteen_min[2];
def cond2_15M = close_fifteen_min[1] > open_fifteen_min[1] and (high_fifteen_min[1] - low_fifteen_min[1]) > (high_fifteen_min[2] - low_fifteen_min[2]) * 2;
def cond3_15M = low_fifteen_min > high_fifteen_min[2] + .01;
def cond4_15M = if IsNaN(close_fifteen_min)
then cond4_15M[1]
else if cond1_15M && cond2_15M && cond3_15M
then high_fifteen_min[2]
else cond4_15M[1];
plot Fifteen_min_bull = cond4_15M;
Fifteen_min_bull.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#Fifteen_min_bull.SetDefaultColor(Color.Light_green);
def cond1_15Ma = close_fifteen_min[2] > open_fifteen_min[2];
def cond2_15Ma = close_fifteen_min[1] < open_fifteen_min[1] and (high_fifteen_min[1] - low_fifteen_min[1]) > (high_fifteen_min[2] - low_fifteen_min[2]) * 2;
def cond3_15Ma = high_fifteen_min < low_fifteen_min[2] - .01;
def cond4_15Ma = if IsNaN(close_fifteen_min)
then cond4_15M[1]
else if cond1_15Ma && cond2_15Ma && cond3_15Ma
then low_fifteen_min[2]
else cond4_15Ma[1];
plot Fifteen_min_bear = cond4_15Ma;
Fifteen_min_bear.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#Fifteen_min_bear.SetDefaultColor(Color.Pink);
AddChartBubble(Fifteen_min_bull <> Fifteen_min_bull[1], Fifteen_min_bull, Concat("15M= $", Fifteen_min_bull), Color.ORANGE);
AddChartBubble(Fifteen_min_bear <> Fifteen_min_bear[1], Fifteen_min_bear, Concat("15M = $", Fifteen_min_bear), Color.ORANGE);