0bps

Strategy vault / Mean reversion

3 EMA Boullinger PIVOT

THREE EMAS + BOLLINGER BANDS + PIVOT INDICATOR 1: THREE EMAS ( EXPONENTIAL MOVING AVERAGE ) With this indicator you can visualize the average of prices with greater weight to the most recent data. Three exponential…

Author
ChaoZhang
Complexity
Intermediate · 48 lines
Parameters
7
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

THREE EMAS + BOLLINGER BANDS + PIVOT

INDICATOR 1: THREE EMAS ( EXPONENTIAL MOVING AVERAGE ) With this indicator you can visualize the average of prices with greater weight to the most recent data. Three exponential moving averages are calculated and drawn: 4, 20 and 200 last candles. -Fast EMA1 = 8 -Average EMA2 = 20 -Slow EMA 3 = 200

INDICATOR 2: BOLLINGER BANDS With this indicator you can see the strength and trend of the market, that is, it is measured by the volatility of the asset price. If the price goes above the upper band, the asset is overbought. If the price goes above the lower band, the asset is oversold. Trend length - BASE = 20, step = 1 Standard Deviation - Multiplier = 2, step = 0.2

INDICATOR 3: PIVOT This indicator labels the points where the price is minimum and maximum, in a range of candles determined in the parameter "Distance to Pivot".

These 3 indicators are used for all types of assets: FOREX, CRYPT, CFD's, ETC.


backtest

IMG

Parameters

NameDefaultWhat it controls
v_input_18Periodo 1, Length 1=
v_input_220Periodo 2, Length 2=
v_input_3200Periodo 3, Length 3=
v_input_420longitudBB, LenghtBB=
v_input_52Multiplicadorbb, EstDesv =
v_input_6_close0fuente: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4
v_input_76distancia para el pivote/ distance to pivot

Source Pine Script

/*backtest
start: 2022-04-07 00:00:00
end: 2022-05-06 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/
// © JCMR76

//@version=4
study("3EMA + Boullinger + PIVOT", overlay=true)


// TRES EMAS - THREE EMA´s
periodo1 = input(8, title="Periodo 1, Length 1=", step =1, minval=1, maxval=300)
periodo2 = input(20, title="Periodo 2, Length 2=", step =1, minval=1, maxval=300)
periodo3 = input(200, title="Periodo 3, Length 3=", step =1, minval=1, maxval=1000)


plot(ema(close,periodo1), color=color.gray, linewidth=1)
plot(ema(close,periodo2), color=color.green, linewidth=1)
plot(ema(close,periodo3), color=color.purple, linewidth=3)

//BANDA BOLLINGER - BANDS BOLLINGER
longitudbb   = input(20,title = "longitudBB, LenghtBB=", type = input.integer, step = 1, minval=1, maxval=50)
multbb       = input(2.0, title = "Multiplicadorbb, EstDesv = ", type= input.float, step = 0.2, minval=0.2, maxval=20)
fuente       = input(close, title="fuente", type=input.source)
[mm,banda_sup, banda_inf] = bb(fuente, longitudbb,multbb)
ps=plot(banda_sup, color=color.new(color.gray, 90))
pi=plot(banda_inf, color=color.new(color.gray, 90))
//fill(ps,pi,color=color.new(color.gray,80))

//PIVOT - PIVOTE
dist = input(6, title ="distancia para el pivote/ distance to pivot ", type = input.integer, step = 1)

pl = pivotlow(low, dist, dist)
if not na(pl)
    strategy.entry("Enter Long", strategy.long)

ph = pivothigh(high, dist, dist)
if not na(ph)
    strategy.entry("Enter Short", strategy.short)
//PIVOT - PIVOTE


Published by ChaoZhang on the FMZ strategy square · last modified 2022-05-08. 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.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/3EMA-Boullinger-PIVOT.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. 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

esc

Try , , or .

↑↓ move↵ open