Plot monthly and weekly open on intraday chart


Category:
0
0

Is it possible to plot 2 lines with these specs?  One that will plot from the monthly open and extend to the right until the next month starts.  And a second line that will show the weekly open and extend to the right until the next week starts.

RESOLVED
Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on June 18, 2018 10:06 am
124 views
0
Private answer

Sure thing. The quick answer is:

plot monthlyOpen = open(period = AggregationPeriod.MONTH);
plot weeklyOpen = open(period = AggregationPeriod.WEEK);

If you wanted to make things a bit more flexible and provide a cleaner look:

input timeFrameOne = AggregationPeriod.WEEK;
input timeFrameTwo = AggregationPeriod.MONTH;
plot openTF1 = open(period = timeFrameOne);
openTF1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot openTF2 = open(period = timeFrameTwo);
openTF2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

 

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on June 18, 2018 10:35 am
0

Pete, thanks that’s exactly what I was looking for.

( at June 18, 2018 10:56 am)
0

Can you expand on this to allow it to only show the last week’s/month?

( at June 19, 2018 12:01 pm)
0

input timeFrameOne = AggregationPeriod.WEEK;
input timeFrameTwo = AggregationPeriod.MONTH;
plot openTF1 = if IsNaN(close(period = timeFrameOne)[-1]) then open(period = timeFrameOne) else Double.NaN;
openTF1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot openTF2 = if IsNaN(close(period = timeFrameTwo)[-1]) then open(period = timeFrameTwo) else Double.NaN;
openTF2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

( at June 19, 2018 12:13 pm)