Professional Documents
Culture Documents
buySellPressure Code
buySellPressure Code
//Pressure Indicator
indicator("Pressure - Buying and Selling")
//Pressure Length
length = input(8, "Pressure Length", group = "Pressure Settings")
//Pressure
cond1 = high - close[1] ? high - close[1] : 0
cond2 = close[1] - low ? close[1] - low : 0
//Moving Averages
ma(pressure, length, type) =>
switch type
"SMA" => ta.sma (pressure, length)
"EMA" => ta.ema (pressure, length)
"VWMA" => ta.vwma (pressure, length)
"ALMA" => ta.alma (pressure, length, 0.85, 6)
ma_Type1 = input.string("EMA", title = "MA Type 1", group = "MA Settings", options
= ["SMA", "EMA", "VWMA", "ALMA"])
ma_Type2 = input.string("SMA" , title = "MA Type 2", group = "MA Settings",
options = ["SMA", "EMA", "VWMA", "ALMA"])
ma_Type3 = input.string("VWMA" , title = "MA Type 3", group = "MA Settings",
options = ["SMA", "EMA", "VWMA", "ALMA"])
ma_Length = input (27 , title = "MA Length", group = "MA Settings"
)
//MA Bands
multiplier = input.float(0.1, "MA Bands Multiplier", step = 0.01, group = "MA Bands
Settings")
//Fill Bands
fill(up_Band, down_Band, title = "MA Bands Tunnel", color = color.new(color.gray,
92), display = display.none)
//Levels
h0 = input(35, group = "Levels Settings")
h1 = input(40, group = "Levels Settings")
h2 = input(60, group = "Levels Settings")
h3 = input(65, group = "Levels Settings")
h4 = input(50, group = "Levels Settings")
//Plot Levels
top = plot(h3, "Top" , color = color.new(#089981 , 0 ))
over_Bought = plot(h2, "Overbought" , color = color.new(color.gray , 0 ))
over_Sold = plot(h1, "Oversold" , color = color.new(color.gray , 0 ))
bottom = plot(h0, "Bottom" , color = color.new(#089981 , 0 ))
middle = plot(h4, "Middle Line", color = color.new(color.yellow, 50))
//Fills for Pressure Line Crossing Overbought and Oversold Levels - Top and Bottom
Fills are Crossing Signals
fill(top , over_Bought, color = crossing_Down_Overbought ? color.new(color.red ,
0) : na, title = "Crossing Down Overbought")
fill(bottom, over_Sold , color = crossing_Up_Oversold ? color.new(color.lime,
0) : na, title = "Crossing Up Oversold" )
//Buying and Selling Pressure 3 (Pressure Line crossing Standard Deviation Bands)
buy_Pressure3 = ta.crossover (pressure, dev_Ma_Band_Dn)
sell_Pressure3 = ta.crossunder(pressure, dev_Ma_Band_Up)
//Buying and Selling Pressure 3 (Pressure Line crossing Standard Deviation Bands)
Dots
plot(pressure - 6, "Buying Pressure 3" , style = plot.style_circles, color =
buy_Pressure3 ? #007dff : na, linewidth = 3)
plot(pressure + 6, "Selling Pressure 3", style = plot.style_circles, color =
sell_Pressure3 ? #ff8200 : na, linewidth = 3)