w=9,268
d=27,644
===================================================================================
======================================
ALMA smoothed gaussian moving average INDICATER(ASGMA-PROFITPROTRADING).
website-[Link]
//@version=5
indicator("ALMA Smoothed Gaussian Moving Average", shorttitle = "ASGMA",
overlay=true)
src = input(close, title='Source', group = "ALMA Smoothing")
smooth = [Link](1, title='Smoothing', minval=1, group = "ALMA Smoothing")
length1 = [Link](25, title='Lookback', minval=1, group = "ALMA Smoothing")
offset = 0.85
sigma1 = 7
pchange = [Link](src, smooth) / src * 100
avpchange = [Link](pchange, length1, offset, sigma1)
//RSI
rsi = [Link](close, 14)
rsiL = rsi > rsi[1]
rsiS = rsi < rsi[1]
//Chande Momentum
length11 = 9
src1 = close
momm = [Link](src1)
f1(m) => m >= 0.0 ? m : 0.0
f2(m) => m >= 0.0 ? 0.0 : -m
m1 = f1(momm)
m2 = f2(momm)
sm1 = [Link](m1, length11)
sm2 = [Link](m2, length11)
percent(nom, div) => 100 * nom / div
chandeMO = percent(sm1-sm2, sm1+sm2)
cL = chandeMO > chandeMO[1]
cS = chandeMO < chandeMO[1]
length = [Link](14, minval=1, title="Length", group = "Gaussian Adaptive Moving
Average")
adaptive = [Link](true, title="Adaptive Parameters", group = "Gaussian Adaptive
Moving Average")
volatilityPeriod = [Link](20, minval=1, title="Volatility Period", group =
"Gaussian Adaptive Moving Average")
// Calculate Gaussian Moving Average
gma = 0.0
sumOfWeights = 0.0
sigma = adaptive ? [Link](close, volatilityPeriod) : [Link](1.0, minval=0.1,
title="Standard Deviation", group = "Gaussian Adaptive Moving Average")
for i = 0 to length - 1
weight = [Link](-[Link](((i - (length - 1)) / (2 * sigma)), 2) / 2)
value = [Link](avpchange, i + 1) + [Link](avpchange, i + 1)
gma := gma + (value * weight)
sumOfWeights := sumOfWeights + weight
gma := (gma / sumOfWeights) / 2
gma:= [Link](gma, 7)
gmaColor = avpchange >= gma ? [Link](0, 161, 5) : [Link](215, 0, 0)
// Color bars based on signals until the next signal occurs
var int currentSignal = 0
currentSignal := avpchange >= gma ? 1 : -1//le_final ? -1 : currentSignal
var color barColor = na
if currentSignal == 1
barColor := [Link](0, 186, 6)
else if currentSignal == -1
barColor := [Link](176, 0, 0)
barcolor(barColor)
plotcandle(open, high, low, close, "Bar Color", barColor, barColor, bordercolor =
barColor)
//Plotting
ema = [Link](close, 7)
plot(ema, color=gmaColor, linewidth=3, title="Gaussian Moving Average")
plotshape([Link](avpchange,gma) and [Link], "Buy Signal", text
= "B", textcolor = [Link], style = [Link], location =
[Link], color = [Link](0, 161, 5), offset = -1)
plotshape([Link](avpchange,gma) and [Link], "Sell Signal",
text = "S", textcolor = [Link], style = [Link], location =
[Link], color = [Link](215, 0, 0), offset = -1)
bgcolor([Link](avpchange,gma) and [Link] and rsiL and cL ?
[Link](0, 162, 5, 85): na, offset = -1)
bgcolor([Link](avpchange,gma) and [Link] and rsiS and cS ?
[Link](207, 0, 0, 85): na, offset = -1)
barcolor(gmaColor)
alertcondition([Link](avpchange,gma) and [Link], title="Buy
Signal", message="Go Long! {{exchange}}:{{ticker}}")
alertcondition([Link](avpchange,gma) and [Link], title="Sell
Signal", message="Go Short! {{exchange}}:{{ticker}}")