Giter Site home page Giter Site logo

everget / tradingview-pinescript-indicators Goto Github PK

View Code? Open in Web Editor NEW
424.0 29.0 140.0 183 KB

A collection of the various technical indicators implemented in Pine Script Language

pine pinescript technical-indicators indicators moving movings oscillator oscillators bands means average averages

tradingview-pinescript-indicators's Issues

Regarding MACD histogram Pine Script

For the last few days, I've been trying to plot specific information on the chart but it did not go through well.. I would be grateful if anyone could help me with that...

I am trying to spot the highest bar within the completed MACD histogram(above 0), and the lowest bar within the completed MACD histogram(below 0). I have attached a screenshot for reference. After spotting the last 2 highest(or lowest), I would draw a trend line of them..

/////The code is here. I have separated the +,- histogram, and put dots above and below of +,- histogram
Highest and Lowest bar within the completed MACD histogram

//@Version=4
study(title="My MACD", shorttitle="My MACD", overlay=true)

// Getting inputs
fast_length = input(title="Fast Length",
type=input.integer, defval=12)
slow_length = input(title="Slow Length",
type=input.integer, defval=26)
src = input(title="Source", type=input.source,
defval=close)
signal_length = input(title="Signal Smoothing",
type=input.integer, defval = 9)

// Calculating
fast_ma = ema(src, fast_length)
slow_ma = ema(src, slow_length)
macd = fast_ma - slow_ma
signal = ema(macd, signal_length)
hist = macd - signal

// Plot colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00

//////////////////////////////////////// Plot ////////////////////////////////////////////////////

// Dots(+histogram and -histogram)
plotshape(hist>=0, "Dots histogram +", color=color.green, style=shape.cross, location=location.top)
plotshape(hist<=0, "Dots histogram -", color=color.red, style=shape.cross, location=location.bottom)

// +Histogram and -histogram
plot(hist, title="Histogram +", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : na), transp=0 )
plot(hist, title="Histogram -", style=plot.style_columns, color=(hist<=0 ? (hist[1] < hist ? col_grow_below : col_fall_below) : na), transp=0 )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.