Indicator · Pine Script v4 · On the chart

Bitcoin Logarithmic Growth Curves

by DT021

This indicator calculates and plots logarithmic growth curves and intermediate Fibonacci levels directly on the main price chart to outline long-term channel boundaries for Bitcoin.

View on GitHub

GitHub stars1on the repository
Pine versionv4older, still runs
Lines of code110
Settings7inputs
LicenceGPL-3.0
Last update6 years ago10 Mar 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

110 lines of Pine Script v4 from third-party-pines/Bitcoin Logarithmic Growth Curves by quantadelic copy.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

Bitcoin Logarithmic Growth Curves by quantadelic copy.pine
//@version=4
//
// An indicator by @Quantadelic aka Pinescript Pleb aka Stealer of Alpha & Destroyer of Discords
//
// "I drink your milkshake! I drink it up."
//
// No rights reserved, copy, paste, do what you want.
//

study(title="Bitcoin Logarithmic Growth Curves", shorttitle="Bitcoin Log Growth Curves", overlay=true)

// INPUTS
DarkOrLight =   input("Dark", title="Dark mode or Light mode?", options=["Dark", "Light"])
ShowFibs =      input("Y", title="Show Fibonacci Levels?", options=["Y","N"])
ShowExtensions= input("Y", title="Show Curve Projections?", options=["Y","N"])
HighIntercept = input(1.06930947, title="Top Curve Intercept", step=0.001)
HighSlope =     input(0.00076, title="Top Curve Slope", step=0.00001)
LowIntercept =  input(-3.0269716, title="Bottom Curve Intercept", step=0.001)
LowSlope =      input(0.001329, title="Bottom Curve Slope", step=0.00001)

// TIME CALCS
TimeIndex =     time < 1279670400000 ? 3.0 : (time - 1279670400000) / 86400000
Weight =        (log10(TimeIndex + 10) * TimeIndex * TimeIndex - TimeIndex) / 30000
TimeDelta =     time - time[1]

// TOP OF CHANNEL INTERCEPT & SLOPE CALCS
HighSlopeCum =  HighSlope * TimeIndex
HighLogDev =    TimeIndex > 2 ? log(Weight) + HighIntercept + HighSlopeCum : na

// BOTTOM OF CHANNEL INTERCEPT & SLOPE CALCS
LowSlopeCum =   LowSlope * TimeIndex
LowLogDev =     TimeIndex > 2 ? log(Weight) + LowIntercept + LowSlopeCum : na

// TOTAL CHANNEL LOG RANGE
LogRange =      HighLogDev - LowLogDev

// FIBONACCI LEVELS
Fib9098Calc =   (LogRange * 0.9098) + LowLogDev
Fib8541Calc =   (LogRange * 0.8541) + LowLogDev
Fib7639Calc =   (LogRange * 0.7639) + LowLogDev
Fib618Calc =    (LogRange * 0.618) + LowLogDev
MidCalc =       (LogRange * 0.5) + LowLogDev
Fib382Calc =    (LogRange * 0.382) + LowLogDev
Fib2361Calc =   (LogRange * 0.2361) + LowLogDev
Fib1459Calc =   (LogRange * 0.1459) + LowLogDev
Fib0902Calc =   (LogRange * 0.0902) + LowLogDev

// SCALE LOG VARIABLES TO LINEAR
HighDev =       pow(2.718281828459, HighLogDev)
Fib9098Dev =    ShowFibs == "Y" ? pow(2.718281828459, Fib9098Calc) : na
Fib8541Dev =    ShowFibs == "Y" ? pow(2.718281828459, Fib8541Calc) : na
Fib7639Dev =    ShowFibs == "Y" ? pow(2.718281828459, Fib7639Calc) : na
Fib618Dev =     ShowFibs == "Y" ? pow(2.718281828459, Fib618Calc) : na
MidDev =        pow(2.718281828459, MidCalc)
Fib382Dev =     ShowFibs == "Y" ? pow(2.718281828459, Fib382Calc) : na
Fib2361Dev =    ShowFibs == "Y" ? pow(2.718281828459, Fib2361Calc) : na
Fib1459Dev =    ShowFibs == "Y" ? pow(2.718281828459, Fib1459Calc) : na
Fib0902Dev =    ShowFibs == "Y" ? pow(2.718281828459, Fib0902Calc) : na
LowDev =        pow(2.718281828459, LowLogDev)

// COLOR SCHEME
ColorScheme =   DarkOrLight == "Dark" ? color(color.white) : color(color.black)

// PLOTS
plot(HighDev, color=ColorScheme, transp=0, title="100% - Top of Channel")
plot(Fib9098Dev, color=ColorScheme, transp=50, title="90.98% - Fibonacci Level")
plot(Fib8541Dev, color=ColorScheme, transp=50, title="85.41% - Fibonacci Level")
plot(Fib7639Dev, color=ColorScheme, transp=50, title="76.39% - Fibonacci Level")
plot(Fib618Dev, color=ColorScheme, transp=50, title="61.80% - Fibonacci Level")
plot(MidDev, color=ColorScheme, transp=0, title="50% - Middle of Channel")
plot(Fib382Dev, color=ColorScheme, transp=50, title="38.20% - Fibonacci Level")
plot(Fib2361Dev, color=ColorScheme, transp=50, title="23.61% - Fibonacci Level")
plot(Fib1459Dev, color=ColorScheme, transp=50, title="14.59% - Fibonacci Level")
plot(Fib0902Dev, color=ColorScheme, transp=50, title="9.02% - Fibonacci Level")
plot(LowDev, color=ColorScheme, transp=0, title="0% - Bottom of Channel")



