Good morning. I have a higher time frame label script that shows the Daily, 4H, 1h, 30m, 15m and 5m is it possible to make this script a comparison HTF script to watch to stocks at the same time like /NQ and /ES? Thank you
Code:
input DayLabel = yes;
input FourHourLabel = yes;
input HourLabel = yes;
input FifteenMinLabel = yes;
input FiveMinLabel = yes;
input show_BackgroundColor = yes;
DefineGlobalColor("UP", Color.DARK_GREEN);
DefineGlobalColor("DOWN", Color.DARK_RED);
## Day Aggregation Period Variables
def DayOpen;
def DayClose;
def DayUp;
def DayDown;
def DayAggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.DAY {
DayOpen = open(period = "Day");
DayClose = close(period = "Day");
DayUp = if DayClose > DayOpen then 1 else 0;
DayDown = if DayClose < DayOpen then 1 else 0;
DayAggregationPeriod = 1;
}
else {
DayOpen = 0;
DayClose = 0;
DayUp = 0;
DayDown = 0;
DayAggregationPeriod = 0;
}
AddLabel(DayLabel and DayAggregationPeriod, " D ", if DayUp then GlobalColor("UP") else if DayDown then GlobalColor("DOWN") else Color.WHITE);
## four_hours Aggregation Period Variables
def four_hoursOpen;
def four_hoursClose;
def four_hoursUp;
def four_hoursDown;
def four_hoursAggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.FOUR_HOURS {
four_hoursOpen = open(period = "4 hours");
four_hoursClose = close(period = "4 hours");
four_hoursUp = if four_hoursClose > four_hoursOpen then 1 else 0;
four_hoursDown = if four_hoursClose < four_hoursOpen then 1 else 0;
four_hoursAggregationPeriod = 1;
}
else {
four_hoursOpen = 0;
four_hoursClose = 0;
four_hoursUp = 0;
four_hoursDown = 0;
four_hoursAggregationPeriod = 0;
}
AddLabel(FourHourLabel and four_hoursAggregationPeriod, " 4H ", if four_hoursUp then GlobalColor("UP") else if four_hoursDown then GlobalColor("DOWN") else Color.WHITE);
## Hour Aggregation Period Variables
def HourOpen;
def HourClose;
def HourUp;
def HourDown;
def HourAggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.HOUR {
HourOpen = open(period = "1 Hour");
HourClose = close(period = "1 Hour");
HourUp = if HourClose > HourOpen then 1 else 0;
HourDown = if HourClose < HourOpen then 1 else 0;
HourAggregationPeriod = 1;
}
else {
HourOpen = 0;
HourClose = 0;
HourUp = 0;
HourDown = 0;
HourAggregationPeriod = 0;
}
AddLabel(HourLabel and HourAggregationPeriod, " 1h ", if HourUp then GlobalColor("UP") else if HourDown then GlobalColor("DOWN") else Color.WHITE);
## Fifteen_Min Aggregation Period Variables
def Fifteen_MinOpen;
def Fifteen_MinClose;
def Fifteen_MinUp;
def Fifteen_MinDown;
def Fifteen_MinAggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN {
Fifteen_MinOpen = open(period = "15 Min");
Fifteen_MinClose = close(period = "15 Min");
Fifteen_MinUp = if Fifteen_MinClose > Fifteen_MinOpen then 1 else 0;
Fifteen_MinDown = if Fifteen_MinClose < Fifteen_MinOpen then 1 else 0;
Fifteen_MinAggregationPeriod = 1;
}
else {
Fifteen_MinOpen = 0;
Fifteen_MinClose = 0;
Fifteen_MinUp = 0;
Fifteen_MinDown = 0;
Fifteen_MinAggregationPeriod = 0;
}
AddLabel(FifteenMinLabel and Fifteen_MinAggregationPeriod, " 15M ", if Fifteen_MinUp then GlobalColor("UP") else if Fifteen_MinDown then GlobalColor("DOWN") else Color.WHITE);
## Five_Min Aggregation Period Variables
def Five_MinOpen;
def Five_MinClose;
def Five_MinUp;
def Five_MinDown;
def Five_MinAggregationPeriod;
if GetAggregationPeriod() <= AggregationPeriod.FIVE_MIN {
Five_MinOpen = open(period = "5 Min");
Five_MinClose = close(period = "5 Min");
Five_MinUp = if Five_MinClose > Five_MinOpen then 1 else 0;
Five_MinDown = if Five_MinClose < Five_MinOpen then 1 else 0;
Five_MinAggregationPeriod = 1;
}
else {
Five_MinOpen = 0;
Five_MinClose = 0;
Five_MinUp = 0;
Five_MinDown = 0;
Five_MinAggregationPeriod = 0;
}
AddLabel(FiveMinLabel and Five_MinAggregationPeriod, " 5M ", if Five_MinUp then GlobalColor("UP") else if Five_MinDown then GlobalColor("DOWN") else Color.WHITE);
Last edited by a moderator: