PINE LIBRARY

SessionBox

업데이트됨
Library "SessionBox"
This library provides functions to manage and visualize session boxes and labels on chart. A session box is a visual representation of a trading session with properties like time, name, color and the ability to track the high and low price within that session.

SessionBox
  SessionBox: stores session data and provides methods to manage that data and visualize it on the chart.
  Fields:
    session_time (series bool)
    session_name (series string)
    session_color (series color)
릴리즈 노트
v2

Added:
method setTime(this, _time)
  Sets the session_time property based on the provide boolean value
  Namespace types: createSessionBox
  Parameters:
    this (createSessionBox)
    _time (bool)
  Returns: void

method setName(this, _name)
  sets the session_name property with a provided string.
  Namespace types: createSessionBox
  Parameters:
    this (createSessionBox)
    _name (string)
  Returns: void

method setColor(this, _color)
  sets the session_color with a provided color value
  Namespace types: createSessionBox
  Parameters:
    this (createSessionBox)
    _color (color)
  Returns: void

method getHighLowPrice(this)
  Calculates and returns the high and low price within the current session.
  Namespace types: createSessionBox
  Parameters:
    this (createSessionBox)
  Returns: the high and low price within the current session as a two-element array.

method drawBox(this, _priceHigh, _priceLow)
  Draws a session box on the chart based on the provided high and low prices for the current session.
  Namespace types: createSessionBox
  Parameters:
    this (createSessionBox)
    _priceHigh (float): High of the current session
    _priceLow (float): Low of the current session
  Returns: void

createSessionBox
  Stores session data and provides methods to manage that data and visualize it on the chart.
  Fields:
    session_time (series bool)
    session_name (series string)
    session_color (series color)

Removed:
SessionBox
  SessionBox: stores session data and provides methods to manage that data and visualize it on the chart.
릴리즈 노트
v3

Added:
drawSessionBox(sessionName, sessionTime, sessionZone, boxColor, boxBorderSize)
  Draws a custom session box with specified parameters.
  Parameters:
    sessionName (string): (string) - Name of the session (default: "").
    sessionTime (string): (string) - The session time range in "HHMM-HHMM" format.
    sessionZone (string): (string) - The session's time zone (default: "GMT+0").
    boxColor (color): (color) - The color of the session box (default: color.blue).
    boxBorderSize (int): (int) - The thickness of the box border (default: 2).

drawAsiaSession(sessionTime, sessionZone, boxColor, boxBorderSize)
  Draws a session box for the Asian session with default or customized parameters.
  Parameters:
    sessionTime (string): (string) - The session time range (default: "0000-0900").
    sessionZone (string): (string) - The session's time zone (default: "GMT+0").
    boxColor (color): (color) - The color of the session box (default: color.green).
    boxBorderSize (int): (int) - The thickness of the box border (default: 2).

drawLondonSession(sessionTime, sessionZone, boxColor, boxBorderSize)
  Draws a session box for the London session with default or customized parameters.
  Parameters:
    sessionTime (string): (string) - The session time range (default: "0700-1600").
    sessionZone (string): (string) - The session's time zone (default: "GMT+0").
    boxColor (color): (color) - The color of the session box (default: color.blue).
    boxBorderSize (int): (int) - The thickness of the box border (default: 2).

drawNewYorkSession(sessionTime, sessionZone, boxColor, boxBorderSize)
  Draws a session box for the New York session with default or customized parameters.
  Parameters:
    sessionTime (string): (string) - The session time range (default: "1300-2200").
    sessionZone (string): (string) - The session's time zone (default: "GMT+0").
    boxColor (color): (color) - The color of the session box (default: color.purple).
    boxBorderSize (int): (int) - The thickness of the box border (default: 2).

Removed:
method setTime(this, _time)
  Sets the session_time property based on the provide boolean value

method setName(this, _name)
  sets the session_name property with a provided string.

method setColor(this, _color)
  sets the session_color with a provided color value

method getHighLowPrice(this)
  Calculates and returns the high and low price within the current session.

method drawBox(this, _priceHigh, _priceLow)
  Draws a session box on the chart based on the provided high and low prices for the current session.

createSessionBox
  Stores session data and provides methods to manage that data and visualize it on the chart.
----------

### Quick Example:

```pinescript
//version=5
import "SessionBox" as sb

indicator("Session Box Example", overlay=true)

// Function arguments explained:
// drawSessionBox(
// string sessionName: Label for the session (default: ""),
// string sessionTime: Time range in "HHMM-HHMM" format (required),
// string sessionZone: Time zone (default: "GMT+0"),
// color boxColor: Box background color (default: color.blue),
// int boxBorderSize: Border thickness (default: 2)
// )

// Default session boxes
sb.drawAsiaSession() // Default Asia session: "0000-0900", GMT+0
sb.drawLondonSession() // Default London session: "0700-1600", GMT+0
sb.drawNewYorkSession() // Default New York session: "1300-2200", GMT+0

// Customized default session
sb.drawAsiaSession("0100-0800", "GMT+2", color.new(color.green, 50), 1)

// Custom session box
sb.drawSessionBox("My Custom Session", "05:00-14:00", "GMT+2", color.orange, 2)
```
This will create default session boxes, a customized default Asia session, and a completely custom session. Simple and intuitive!
colorsdisplaytimesessions

파인 라이브러리

진정한 TradingView 정신에 따라, 저자는 이 파인 코드를 다른 파인 프로그래머들이 재사용할 수 있도록 오픈 소스 라이브러리로 공개했습니다. 저자에게 박수를 보냅니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈 소스 출판물에서 사용할 수 있지만, 이 코드를 출판물에서 재사용하는 것은 하우스 룰에 의해 관리됩니다.

면책사항