//////////////////////////////////////////////////////////
//                                                      //
// CURVE EXTENSION DRAWING FUNCTION & HELPER VARIABLES  //
//                                                      //
//////////////////////////////////////////////////////////

// CURVE EXTENSION FUNCTION
ExtenZe(_i, _slope, _intercept) =>
    TI = ((time + TimeDelta *_i) -1279670400000) / 86400000
    W = (log10(TI + 10) * TI * TI - TI) / 30000
    HSC = _slope * TI
    HLD = log(W) + _intercept + HSC
    HD = pow(2.718281828459, HLD)
    HD

// VARIABLES FOR ADJUSTING LENGTH OF CURVE EXTENSIONS RELATIVE TO CHART TIME-FRAME
ForLoopStep = timeframe.ismonthly == 1 ? ceil( 12 / timeframe.multiplier) : 
              timeframe.isweekly == 1 ? ceil(26 / timeframe.multiplier) : 
              timeframe.isdaily == 1 ? ceil(91 / timeframe.multiplier) : 
              (timeframe.isminutes == 1) and (timeframe.multiplier > 59) ? ceil(10080 / timeframe.multiplier) : na
ForLoopMax =    na(ForLoopStep) ? na : ForLoopStep * 13

// MID CURVE SLOPE & INTERCEPT
MidSlope =      (HighSlope + LowSlope) * 0.5
MidIntercept =  (HighIntercept + LowIntercept) * 0.5

// CHECK IF LAST BAR & "Show Curve Projections" IS CHECKED, THEN DRAW CURVE EXTENZES
if barstate.islast and ShowExtensions == "Y"
    for i = 0 to ForLoopMax-1 by ForLoopStep
        line.new(time + TimeDelta * i, ExtenZe(i, HighSlope, HighIntercept), time + TimeDelta * (i + ForLoopStep), ExtenZe(i + ForLoopStep, HighSlope, HighIntercept), xloc=xloc.bar_time, color=ColorScheme)
        line.new(time + TimeDelta * i, ExtenZe(i, LowSlope, LowIntercept), time + TimeDelta * (i + ForLoopStep), ExtenZe(i + ForLoopStep, LowSlope, LowIntercept), xloc=xloc.bar_time, color=ColorScheme)
        line.new(time + TimeDelta * i, ExtenZe(i, MidSlope, MidIntercept), time + TimeDelta * (i + ForLoopStep), ExtenZe(i + ForLoopStep, MidSlope, MidIntercept), xloc=xloc.bar_time, color=ColorScheme)

Overview

Bitcoin Logarithmic Growth Curves computes upper and lower growth curves based on historical time elapsed since July 2010, deriving logarithmic deviation channels scaled back to linear price values. Inputs allow users to adjust top and bottom intercept and slope values, toggle intermediate Fibonacci lines, enable curve projections, and switch between dark and light visual themes.

Details

Published by

DT021 on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Trend, Support & resistance

Markets

Crypto

Timeframes

H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

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

SettingTypeDefaultVariable
Dark mode or Light mode?stringDarkDarkOrLight
Show Fibonacci Levels?stringYShowFibs
Show Curve Projections?stringYShowExtensions
Top Curve Interceptfloat1.06930947HighIntercept
Top Curve Slopefloat0.00076HighSlope
Bottom Curve Interceptfloat-3.0269716LowIntercept
Bottom Curve Slopefloat0.001329LowSlope
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

575 stars

This indicator detects equal highs and lows by comparing prices within user-defined left and right bars using a tolerance percentage. It plots horizontal lines on the price chart for equal highs in one color and lows in another. A screener allows input of mult

Indicator v5 Support & resistanceTrend
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows with Screener

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

AI Trend

by dearvn
257 stars

AI Trend is an indicator that plots pivot points, trend lines, and support and resistance levels directly on the price chart. It marks high and low pivots based on user-defined length, draws trend lines that check for violations at specified points, and identi

Indicator v5 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of AI Trend

Ichimoku Cloud

by harryguiacorn
219 stars

This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ichimoku Cloud
219 stars

This indicator identifies local swing highs and swing lows to construct a Zig Zag pattern on the main price chart. It evaluates pivot points based on a customizable number of surrounding left and right bars. Using persistent variables, the script tracks previo

Indicator v4 Support & resistanceTrend Repaints
Updated 5 years ago · None stated GitHub repository of Teaching: Finding Highs and Lows 6

Dynamic Linear Regression

by TradersPost
218 stars

Dynamic Linear Regression calculates and plots linear regression trendlines and standard deviation channels directly on the price chart over a user-selected time period. Traders can configure static channels locked at the end time, dynamic channels that contin

Indicator v6 TrendSupport & resistance
Updated 3 months ago · None stated GitHub repository of Dynamic 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