Hide Previous Day S/R Lines – Camarilla Points study


Hi Pete,

TOS – Study, Camarilla Points.

Is there a way to hide the support resistance lines for all previous days on the chart except the current day? My intention is to see the chart little clear with few lines on it.

Thank you,


Marked as spam
Posted by (Questions: 49, Answers: 62)
Asked on September 30, 2019 7:58 am
Private answer

The solution to this one is complicated by the fact it supports the selection of multiple periods. For example the default settings display pivot levels computed from the the last 25 days. I'm not even sure it can be resolved without breaking that portion of the code.

If not for that setting, the solution is relatively simple. But if you are able to select any number of days, weeks or months for computing these levels there is no simple way to have those lines plot only for the most recent span of those periods.

Marked as spam
Posted by (Questions: 37, Answers: 4097)
Answered on September 30, 2019 5:31 pm
I have modified the script as per my requirement. Is it possible to hide it in this script? input aggregationPeriod = AggregationPeriod.DAY; def highValue = high(period = aggregationPeriod)[1]; def lowValue = low(period = aggregationPeriod)[1]; def closeValue = close(period = aggregationPeriod)[1]; def range = highValue – lowValue; plot ProfitTarget2R5 = (highValue / lowValue) * closeValue; plot LBreakOrRBreakoutR4 = closeValue + range * (1.1) / 2; plot GoShortR3 = closeValue + range * (1.1) / 4; plot R2 = closeValue + range * (1.1) / 6; plot R1 = closeValue + range * (1.1) / 12; plot HH = highValue; plot PP = (HIGHValue+ LOWValue + CLOSEValue)/3; plot LL = LOWValue; plot S1 = closeValue – range * (1.1) / 12; plot S2 = closeValue – range * (1.1) / 6; plot GoLongS3 = closeValue – range * (1.1) / 4; plot SupportBreakoutS4 = closeValue – range * (1.1) / 2; plot ProfitTarget2S5 = (closeValue – (ProfitTarget2R5 – closeValue)); ProfitTarget2R5.SetDefaultColor(GetColor(5)); LBreakOrRBreakoutR4.SetDefaultColor(GetColor(5)); GoShortR3.SetDefaultColor(GetColor(5)); R2.SetDefaultColor(GetColor(5)); R1.SetDefaultColor(GetColor(5)); HH.SetDefaultColor(GetColor(4)); PP.SetDefaultColor(GetColor(0)); LL.SetDefaultColor(GetColor(1)); S1.SetDefaultColor(GetColor(6)); S2.SetDefaultColor(GetColor(6)); GoLongS3.SetDefaultColor(GetColor(6)); SupportBreakoutS4.SetDefaultColor(GetColor(6)); ProfitTarget2S5.SetDefaultColor(GetColor(6)); ProfitTarget2R5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); LBreakOrRBreakoutR4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); GoShortR3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); HH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); LL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ProfitTarget2S5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); SupportBreakoutS4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); GoLongS3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); ProfitTarget2R5.SetStyle(Curve.LONG_DASH); LBreakOrRBreakoutR4.SetStyle(Curve.MEDIUM_DASH); GoShortR3.SetStyle(Curve.SHORT_DASH); R2.SetStyle(Curve.LONG_DASH); R1.SetStyle(Curve.MEDIUM_DASH); HH.SetStyle(Curve.SHORT_DASH); PP.SetStyle(Curve.FIRM); LL.SetStyle(Curve.SHORT_DASH); S1.SetStyle(Curve.MEDIUM_DASH); S2.SetStyle(Curve.LONG_DASH); GoLongS3.SetStyle(Curve.SHORT_DASH); SupportBreakoutS4.SetStyle(Curve.MEDIUM_DASH); ProfitTarget2S5.SetStyle(Curve.LONG_DASH);
( at October 1, 2019 12:08 am)

That'a an awful lot of code so I'll just show you how to hide the first plot for everything but the current day. You can update the rest of the code using this technique.

plot ProfitTarget2R5 = if GetDay() == GetLastDay() then (highValue / lowValue) * closeValue else Double.NaN;

( at October 1, 2019 1:13 pm)
I know nothing about coding but I get the ideas from existing studies and mix it and I make it. I appreciate your help. I will do the rest as per your guidance. Thank you.
( at October 1, 2019 6:06 pm)
Pete, is there a short way to do this by setting the condition at the beginning. i want to plot a study of several lines (a lot, only 2 as example here), ONLY IF it is monday. i couldnt figure out how to do it. would u pls help. plot line1; plot line2; plot monday = if GetDayofWeek(GetYYYYMMDD()) 1 ) then { Line1 = 3303.00; Line2 = 3307.00; AddCloud(Line1, Line2, Color.RED, Color.RED); } else double.nan ; thanks a lot
( at July 19, 2020 12:00 pm)
I think it's best of you post that as a new question. Other viewers may be searching for that solution and they would never find it here buried in the comments section of this post.
( at July 19, 2020 1:33 pm)