@RoachStock Here goes the code to make the line straight regardless of the day you entered, this will draw a plot for a straight horizontal line at the average price you entered.
@RoachStock Here goes the code to make the line straight regardless of the day you entered, this will draw a plot for a straight horizontal line at the average price you entered.
is there any indicator or anyway in TOS that when i purchase an option contract at lets say 0.50 (stock is at $100) that it can place a mark on the main chart showing me where i entered and possible sl or is that asking too much of this software
Or, if you have Chart Settings > General >Show Tradeschecked then your chart will show all active orders for that symbol...
However, both this method and the one provided by @Mark1126 can only display trades for the actual symbol, not an Option trade on an underlying Stocks chart... TOS does not have such a feature...
I use a trading Chart Grid, which I have posted images of several times, that has the underlying Stock chart on the left and the Option chart above Active Trader on the right... This gets around the problem and gives me a good overall feel for the trade...
Is it possible to have a line on the chart that shows your current average price in a position in a trade? Kinda like this horizontal line, but it appears after you take a position and updates every time your avg price per share changes (if you buy/sell more shares).
Code:
# Dynamic Line
# zzz
# 11.18.2015
# Plots a horizontal line beginning on the closing value x number of bars ago
# Set Detrend to the number of bars ago you want to begin drawing the line
# Add code to plot a continuous price line into the right expansion area by
# the specified number of bars
#
# This version is actually simpler and works better than the previous version
# as it would not work if you chose detrend (unlikely choice). If "linefrom"
# is a negative number, it will plot back into the chart bars; if you use a
# positive number, it will plot only in the expansion area.
input linefrom = -60;#Hint linefrom: negative numbers plot in candle area, positive in expansion
input lineto = 60;#Hint lineto: limits how far into expansion the line will plot
input detrend = 0;#Hint detrend: usually zero. if you want a prior period, then enter a positive number
input price = close;
def lastbar = if IsNaN(close[-1]) and !IsNaN(close)
then BarNumber()
else lastbar[1];
def c = HighestAll(if IsNaN(close[-1]) and !IsNaN(close)
then price[detrend]
else Double.NaN);
plot Data = if BarNumber() >= highestall(lastbar + linefrom) and
BarNumber() <= highestall(lastbar + lineto)
then c
else Double.NaN;
# End Study
I don't want the horizontal line to show what it is showing now, I just need it to draw the horizontal line for GetAveragePrice(); but I am not sure what to remove and where to add GetAveragePrice();
I have also tried this, but still, no line is being drawn for the average price. Is that weird?
Is it possible to have a line on the chart that shows your current average price in a position in a trade? Kinda like this horizontal line, but it appears after you take a position and updates every time your avg price per share changes (if you buy/sell more shares).
Is it possible to have a line on the chart that shows your current average price in a position in a trade? Kinda like this horizontal line, but it appears after you take a position and updates every time your avg price per share changes (if you buy/sell more shares).
Code:
# Dynamic Line
# zzz
# 11.18.2015
# Plots a horizontal line beginning on the closing value x number of bars ago
# Set Detrend to the number of bars ago you want to begin drawing the line
# Add code to plot a continuous price line into the right expansion area by
# the specified number of bars
#
# This version is actually simpler and works better than the previous version
# as it would not work if you chose detrend (unlikely choice). If "linefrom"
# is a negative number, it will plot back into the chart bars; if you use a
# positive number, it will plot only in the expansion area.
input linefrom = -60;#Hint linefrom: negative numbers plot in candle area, positive in expansion
input lineto = 60;#Hint lineto: limits how far into expansion the line will plot
input detrend = 0;#Hint detrend: usually zero. if you want a prior period, then enter a positive number
input price = close;
def lastbar = if IsNaN(close[-1]) and !IsNaN(close)
then BarNumber()
else lastbar[1];
def c = HighestAll(if IsNaN(close[-1]) and !IsNaN(close)
then price[detrend]
else Double.NaN);
plot Data = if BarNumber() >= highestall(lastbar + linefrom) and
BarNumber() <= highestall(lastbar + lineto)
then c
else Double.NaN;
# End Study
I don't want the horizontal line to show what it is showing now, I just need it to draw the horizontal line for GetAveragePrice(); but I am not sure what to remove and where to add GetAveragePrice();
I have also tried this, but still, no line is being drawn for the average price. Is that weird?
Did you ever figure out a way to do this??? I would like the horizontal price level to show my current average position and extend forever to the right. Appear upon entry. Disappear upon exiting the position.
Any help here would be greatly appreciated!
Thanks!
I've found a few other posts that shared script code for similar things, but I'm wanting a horizontal price level to show my current average position and extend forever to the right. Appear upon entry. Adjust to my average as I add to my position. Disappear upon exiting the position.
Any help here would be extremely appreciated! Thanks!!
@RoachStock Here goes the code to make the line straight regardless of the day you entered, this will draw a plot for a straight horizontal line at the average price you entered.
It plots and shows on my Daily time frame chart, but doesn't show on my weekly or monthly chart. Is this something that can be adjusted to work on a weekly or monthly, or does the GetAveragePrice() not work on those chart periods?
UPDATED: found my answer
You can't display it. According to the Release Note July 9 2016:
"As of now, the data is available for non-custom time based charts that have an aggregation of Daily or less"
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.
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.