// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © blackcat1402 //@version=4 study("[blackcat] L1 Joe Sharp More Responsive Moving Average (MMA)", overlay=true, max_bars_back=5000, max_labels_count=500) Price = input(hl2, title = "Price") FastLength = input(13, title = "Fast Length") SlowLength = input(55, title = "Slow Length") ModifiedMA(Price, Length) => Factor = 0.00 Slope = 0.00 SMA = 0.00 MMA = 0.00 for value1 = 1 to Length Factor := 1 + (2 * (value1 - 1)) Slope := Slope + (nz(Price[value1 - 1]) * ((Length - Factor)/2)) SMA := sma(Price, Length) MMA := SMA + (6 * Slope) / ((Length + 1) * Length) MMA Plot1 = plot(ModifiedMA(Price, FastLength), "Fast ModifiedMA", color=color.yellow, linewidth =2) Plot2 = plot(ModifiedMA(Price, SlowLength), "Slow ModifiedMA", color=color.fuchsia, linewidth =2) fill(Plot1, Plot2, color=ModifiedMA(Price,FastLength)>ModifiedMA(Price,SlowLength) ? color.yellow : color.fuchsia, transp=60) long = crossover(ModifiedMA(Price,FastLength), ModifiedMA(Price,SlowLength)) short = crossunder(ModifiedMA(Price,FastLength), ModifiedMA(Price,SlowLength)) // Plots labels l = short ? label.new (bar_index, high, "SELL", color=color.new(color.red,70), textcolor=color.white, style=label.style_labeldown, yloc=yloc.price, size=size.small) : long ? label.new (bar_index, low, "BUY", color=color.new(color.green,70), textcolor=color.white, style=label.style_labelup, yloc=yloc.price, size=size.small) : na //Add Alerts alertcondition(long, title='Alert on LONG', message='BUY!') alertcondition(short, title='Alert on SHORT', message='SELL!')