The main purpose of this indicator is to facilitate backtesting, but it may also be useful for traders to easily identify the current active/open trading sessions on lower-timeframe charts.
This indicator also tracks the session high/low difference and plots it as a label on the last candle of the session once the last bar of that session has finished printing and a new candle opened. The position and direction of the label is based on the session open and close - if the session open is greater than the session close (which would equate to the equivalent of a red candle), the label will be printed UNDER the last candle, and vice versa if the session close is above the session open.
The number printed inside the label is the difference between the session high and the session low, scaled to the minimum tick value of the chart.
Note #1: There is a Pinescript maximum of 500 labels allowed on any chart. While I could have gotten fancy and done some wizardry with label arrays, I didn't really see a point to it. If labels are enabled for all 4 sessions at the same time, that would still have them available for the past 125 sessions, which would be about 6 months (approx 252 trading days per year, and this would cover 125 of them). If you limit to 2 sessions, you double your potential look-back to almost a year (250 days out of the 252 average trading days each year), and for a single session, you double it yet again to just under 2 years.
Note #2: As this indicator tracks open, high, low, and close for each session, it can potentially be enhanced (or forked) to construct "session candles". I'm not sure what use this would be to anyone, but the pieces are there should someone find a use for it.
While it would be easy to add alerts on sessions opening/closing, I didn't see a purpose or value in that as it would be little more than a glorified alarm clock. If I get enough demand to add them, I will gladly consider it.
Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.