Help with line extension

SJP07

Member
This seems simple enough to work, but for some reason, it doesn't show up on the lower time frames [1-5 min]. Nor does it extend into the day.
I'd like it to extend from the beginning of the week to the end.

Code:
def Last_Week_Close =  close(period = "week" )[1];
def This_Week_open =  open(period = "week" );


plot PWeek_Close = Last_Week_Close;
plot CWeek_Open = This_Week_open;


PWeek_Close.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PWeek_Close.SetDefaultColor(Color.UPTICK);
PWeek_Close.SetLineWeight(1);

CWeek_Open.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
CWeek_Open.SetDefaultColor(Color.DOWNTICK);
CWeek_Open.SetLineWeight(1);
 
Last edited by a moderator:
Solution
A little broken during RTH:
Xncpiln.png


Try this instead and make sure you have the last day of the prior week on chart:
7wdf9dW.png

Ruby:
def Last_Week_Close =  close(period = "week" )[1];
def This_Week_open =  open(period = "week" );


plot PWeek_Close = if !isnan(close) then Last_Week_Close else double.nan;
plot CWeek_Open = if !isnan(close) then This_Week_open else double.nan;

def PWeek_Close_Ext = if !isnan(close[-1]) then double.nan else if isnan(close[-1]) and
    !isnan(close[0]) then PWeek_Close[1] else PWeek_Close_Ext[1];
def CWeek_Open_Ext = if !isnan(close[-1]) then double.nan else if isnan(close[-1]) and
    !isnan(close[0]) then CWeek_Open[1] else CWeek_Open_Ext[1];

plot PWeek_Close_Ext_Plot = PWeek_Close_Ext;
plot...

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

A little broken during RTH:
Xncpiln.png


Try this instead and make sure you have the last day of the prior week on chart:
7wdf9dW.png

Ruby:
def Last_Week_Close =  close(period = "week" )[1];
def This_Week_open =  open(period = "week" );


plot PWeek_Close = if !isnan(close) then Last_Week_Close else double.nan;
plot CWeek_Open = if !isnan(close) then This_Week_open else double.nan;

def PWeek_Close_Ext = if !isnan(close[-1]) then double.nan else if isnan(close[-1]) and
    !isnan(close[0]) then PWeek_Close[1] else PWeek_Close_Ext[1];
def CWeek_Open_Ext = if !isnan(close[-1]) then double.nan else if isnan(close[-1]) and
    !isnan(close[0]) then CWeek_Open[1] else CWeek_Open_Ext[1];

plot PWeek_Close_Ext_Plot = PWeek_Close_Ext;
plot CWeek_Open_Ext_Plot = CWeek_Open_Ext;

PWeek_Close.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PWeek_Close.SetDefaultColor(Color.UPTICK);
PWeek_Close.SetLineWeight(1);

CWeek_Open.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
CWeek_Open.SetDefaultColor(Color.DOWNTICK);
CWeek_Open.SetLineWeight(1);

PWeek_Close_Ext_Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PWeek_Close_Ext_Plot.SetDefaultColor(Color.UPTICK);
PWeek_Close_Ext_Plot.SetLineWeight(1);

CWeek_Open_Ext_Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
CWeek_Open_Ext_Plot.SetDefaultColor(Color.DOWNTICK);
CWeek_Open_Ext_Plot.SetLineWeight(1);
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
450 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top