An Indicator that lets you set a budget & the amount of profit that you want to take. It draws a horizontal line at where you want to get out.

Mr_Wheeler

Active member
aryxDaf.png



XbK9328.png


I created this study to set down to earth price targets.
  • Study A - https://tos.mx/R3kdeTW
  • Study B - https://tos.mx/lG0LJfF Another study, the light blue lines which currently represent a half of a percent price move, and the current price. Since many of you are likely to ask for It I've included it, not that I mind.

I'm in the process of adding other features, I'll update this post with an updated study/indicator as I add them. I'm looking for a way to auto set Study A to enable the left Axis as that's the only way it display's correctly. One of the features I plan to add is multiple price target lines.
 

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

I'm seem to be having trouble combining these two sets of code.



Code:
# Simple Position Calculator
# Assembled by BenTen at UseThinkScript.com

input Budget = 3000;
input current_price = close;
def Share_Quantity_purchase_limit =  Budget / current_price ;
AddLabel(yes, Concat("Shares available for purchase = ", Round(Share_Quantity_purchase_limit)), Color.ORANGE);

###############################################################################################

input profit_goal = 100;
plot Trend_line =  profit_goal / Share_Quantity_purchase_limit  ;
Trend_line.SetDefaultColor(GetColor(0));
#####################################################################

#code found here - https://usethinkscript.com/threads/current-price-line-indicator-for-thinkorswim.614/post-8400
def profit_take_line_1 = Trend_line;
input offset = 0;
def sma = Trend_line;
rec line = if IsNaN(sma) then line[1] else sma[offset];

                       
plot Goal = if IsNaN(sma) then line else Double.NaN;
Goal.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Goal.SetLineWeight(1);
Goal.SetDefaultColor(Color.orange);
Goal.HideBubble();

###00000000000000000000000000000000###########

Code:
input price = close;
input percentoffset = 4.0;
input lineLength = -1;

def lastBar = !IsNaN(close) && IsNaN(close[-1]);
def lastClose = if lastBar then close else lastClose[1];

plot level_line = if IsNaN(close[-lineLength-1]) then lastClose[-lineLength] else Double.NaN;
level_line.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
level_line.SetDefaultColor(Color.white);
level_line.hideBubble();

def above_price = level_line + (percentoffset/100 * level_line);
def below_price = level_line - (percentoffset/100 * level_line);

plot above_line = above_price;
     #above_line.setdefaultcolor(color.white);
     #above_line.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


The first batch of code uses code from the 2nd code batch which was part of a study I found on the forum, I've reduced it to troubleshoot the 1st batch. What I'm trying to do is to use code from the 2nd batch to draw a horizontal line at the price level. It would enable you to see the current price, and how big of a climb a stock would have to make to reach your profit goal that's displayed with a 2nd horizontal line.
 
The first batch of code uses code from the 2nd code batch which was part of a study I found on the forum, I've reduced it to troubleshoot the 1st batch. What I'm trying to do is to use code from the 2nd batch to draw a horizontal line at the price level. It would enable you to see the current price, and how big of a climb a stock would have to make to reach your profit goal that's displayed with a 2nd horizontal line.
No one was able to combine these for you. :( The only workaround available currently is to load both on your chart for a visual representation of the difference between goal and price.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
366 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