Sujeet
Sujeet

Reputation: 1

How to plot Buy and Short Signals on Volume SMA Multiplier

Please help me how to plot Buy signal whenever Green color Volume crossed above SMA20 line with 2 times of Avg. Volume in Pinescript.

Need options in Indicator Setting: Buy and Sell arrow color change option. Volume Multiplier = 2 (numeric values) SMA = 20 SMA20 Color

Plz help.

Volume Multiplier

Upvotes: 0

Views: 358

Answers (1)

SafetyHammer
SafetyHammer

Reputation: 411

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SafetyHammer

//@version=4

study(title="Volume & SMA", overlay=false, format=format.volume)

length          = input(20,"Long MA Length", type=input.integer)

color           = close > open ? color.new(color.green,50) : color.new(color.red,50)

sma             = sma(volume, length)
buy             = close > open and crossover(volume,sma)
sell            = close < open and crossover(volume,sma)


plot(volume, title="volume", style=plot.style_columns, color= color, histbase=0)
plot(sma, title = "Long MA", color = color.red)

plotshape(buy,title = "CrossUp indicator", location = location.top, style=shape.triangleup, text="Buy", color = color.new(color.green,50))
plotshape(sell,title = "CrossDown indicator", location = location.top, style=shape.triangledown, text="Sell", color = color.new(color.red,50))

Upvotes: 1

Related Questions