I have looked all over TOS for a way to display the price line. I could not find that setting in their software. I was working on placing a close line in another indicator and then came up with this. I have placed how I am using it in a description of the code. If you do not desire all the other lines. Just either delete those lines from the code or turn their plots off. I currently have it set to work in the 1 min, 1 hour, 1 day as default. In the end I still have confliction in the other indicator that I am working on. I will figure it out, I thought I would share this in case others prefer to have an active price line to help with support and resistance trading. Happy trading to all.
Code:
#Active Price Line by Alfred Scott Jordan 09/18/22
#This study plots a close or open line according to then aggregation periods desired.
#If you have the Day close activated and the lowest time frame close activated it will in effect, give you a price line across the chart until that days final close.
#I have found that by using the open and close for the middle time frame that it will show an accurate support and resistance for the lowest time frame.
#You will need to make adjustments to the various time frames that you trade in. Set the lowest period for the one you use the most, then middle time frame a few up from that and then set the highest time frame accordingly.
#For the Day chart set Day to the lowest, then week for the middle and month for the highest. #
declare upper;
input aggregationPeriodMinute = AggregationPeriod.MIN;
input aggregationPeriodhour = AggregationPeriod.HOUR;
input aggregationPeriodDay = AggregationPeriod.DAY;
input length = 1;
input showOnlyLastPeriod = no;
#Minute Settings
plot PrevMinuteClose; if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriodMinute) [-1]) {PrevMinuteClose = Double.NaN;} else {PrevMinuteClose = Highest(close(period = aggregationPeriodMinute), length);}
PrevMinuteClose.SetLineWeight(5);
PrevMinuteClose.SetDefaultColor(Color.CYAN);
PrevMinuteClose.SetPaintingStrategy(PaintingStrategy.Horizontal);
plot PrevMinuteOpen; if showOnlyLastPeriod and !IsNaN(open(period = aggregationPeriodMinute) [-1]){PrevMinuteOpen = Double.NaN;} else {PrevMinuteOpen = Highest(open(period = aggregationPeriodMinute), length);}
PrevMinuteOpen.SetLineWeight(3);
PrevMinuteOpen.SetDefaultColor(Color.PINK);
PrevMinuteOpen.SetPaintingStrategy(PaintingStrategy.Horizontal);
#Hour Settings
plot PrevHourClose; if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriodhour) [-1])
{PrevHourClose = Double.NaN;} else {PrevHourClose = Highest(close(period = aggregationPeriodhour), length);}
PrevHourClose.SetLineWeight(5);
PrevHourClose.SetDefaultColor(Color.CYAN);
PrevHourClose.SetPaintingStrategy(PaintingStrategy.line);
plot PrevHourOpen; if showOnlyLastPeriod and !IsNaN(open(period = aggregationPeriodhour) [-1])
{PrevHourOpen = Double.NaN;} else {PrevHourOpen = Highest(open(period = aggregationPeriodhour), length);}
PrevHourOpen.SetLineWeight(3);
PrevHourOpen.SetDefaultColor(Color.yellow);
PrevHourOpen.SetPaintingStrategy(PaintingStrategy.line);
#Day Chart
plot PrevDayClose; if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriodDay) [-1])
{PrevDayClose = Double.NaN;} else {PrevDayClose = Highest(close(period = aggregationPeriodDay), length);}
PrevDayClose.SetLineWeight(2);
PrevDayClose.SetDefaultColor(Color.White);
PrevDayClose.SetPaintingStrategy(PaintingStrategy.line);
plot PrevDayOpen; if showOnlyLastPeriod and !IsNaN(open(period = aggregationPeriodhour) [-1])
{PrevDayOpen = Double.NaN;} else {PrevDayOpen = Highest(open(period = aggregationPeriodhour), length);}
PrevDayOpen.SetLineWeight(3);
PrevDayOpen.SetDefaultColor(Color.light_GRAY);
PrevDayOpen.SetPaintingStrategy(PaintingStrategy.line);
#End of Active Price Line