OPEN-SOURCE SCRIPT

Session High Low 2024

https://www.tradingview.com/x/oQ8qVUnU/

Overview of the Code:
Input for Session Times:

You set up inputs for the start and end times of the trading session, allowing you to customize them as needed.

Time Range Function:
A function isTimeInRange checks whether the current time falls within the specified session start and end times.

initialize High and Low:
indicator initialize session high, low, and their corresponding labels and lines.

Tracking Session High and Low:
Within the specified time range, continuously update session1High and session1Low based on the highest and lowest prices encountered.

Time of Session High/Low:
The High_Time and Low_Time are tracked using the ta.valuewhen() function to capture the exact times when the session high and low occur.

Notes Creation:
You format the high and low values along with their timestamps to create notes that will be displayed alongside the lines.
Drawing Lines and Labels:

After the session ends, you check if there is a new session high or low and draw lines and labels accordingly. If a line or label already exists, you delete it before drawing a new one.
Resetting for Next Session:

At the end of the session, the high and low values are reset for the next session.
Suggestions for Improvement:
Dynamic Line Extensions:

Clear Variable Names Used in Code:
Consider using more descriptive names for variables like Entry_Point and SL_Point to make the code easier to understand.

Commenting:
Although the code is well-commented, always ensure the comments explain the "why" behind the code rather than just the "what."

Example Output:
The output will show the highest and lowest prices during the specified session times and the times they occurred formatted correctly. This output is useful for quick reference during trading and aids in making informed decisions.

Added functionality tool tip Note:
Added a tooltip Note to Get All information of Session High Low & Range.

If you need further modifications, enhancements, or specific functionalities added to this script, please let me know!









Bands and Channels

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer