Thanks for the reply halcyonguy. That is pretty much what I'm asking. Just to clarify, that holds true for when it is Sunday. However, once it becomes Monday, the plotted lines would reset to plot horizontal levels (for high/low/POC) up to the second previous Sunday, and as a new day begins, the previous day is added. So for example, if today is Monday, it would plot levels from the second previous Sunday (In total, would include 8 days (excluding saturday and including the two sundays & current Monday). Similarly, if it is now Tuesday, then it would plot levels up to 9 days and so on and so forth.
I really appreciate your time and help with my query, so I thank you very much. Truly.
I've gone and tried to code what I meant to do above by using your code as a template. However, I'm stuck in a position where if I want to only plot the current day, it lets me, but when I try to bundle it with plotting the previous days, not only does it not show the POCs of the previous days, but it plots the POC line for each previous day as 1.
For example, in the code below, I start with Monday and attempt to plot the previous days POC up to the second Sunday. If I keep
Code:
plot MondayPoc = if TodayIsMonday then TodayMondayPOC else na;
then it correctly plots all Monday POCs in the timeframe. However, if I keep
Code:
plot MondayPoc = if TodayIsMonday then TodayMondayPOC and TodayIsMonSun and TodayisMonFri and TodayisMonThurs and TodayisMonWed and TodayisMonTues and TodayisMonMon and TodayisMonSunSun else na;
,
it plots all Monday POCs as 1 and does not plot any of the previous days POC.
Here's the code; please bare with me, I'm very new to thinkscript and have been trying my best.
Code:
def yyyymmdd = GetYYYYMMDD();
def na = Double.Nan;
#Getting POC
def RTHBegin = 930;
def RTHEnd = 1600;
def RTH = SecondsFromTime(RthBegin) >= 0 and SecondsTillTime(RthEnd) >= 0;
def cond2 = RTH != RTH[1];
profile tpo = TimeProfile("PricePerRow" = PricePerRow.Ticksize, "startNewProfile" = cond2, "onExpansion" = no);
#Defining Days of Week (credit to Mobius)
def DOW2 = getdayOfWeek(getYYYYMMDD());
def Mon = if DOW2 == 1 then 1 else 0;
def Tues = if DOW2 == 2 then 1 else 0;
def Wed = if DOW2 == 3 then 1 else 0;
def Thurs = if DOW2 == 4 then 1 else 0;
def Fri = if DOW2 == 5 then 1 else 0;
def Sat = if DOW2 == 6 then 1 else 0;
def Sun = if DOW2 == 7 then 1 else 0;
def TodayIsMonday = Mon;
def TodayMondayPoc = tpo.GetPointofControl(); #GetMondaysPOC.
def TodayIsMonSun = TodayMondayPoc[1]; #This should be prev Sunday's POC.
def TodayIsMonFri = TodayIsMonSun[1]; #This should be prev Friday's POC.
def TodayIsMonThurs = TodayIsMonFri[1]; #This should be prev Thursday's POC.
def TodayIsMonWed = TodayIsMonThurs[1]; #This should be prev Wednesday's POC.
def TodayisMonTues = TodayIsMonWed[1]; #This should be prev Tuesday's POC.
def TodayisMonMon = TodayIsMonTues[1]; #This should be prev Monday's POC.
def TodayisMonSunSun = TodayIsMonMon[1]; #And lastly, this should be the second prev Sunday's POC.
#plot MondayPoc = if TodayIsMonday then TodayMondayPOC else na; #This only plots Monday's POC.
plot MondayPoc = if TodayIsMonday then TodayMondayPOC and TodayIsMonSun and TodayisMonFri and TodayisMonThurs and TodayisMonWed and TodayisMonTues and TodayisMonMon and TodayisMonSunSun else na; #This should be plotting the POCs of Monday all the way to the second previous sunday.
mondayPoc.SetPaintingStrategy(PaintingStrategy.Horizontal);
mondayPoc.SetDefaultColor(Color.Orange);