ESSMA
Concept: There are a large number of moving averages available. However, they are effective differently. Trends confirmation and follow through requires a large number of moving averages to be used differently. The…
Concept:
There are a large number of moving averages available.
However, they are effective differently.
Trends confirmation and follow through requires a large number of moving averages to be used differently.
The concept here is to generate a combination moving average, each MA type can be weighted to provide a higher degree of confirmation of trend.
The weights are configurable in settings, and as a sample 50 length has been used.
ATR did not produce good result, so has been kept as optional.
The source can be modified.
The indicator provides a good Resistance support value in the larger time frame. And also provides a breakout and breakdown indication. Follow through is mostly effective.
The alert condition has been made such that it can directly be ported to discord.
For alerts one must configure their own message.
Happy trading.

Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1_close | 0 | (?Source)Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
| v_input_2 | 50 | (?Length)Length1 |
| v_input_float_1 | 2 | (?Weights)SMA Weight |
| v_input_float_2 | 2 | EMA Weight |
| v_input_float_3 | 2 | WMA Weight |
| v_input_float_4 | 2 | SMMA Weight |
| v_input_float_5 | 2 | RMA Weight |
| v_input_bool_1 | false | (?ATR)Use ATR |
| v_input_int_1 | 14 | ATR Length |
Source Pine Script
/*backtest
start: 2022-04-11 00:00:00
end: 2022-05-10 23:59:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bhavishya
//@version=5
indicator("ESSMA", overlay=true)
//inputs
source = input(close, "Source", group="Source")
length1 = input(50, "Length1", group = "Length")
w1 = input.float(2.0, "SMA Weight", group="Weights")
w2 = input.float(2.0, "EMA Weight", group="Weights")
w3 = input.float(2.0, "WMA Weight", group="Weights")
w4 = input.float(2.0, "SMMA Weight", group="Weights")
w5 = input.float(2.0, "RMA Weight", group="Weights")
useatr = input.bool(false, "Use ATR", group="ATR")
atrLen = input.int(title="ATR Length", defval=14, group="ATR")
// functions
smma(src, length) =>
smma = 0.0
smma := na(smma[2]) ? ta.sma(src, length) : (smma[2] * (length - 1) + src) / length
smma
essma(src,length) =>
essma = 0.0
smma = smma(src * w4,length)
ema = ta.ema(src * w2, length)
sma = ta.sma(src * w1, length)
wma = ta.wma(src * w3, length)
rma = ta.rma(src * w5, length)
essma := (smma/w4+ema/w2+sma/w1 - wma/w3 - rma/w5 + open + close)/(3)
essma
// calucations
// atr and MAs
atr = ta.atr(atrLen)
usesource = useatr ? atr : source
essma1 = essma(usesource, length1)
sessma1 = ta.wma(essma1, length1)
// plots
p1 = plot(essma1, "ESSMA", color.green)
ps1 = plot(sessma1, "ESSMA Smooth", color.red)
bool up = na
bool down = na
if (ta.crossover(essma1,sessma1))
up := true
if (ta.crossunder(essma1, sessma1))
down := true
plotshape(up, style=shape.labelup, location = location.belowbar, color=color.lime, text="B", textcolor=color.black)
plotshape(down, style=shape.labeldown, location = location.abovebar, color=color.orange, text="S", textcolor=color.black)
// alerts
alertcondition(up, "ESSMA UP", '{"content":"ESSMA BUY @ {{close}}" : "{{ticker}} int : {{interval}} - essma : {{plot_0}} / sessma {{plot_1}}"}')
alertcondition(down, "ESSMA DOWN", '{"content":"ESSMA SELL @ {{close}}" : "{{ticker}} int : {{interval}} - essma :{{plot_0}} /sessma : {{plot_1}}"}')
if up
strategy.entry("Enter Long", strategy.long)
else if down
strategy.entry("Enter Short", strategy.short)Published by ChaoZhang on the FMZ strategy square · last modified 2022-05-12. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/ESSMA.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- BB Breakout StrategyPine Script · Breakout · 1d
- Donchian Channel and Larry Williams Large Trade Index StrategyPine Script · Breakout · 1m
- Dual Breakout Volatility Channel StrategyPine Script · Breakout · 1h
- Dual MA Momentum Breakout StrategyPine Script · Breakout · 1h
- EMA and Bollinger Bands Breakout StrategyPine Script · Breakout · 1h
- Flexible Long Short Trading Strategy Based on Keltner ChannelsPine Script · Breakout · 1d