Plot Highest High and Possible Entry using ATR


I am attempting to create a strategy similar to one I saw on youtube (open source). It plots the most recent HH (resets after x bars (say 10) to most recent HH and a possible Entry Price (= L (of the candle w/HH) – 2 * ATR20). I also want to add an UpArrow when a candle closes below the plotted Entry Price (a ‘buy’ signal); a DownArrow (‘sell’) when the close of a subsequent (after buy signal) candle closes above the previous x (ex 2) candles.  I’m new to this and so far I’ve coded the HH only.

The attached image shows the HH plotted and displays a horizontal yellow line at the Entry Price based on the L of the candle with the HH.

Pete – with all the great script you have archived, I’m thinking something close exists and you can maybe point me in the right direction? Thank you.

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on April 11, 2021 1:57 pm
Private answer

Since you are asking about plotting something on the chart and mentioned a chart strategy I moved your question out of the "Stock Scanners" topic and into the "Strategy Guide" topic.

What you have described along with what you have provided in your screenshot seems to be the built-in chart strategy named Donchian. This is already included with Thinkorswim and includes adjustable parameters to change how many bars back the code looks for highest highs and lowest lows.

Screenshot below shows the standard Donchain chart strategy with default settings added to a daily chart of AAPL. Notice my screenshot includes the full view of the chart which provide much more details then the screenshot you provided. In the future, please make sure your screenshots include the entire chart.

Marked as spam
Posted by (Questions: 39, Answers: 3713)
Answered on April 11, 2021 2:39 pm
Thanks for the help Pete! This is very close to what I wanted. I would like the Low plot to be plotted when the price hits a new high; the low bar value is the Low of that same bar - 2*ATR. Can you suggest a tweak to the existing Donchain code (or independently)?
( at April 14, 2021 5:10 pm)
Sorry but I don't believe I can provide the specific solution you are searching for within the brief 15 minutes I allocate to each free solution I provide in the Q&A Forum.
( at April 14, 2021 7:26 pm)