Indicator · Pine Script v4 · On the chart

TPCharts Figures

by TPCharts

TPCharts Figures draws horizontal grid lines and round number key levels directly on the price chart relative to the current price.

View on GitHub

Repaints

GitHub stars10on the repository
Pine versionv4older, still runs
Lines of code51
Settings3inputs
LicenceGPL-3.0
Last update5 years ago1 Dec 2020

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

51 lines of Pine Script v4 from TPCharts-Figures.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

TPCharts-Figures.pine
//@version=4
study("TPCharts Figures", overlay=true)

var number_of_lines = input(5, title="Total", type=input.integer)

var isIntervalCustom = input(title="Use Custom Interval? (Overrides Interval auto-detection for asset class)", type=input.bool, defval=false)
var Interval = input(title="Interval", type=input.float, defval=100.00)
// var isIntervalShown = input(title="Show Default Interval?", type=input.bool, defval=false)
// if isIntervalShown
//     x = bar_index
//     y = close
//     txt = tostring(syminfo.mintick)
    
//     if barstate.islast
//         label.new(x, y, txt)
        
if not isIntervalCustom and syminfo.type == 'forex'
    Interval := syminfo.mintick*100
    
if not isIntervalCustom and syminfo.type == 'bitcoin'
    Interval := syminfo.mintick*200

if barstate.islast
  
    for counter = 0 to number_of_lines - 1
    
        // Upper
        IntervalUp = floor(close / Interval) * Interval + (counter * Interval)
        line.new(bar_index, IntervalUp, bar_index - 1, IntervalUp, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=2, style=line.style_solid)
        
        IntervalUp20 = floor(close / Interval) * Interval + (counter * Interval) + (Interval / 5)
        line.new(bar_index, IntervalUp20, bar_index - 1, IntervalUp20, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=1, style=line.style_dotted)

        IntervalUp80 = floor(close / Interval) * Interval + (counter * Interval) - (Interval / 5)
        line.new(bar_index, IntervalUp80, bar_index - 1, IntervalUp80, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=1, style=line.style_dotted)

        IntervalUpMidFig = floor(close / Interval) * Interval + (counter * Interval) + (Interval / 2)
        line.new(bar_index, IntervalUpMidFig, bar_index - 1, IntervalUpMidFig, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=1, style=line.style_dashed)

        // Lower
        IntervalDown = floor(close / Interval) * Interval - (counter * Interval)
        line.new(bar_index, IntervalDown, bar_index - 1, IntervalDown, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=2, style=line.style_solid) 
        
        IntervalDown80 = floor(close / Interval) * Interval - (counter * Interval) - (Interval / 5)
        line.new(bar_index, IntervalDown80, bar_index - 1, IntervalDown80, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=1, style=line.style_dotted)
        
        IntervalDown20 = floor(close / Interval) * Interval - (counter * Interval) + (Interval / 5)
        line.new(bar_index, IntervalDown20, bar_index - 1, IntervalDown20, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=1, style=line.style_dotted)
        
        IntervalDownidFig = floor(close / Interval) * Interval - (counter * Interval) - (Interval / 2)
        line.new(bar_index, IntervalDownidFig, bar_index - 1, IntervalDownidFig, xloc=xloc.bar_index, extend=extend.both, color=color.gray, width=1, style=line.style_dashed)

Overview

TPCharts Figures calculates auto-detected interval steps for Forex and Bitcoin symbols or accepts a custom interval value. The script projects primary figure lines along with secondary sub-levels at 20%, 50%, and 80% increments. Lines are rendered dynamically on the latest bar across the entire chart history.

Details

Published by

TPCharts on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Support & resistance

Markets

Forex, Crypto

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Totalint5number_of_lines
Use Custom Interval? (Overrides Interval auto-detection for asset class)boolfalseisIntervalCustom
Intervalfloat100.00Interval
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

Moving Average Channel plots separate simple moving averages for upper and lower bands on the price chart. It fills the space between bands with semi-transparent color and colors bars green above the upper band, red below the lower band, or gray in between. Us

Indicator v4 Moving averagesSupport & resistance
Updated 10 days ago · GPL-3.0 GitHub repository of Moving Average Channel

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows
330 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur

Indicator v5 VolumeSupport & resistance
Updated 2 months ago · MIT GitHub repository of Volume Profile and Indicator by DGT

BZ-tracker

by Allen1212
303 stars

The BZ-tracker indicator marks ARK Invest buy and sell transactions on stock charts with labels. It plots green labels for purchases and red labels for sales, each annotated with a multiplier such as X1 or X2 to show the number of ARK ETFs trading the stock on

Indicator v4 Support & resistanceScreeners & dashboards
Updated 2 years ago · None stated GitHub repository of BZ-tracker

Function - Linear Regression

by ricardosantos79
261 stars

This indicator fits a linear regression through stored pivot highs and lows and draws the resulting channel on the price chart. A function returns predicted values, maximum and minimum deviations, and the average absolute deviation. Confirmed two-bar pivots up

Indicator v5 TrendSupport & resistance
Updated 4 years ago · None stated GitHub repository of Function - Linear Regression

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers