Previous Day High/Low/Close For ThinkOrSwim

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

"Mark Fishers Sushi Roll Reversal "
Never heard of that one.:unsure:
He defines it as a period of 10 bars where the first five (inside bars) are confined within a narrow range of highs and lows and the second five (outside bars) engulf the first with both a higher high and lower low. (The pattern is similar to a bearish or bullish engulfing pattern except that instead of a pattern of two single bars, it is composed of multiple bars.) In his example, Fisher uses 10-minute bars.


When the sushi roll pattern shows up in a downtrend, it warns of a possible trend reversal, showing that it’s a good time to look to buy or at the very least, exit a short position. If it occurs during an uptrend, the trader gets ready to sell. While Fisher discusses five-bar patterns, the number or duration of bars is not set in stone. The trick is to identify a pattern consisting of the number of both inside and outside bars that are the best fit with the chosen stock or commodity using a time frame that matches the overall desired time in the trade.
 
Looking for thinkscript code that can return/plot the OHLC for a user-configurable group of days on an hourly chart (the period) for a user-configurable max number of days (the lookback).

Example: assume the user sets lookback equal to 12; this means that only today plus the 11 prior days are to be considered in the output. Assume the user sets the period to 3; this means that all days in the lookback period should be broken into groups of 3 days, starting the count at the oldest/first day. Each period will have plots of the OHLC from the prior period. See this example:

IwO3S0s.png


Higher time-frame aggregations cannot be used as the script will be used in hourly scans and other time frames are not allowed in TOS. Willing to pay via paypal. Thanks!
 
This is an interesting way of doing it. I usually have mine right on the current day. Having it on expansion makes the chart cleaner.
 
@Swingtrade You can use the script below for that.

Code:
# Previous HLC as Labels
# Assembled by BenTen at UseThinkScript.com

input aggregationPeriod = AggregationPeriod.DAY;
def close = close(period = aggregationPeriod)[1];
def high = high(period = aggregationPeriod)[1];
def low = low(period = aggregationPeriod)[1];

AddLabel(yes, Concat("Prev Close = ", close), color.orange);
AddLabel(yes, Concat("Prev High = ", high), color.orange);
AddLabel(yes, Concat("Prev Low = ", low), color.orange);
 
Hi, I like the indicator on the chart expansion. I also like the text above the indicator lines. Is there a way to add the text as a feature of the study?
Thanks, Gary
 
Hi, I like the indicator on the chart expansion. I also like the text above the indicator lines. Is there a way to add the text as a feature of the study?
Thanks, Gary
sorry the text in the image was manually added, but I added chart bubbles to the script for you and they can be toggled on or off in the study settings:
Code:
#[email protected]
def NA = Double.NaN;

input agg = AggregationPeriod.DAY;

input showOnlyLastPeriod = no;
input showBubbles = yes;
input showValuesInBubbles = yes;
input spaceBetween = 1;
plot currentOpen;
plot prevDayClose;
plot prevDayLow;
plot prevDayHigh;
def exp = IsNaN(close[spaceBetween]);

currentOpen = if exp then open("period"=agg) else NA;
prevDayClose = if exp then close("period"=agg)[1] else NA;
prevDayLow = if exp then low("period"=agg)[1] else NA;
prevDayHigh = if exp then high("period"=agg)[1] else NA;

AddChartBubble(showBubbles, if IsNaN(currentOpen[1]) and !IsNaN(currentOpen) then currentOpen else NA, if showValuesInBubbles then "CurrOpen $"+currentOpen else "CurrOpen", Color.WHITE, yes);
AddChartBubble(showBubbles, if IsNaN(prevDayClose[1]) and !IsNaN(prevDayClose) then prevDayClose else NA, if showValuesInBubbles then "PrevClose $"+prevDayClose else "PrevClose", Color.YELLOW, yes);
AddChartBubble(showBubbles, if IsNaN(prevDayLow[1]) and !IsNaN(prevDayLow) then prevDayLow else NA, if showValuesInBubbles then "PrevLow $"+prevDayLow else "PrevLow", Color.RED, yes);
AddChartBubble(showBubbles, if IsNaN(prevDayHigh[1]) and !IsNaN(prevDayHigh) then prevDayHigh else NA, if showValuesInBubbles then "PrevHigh $"+prevDayHigh else "PrevHigh", Color.GREEN, yes);

currentOpen.SetDefaultColor(Color.WHITE);
prevDayLow.SetDefaultColor(Color.RED);
prevDayHigh.SetDefaultColor(Color.GREEN);
prevDayClose.SetDefaultColor(Color.YELLOW);
currentOpen.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevDayLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevDayHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
prevDayClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
Last edited:
Hi Can anyone help with building a code for this:
Previous Day High - Low/4 = ANS
ANS+ NEXT DAY OPEN PRICE = BUY
ANS-NEXT DAY OPEN PRICE = SELL
( I'm looking for a green line to appear on a 1 day 5-minute chart for the BUY and a red line to show up on chart if SELL) Is this possible?
 
Yes! But the red and green line should appear on the new day. Not an ORB system, but something else. Ben, it is a breakout system that uses the previous day's high and low....then it uses the next day's open to create the red and green line which is the ANS. Ben, it is based on this strategy in this video.

 
Last edited by a moderator:
@andre.muhammad Here you go:

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod)[1];
def low = low(period = aggregationPeriod)[1];
def ANS = (high - low) / 4;

plot buy = ANS + open;
plot sell = ANS - open;
 
I see a blue line (Is this the bullish level?) I was hoping it would also have a bearish level... Which should be BEARISH LEVEL = ANS - Today's Open
 
@andre.muhammad Yes it's there. I followed the formula you provided. If anything, you need to check on the formula and see if you provided the correct one.
 
@andre.muhammad Take a look at your original request. The formula you provided was:

Previous Day High - Low/4 = ANS
ANS+ NEXT DAY OPEN PRICE = BUY
ANS-NEXT DAY OPEN PRICE = SELL

Anyhow, here is the updated code:

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod)[1];
def low = low(period = aggregationPeriod)[1];
def ANS = (high - low) / 4;

plot buy = open + ANS;
plot sell = open - ANS;
 
Hello,

I am looking for an indicator to plot lines of the prior day OHLC on the 5 minute chart. I found a few of them here, however, they show different values for futures and stocks and I have to manually change the "Prior Days Ago" from 1 > 2 to work on futures, and 1 for stocks. Is there any other way to do this to have 1 study working for all instruments?
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
382 Online
Create Post

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