# Pine Script v6 Reference Generated on: 7/23/2025 Total Functions: 884 --- ## ask **Type:** series float The ask price at the time of the current tick, which represents the lowest price an active seller will accept for the instrument at its current value. This information is available only on the "1T" timeframe. On other timeframes, the variable's value is na. ### Remarks If the bid/ask values change since the last tick but no new trades are made, these changes will not be reflected in the value of this variable. It is only updated on new ticks. --- ## bar_index **Type:** series int Current bar index. Numbering is zero-based, index of the first bar is 0. ### Remarks Note that bar_index has replaced n variable in version 4. Note that bar indexing starts from 0 on the first historical bar. Please note that using this variable/function can cause indicator repainting. ### Code Example ```pine //@version=6 indicator("bar_index") plot(bar_index) plot(bar_index > 5000 ? close : 0) ``` --- ## barstate.isconfirmed **Type:** series bool Returns true if the script is calculating the last (closing) update of the current bar. The next script calculation will be on the new bar data. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. It is NOT recommended to use barstate.isconfirmed in request.security expression. Its value requested from request.security is unpredictable. Please note that using this variable/function can cause indicator repainting. --- ## barstate.isfirst **Type:** series bool Returns true if current bar is first bar in barset, false otherwise. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. Please note that using this variable/function can cause indicator repainting. --- ## barstate.ishistory **Type:** series bool Returns true if current bar is a historical bar, false otherwise. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. Please note that using this variable/function can cause indicator repainting. --- ## barstate.islast **Type:** series bool Returns true if current bar is the last bar in barset, false otherwise. This condition is true for all real-time bars in barset. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. Please note that using this variable/function can cause indicator repainting. --- ## barstate.islastconfirmedhistory **Type:** series bool Returns true if script is executing on the dataset's last bar when market is closed, or script is executing on the bar immediately preceding the real-time bar, if market is open. Returns false otherwise. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. Please note that using this variable/function can cause indicator repainting. --- ## barstate.isnew **Type:** series bool Returns true if script is currently calculating on new bar, false otherwise. This variable is true when calculating on historical bars or on first update of a newly generated real-time bar. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. Please note that using this variable/function can cause indicator repainting. --- ## barstate.isrealtime **Type:** series bool Returns true if current bar is a real-time bar, false otherwise. ### Remarks Pine Script® code that uses this variable could calculate differently on history and real-time data. Please note that using this variable/function can cause indicator repainting. --- ## bid **Type:** series float The bid price at the time of the current tick, which represents the highest price an active buyer is willing to pay for the instrument at its current value. This information is available only on the "1T" timeframe. On other timeframes, the variable's value is na. ### Remarks If the bid/ask values change since the last tick but no new trades are made, these changes will not be reflected in the value of this variable. It is only updated on new ticks. --- ## box.all **Type:** array Returns an array filled with all the current boxes drawn by the script. ### Remarks The array is read-only. Index zero of the array is the ID of the oldest object on the chart. ### Code Example ```pine //@version=6 indicator("box.all") //delete all boxes box.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, border_style=line.style_dashed) a_allBoxes = box.all if array.size(a_allBoxes) > 0 for i = 0 to array.size(a_allBoxes) - 1 box.delete(array.get(a_allBoxes, i)) ``` --- ## chart.bg_color **Type:** input color Returns the color of the chart's background from the "Chart settings/Appearance/Background" field. When a gradient is selected, the middle point of the gradient is returned. --- ## chart.fg_color **Type:** input color Returns a color providing optimal contrast with chart.bg_color. --- ## chart.is_heikinashi **Type:** simple bool ### Returns Returns true if the chart type is Heikin Ashi, false otherwise. --- ## chart.is_kagi **Type:** simple bool ### Returns Returns true if the chart type is Kagi, false otherwise. --- ## chart.is_linebreak **Type:** simple bool ### Returns Returns true if the chart type is Line break, false otherwise. --- ## chart.is_pnf **Type:** simple bool ### Returns Returns true if the chart type is Point & figure, false otherwise. --- ## chart.is_range **Type:** simple bool ### Returns Returns true if the chart type is Range, false otherwise. --- ## chart.is_renko **Type:** simple bool ### Returns Returns true if the chart type is Renko, false otherwise. --- ## chart.is_standard **Type:** simple bool ### Returns Returns true if the chart type is not one of the following: Renko, Kagi, Line break, Point & figure, Range, Heikin Ashi; false otherwise. --- ## chart.left_visible_bar_time **Type:** input int The time of the leftmost bar currently visible on the chart. ### Remarks Scripts using this variable will automatically re-execute when its value updates to reflect changes in the chart, which can be caused by users scrolling the chart, or new real-time bars. Alerts created on a script that includes this variable will only use the value assigned to the variable at the moment of the alert's creation, regardless of whether the value changes afterward, which may lead to repainting. --- ## chart.right_visible_bar_time **Type:** input int The time of the rightmost bar currently visible on the chart. ### Remarks Scripts using this variable will automatically re-execute when its value updates to reflect changes in the chart, which can be caused by users scrolling the chart, or new real-time bars. Alerts created on a script that includes this variable will only use the value assigned to the variable at the moment of the alert's creation, regardless of whether the value changes afterward, which may lead to repainting. --- ## close **Type:** series float Close price of the current bar when it has closed, or last traded price of a yet incomplete, realtime bar. ### Remarks Previous values may be accessed with square brackets operator [], e.g. close[1], close[2]. --- ## dayofmonth **Type:** series int Date of current bar time in exchange timezone. ### Remarks Note that this variable returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day. --- ## dayofweek **Type:** series int Day of week for current bar time in exchange timezone. ### Remarks Note that this variable returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day. You can use dayofweek.sunday, dayofweek.monday, dayofweek.tuesday, dayofweek.wednesday, dayofweek.thursday, dayofweek.friday and dayofweek.saturday variables for comparisons. --- ## dividends.future_amount **Type:** series float Returns the payment amount of the upcoming dividend in the currency of the current instrument, or na if this data isn't available. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected Payment date of the next dividend. --- ## dividends.future_ex_date **Type:** series int Returns the Ex-dividend date (Ex-date) of the current instrument's next dividend payment, or na if this data isn't available. Ex-dividend date signifies when investors are no longer entitled to a payout from the most recent dividend. Only those who purchased shares before this day are entitled to the dividend payment. ### Returns UNIX time, expressed in milliseconds. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected Payment date of the next dividend. --- ## dividends.future_pay_date **Type:** series int Returns the Payment date (Pay date) of the current instrument's next dividend payment, or na if this data isn't available. Payment date signifies the day when eligible investors will receive the dividend payment. ### Returns UNIX time, expressed in milliseconds. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected Payment date of the next dividend. --- ## earnings.future_eps **Type:** series float Returns the estimated Earnings per Share of the next earnings report in the currency of the instrument, or na if this data isn't available. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report. --- ## earnings.future_period_end_time **Type:** series int Checks the data for the next earnings report and returns the UNIX timestamp of the day when the financial period covered by those earnings ends, or na if this data isn't available. ### Returns UNIX time, expressed in milliseconds. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report. --- ## earnings.future_revenue **Type:** series float Returns the estimated Revenue of the next earnings report in the currency of the instrument, or na if this data isn't available. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report. --- ## earnings.future_time **Type:** series int Returns a UNIX timestamp indicating the expected time of the next earnings report, or na if this data isn't available. ### Returns UNIX time, expressed in milliseconds. ### Remarks This value is only fetched once during the script's initial calculation. The variable will return the same value until the script is recalculated, even after the expected time of the next earnings report. --- ## high **Type:** series float Current high price. ### Remarks Previous values may be accessed with square brackets operator [], e.g. high[1], high[2]. --- ## hl2 **Type:** series float Is a shortcut for (high + low)/2 --- ## hlc3 **Type:** series float Is a shortcut for (high + low + close)/3 --- ## hlcc4 **Type:** series float Is a shortcut for (high + low + close + close)/4 --- ## hour **Type:** series int Current bar hour in exchange timezone. --- ## label.all **Type:** array