# add / subtract value of price of the previous day

#### DJC

##### New member
Very new to creating scripts can someone please help me by creating a script that plots the lines below

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.4) then +add that value to close of the previous day

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.4) then -subtract that value from close of the previous day

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.2) then +add that value to close of the previous day

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.2) then -subtract that value from close of the previous day

@BenTen

Last edited by a moderator:
Very new to creating scripts can someone please help me by creating a script that plots the lines below

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.4) then +add that value to close of the previous day

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.4) then -subtract that value from close of the previous day

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.2) then +add that value to close of the previous day

(HIGH OF PREVIOUS DAY - LOW OF PREVIOUS DAY) x (0.2) then -subtract that value from close of the previous day

@BenTen

Try this

Ruby:
``````def priordayhigh = high(period = AggregationPeriod.DAY)[1];
def priordaylow  = low(period = AggregationPeriod.DAY)[1];

plot priordayclose = close(period = AggregationPeriod.DAY)[1];

plot hline1 = priordayclose + (priordayhigh - priordaylow) * .4;
plot hline2 = priordayclose + (priordayhigh - priordaylow) * .2;
plot lline1 = priordayclose - (priordayhigh - priordaylow) * .4;
plot lline2 = priordayclose - (priordayhigh - priordaylow) * .2;``````

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
306 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• 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?