Could someone create an indicator for TOS that plots the previous day POC/High/Low/Close/DayMid (Middle of the Day) on a tick chart with the option of selecting and plotting it as an expansion on the chart if needed? Thanks in advance.
Ruby:input daysback = 1; input showonexpansion = no; def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount) ; def poc = if thisDay == daysback then reference VolumeProfile("price per...
Could someone create an indicator for TOS that plots the previous day POC/High/Low/Close/DayMid (Middle of the Day) on a tick chart with the option of selecting and plotting it as an expansion on the chart if needed? Thanks in advance.
Ruby:input daysback = 1; input showonexpansion = no; def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount) ; def poc = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else poc[1]; def phigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1]; def plow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1]; def popen = if thisday == daysback then open(period=aggregationPeriod.DAY) else popen[1]; plot poc1 = if showonexpansion and !isnan(close) or thisDay > daysback then Double.NaN else poc; plot high1 = if showonexpansion and !isnan(close) or thisDay > daysback then Double.NaN else phigh; plot low1 = if showonexpansion and !isnan(close) or thisDay > daysback then Double.NaN else plow; plot open1 = if showonexpansion and !isnan(close) or thisday > daysback then double.nan else popen; plot mid1 = if showonexpansion and !isnan(close) or thisDay > daysback then Double.NaN else (phigh + plow) / 2; poc1.setdefaultColor(color.cyan); high1.setdefaultColor(color.yellow); low1.setdefaultColor(color.yellow); open1.setdefaultColor(color.magenta); mid1.setdefaultColor(color.yellow); input bubblemover = 5; def b = bubblemover; def b1 = b + 1; input showbubbles = yes; addchartBubble(showbubbles and isnan(close[b]) and !isnan(close[b1]), poc1[b], "POC-" + daysback, poc1.takevalueColor()); addchartBubble(showbubbles and isnan(close[b]) and !isnan(close[b1]), high1[b], "H-" + daysback, high1.takevalueColor()); addchartBubble(showbubbles and isnan(close[b]) and !isnan(close[b1]), low1[b], "L-" + daysback, low1.takevalueColor()); addchartBubble(showbubbles and isnan(close[b]) and !isnan(close[b1]), open1[b], "O-" + daysback, open1.takevalueColor()); addchartBubble(showbubbles and isnan(close[b]) and !isnan(close[b1]), mid1[b], "M-" + daysback, mid1.takevalueColor());
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Here is the volumeprofile indicator added to the chart. It shows the poc for 1 day ago at the level the code produced. It shows that the 4119.50 level was from 2 days ago.Thanks for the quick response. This is awesome! I meant to have the previous day close but I don't mind having the previous day open. One other thing. Can you backtest this indicator and see if the previous day poc plotting and calculation is correct? Because for some reason it's not plotting the correct information on my chart. Maybe I am doing something wrong but as you see on the shared link image, my previous day poc shows price at around 4119.50 but the indicator you have provided shows price at 4149.63. Can this be corrected?
Oh! and this is a trading session for today Thursday June 9th.
Thanks again.
My apologies. You are absolutely right. I was looking at the 30mns chart which is plotting a different value. Will it be possible to add time sessions so the indicator can plot the previous poc based on the 30mns as well?
Ruby:input daysback = 1; input daysback_poc = 2; input showonexpansion = no; def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount) ; def poc = if thisDay == daysback_poc then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else poc[1]; def phigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1]; def plow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1]; def pclose = if thisDay == daysback then close(period = AggregationPeriod.DAY) else pclose[1]; plot poc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else poc; plot high1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else phigh; plot low1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else plow; plot close1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else pclose; plot mid1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else (phigh + plow) / 2; poc1.SetDefaultColor(Color.CYAN); high1.SetDefaultColor(Color.YELLOW); low1.SetDefaultColor(Color.YELLOW); close1.SetDefaultColor(Color.MAGENTA); mid1.SetDefaultColor(Color.YELLOW); input bubblemover = 5; def b = bubblemover; def b1 = b + 1; input showbubbles = yes; AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), poc1[b], "POC-" + daysback, poc1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), high1[b], "H-" + daysback, high1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), low1[b], "L-" + daysback, low1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), close1[b], "C-" + daysback, close1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mid1[b], "M-" + daysback, mid1.TakeValueColor());
Thank you for clarifying this by explaining you're using the 30mns chart. I am clear on that, and I need these exact results to be plotted and work to a 2000 tick chart that I use for trading. Do you think this a possible scenario?
I believe I did not explain my self correctly but this time I have attached and image for your reference. I am using a 30mns chart on the left and a 2000 tick chart on the right. What I would like to have is.. the poc value result shown on the 30mns chart to be plotted on the 2000 tick chart. In other words, I need the previous day poc shown on the 30mns chart as "4119.53" to be plotted on the 2000 tick chart which is currently showing "4149.63".
Today's open addedOne last favor. Could you add the daily open (not the previous day open) with the expansion feature to this script? Thanks in advance!
Ruby:input daysback = 1; input daysback_poc = 1; input showonexpansion = no; def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount) ; def poc = if thisDay == daysback_poc then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else poc[1]; def phigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1]; def plow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1]; def pclose = if thisDay == daysback then close(period = AggregationPeriod.DAY) else pclose[1]; def dopen = if thisDay == 0 then open(period = AggregationPeriod.DAY) else dopen[1]; plot poc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else poc; plot high1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else phigh; plot low1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else plow; plot close1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else pclose; plot mid1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else (phigh + plow) / 2; plot open0 = if showonexpansion and !IsNaN(close) or thisDay > 0 then Double.NaN else dopen; poc1.SetDefaultColor(Color.CYAN); high1.SetDefaultColor(Color.YELLOW); low1.SetDefaultColor(Color.YELLOW); close1.SetDefaultColor(Color.MAGENTA); mid1.SetDefaultColor(Color.YELLOW); open0.SetDefaultColor(Color.WHITE); input bubblemover = 5; def b = bubblemover; def b1 = b + 1; input showbubbles = yes; AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), poc1[b], "POC-" + daysback_poc, poc1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), high1[b], "H-" + daysback, high1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), low1[b], "L-" + daysback, low1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), close1[b], "C-" + daysback, close1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mid1[b], "M-" + daysback, mid1.TakeValueColor()); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), open0[b], "O-" + 0, open0.TakeValueColor()); # #
Hi,
Can someone help and adjust the price line script so the indicator can plot the close@price only for the last candle? Thank you.
plot Data = if IsNaN(close[-1]) then close else Double.NaN;
Data.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
Here is the last bar with 2 versions of close. The white dot (standard points) seems to follow the 'priceline' close whether with regular candles or heikin ashi candles. The magenta dot (boolean points @ close) only seems to follow the close when regular candles are being used.Hi SleepeZ!
I actually need this indicator to plot the value as boolean and draw as close@price that reflects only on the last candle (white dots in image) and none on the previous candles so I can keep a clean chart. Will this be possible?
Ruby:plot Data = if IsNaN(close[-1]) then close else Double.NaN; data.setPaintingStrategy(paintingStrategy.POINTS); data.setdefaultColor(color.white); data.setlineWeight(5); plot Data1 = if IsNaN(close[-1]) then close else Double.NaN; data1.setpaintingStrategy(paintingStrategy.BOOLEAN_POINTS); data1.setdefaultColor(color.magenta); data1.setlineWeight(5);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | Automatically plotted Horizontal Lines from VPOC (previous Point of Control) | Questions | 18 | |
M | Anchored VWAP Premarket previous days | Questions | 1 | |
S | Price Levels based on Time for Previous Day+ Current Day (EST) | Questions | 1 | |
S | distance from previous x bar's high/low | Questions | 4 | |
G | Help finding previous peaks | Questions | 2 |
Start a new thread and receive assistance from our community.
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.
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.