TradingView
twingall
20 mars 2023 21:33

Pre-market Highs & Lows on regular trading hours (RTH) chart 

E-mini S&P 500 Futures (Jun 2023)CME

Description

Shows pre-market highs and lows on RTH or ETH chart

-Pre-market duration user input (default is 16 'bar hours'; covering the time from S&P RTH close at 4pm >> 9:30am RTH open next day
-Displays on both RTH and ETH charts
-Written for ES (ES1! or e.g ESM2023), but tested and working on SPY, SPX
-Works across timeframes


Example usage on Electronic trading hours (ETH) chart; showing the 'bar hours' user input lookback duration visually

Notes de version

-Added realtime plotting of out-of-hours highest/lowest as price progresses through the overnight session. Lines move on 'static' RTH chart too. This will dissappear and be replaced with the original lines as we enter the opening bell.
-Really this indicator is designed / working properly only on ES, NQ, YM (i.e. ES1!, ESM2023 etc etc). Not printing correctly on SPY due to extended session time quirks.
-I'm planning to release a much simpler realtime version, current day only, versatile across all all variants of S&P 500.

Notes de version

-fixed code: needed to use request.security_lower_tf() to fetch price data from ETH feed while on RTH chart during extended hours (request.security() would not work)

Notes de version

-Note on the above update: due to pinescript execution model (execute on a new bar), when viewing on RTH static chart overnight, only way to retrieve ETH up-to-date levels is to refresh the page.

Notes de version

-added day/date on price labels (optional togggle on/off)
-added option to print all labels at last bar index + user input offset right
Note: all this is designed for use with multiple day's lines, to avoid confusion about line origins. See the new toggle box / input options at the bottom of the formatting section

Notes de version

-simplified time format function.
-please note the timezone is set to "America/New_York"

Notes de version

-high line / low line color options

Notes de version

-Added two Alerts condtions:
#1: price crossing over the last pre-market high.
#2: price crossing under the last pre-market low.
-Potentially useful in seeking turtle soup trades (false breakouts). To be used in combo with other factors obviously.
-To set alerts: click the three dots on the indicator display/title line >> add alert; then choose the various options.

Notes de version

-Fixed to work properly across various markets: SPY, Futures Indices (e.g. ES1!) and Stocks
-Added Extend choices for previous lines (extend to last bar index or not). Choices: #1 Previous only, #2 All, #3 None
Commentaires
HoangCung
Thank you!
CryptoZeeKay
great work! I liked it

Very intuitive way of coding it. It works on ETH as well as RTH equally good.
ssoninv
can I increase a limit for previous sessions to show? It seems like I can't go further than 1 month
twingall
@ssoninv, probably it's fixed by increasing the lines/labels/boxes count to the max:
indicator("Pre-market Highs & Lows on RTH chart", overlay = true, max_bars_back = 2000, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500)
ssoninv
@twingall, it works perfectly now. Thank you!
PDIFM
Hi, thanks a lot. I like your job. I'd be happy if I could add an alarm to it.
twingall
@PDIFM, Done: two alerts added, see update
PDIFM
@twingall, wow, service 5 stars. I paid you a coffee.
I tried myself and I had the issue "An argument of 'series line' type was used but a 'series float' is expected", I know it but it would have taken much time to figure out.
twingall
@PDIFM, Ah many thanks! Cheers, lemme know if any issues this week with it (can't test at w/e), but should be good. All, best T
ronniebrasco33907
Can you make the lines say premarket high and premarket low? or have something to differentiate the two lines. Helps out when you are monitoring multiple screens and can get a glance what is crossing over what.
Plus