How can I help you today?
Ask anything about your team, your trades, or the markets.
"Convert this PineScript and backtest it on ES futures, 2y window, base-hit MFE on."
//@version=5
strategy("VWAP Mean Reversion", overlay=true)
length = input(20, "EMA length")
band = input(1.5, "VWAP stretch (sigma)")
vwapVal = ta.vwap
sd = ta.stdev(close - vwapVal, length)
lower = vwapVal - band * sd
if (close < lower and close[1] >= lower)
strategy.entry("Long", strategy.long)
strategy.exit("TP", "Long", profit=24, loss=8)
from sigma.engine import StrategyBase, Signal
class VWAPMeanReversion(StrategyBase):
name = "VWAP Mean Reversion"
timeframe = "5m"
instrument = "ES"
params = {"length": 20, "band": 1.5,
"tp_ticks": 24, "sl_ticks": 8}
def on_bar(self, bar, ctx):
sd = ctx.stdev(bar.close - ctx.vwap, self.params["length"])
lower = ctx.vwap - self.params["band"] * sd
if bar.close < lower and ctx.prev.close >= lower:
return Signal.long(
tp=self.params["tp_ticks"],
sl=self.params["sl_ticks"],
russian_doll=True, # 40/35/25 split applied
)
"This passes our backtest gates · I can promote it to forward (paper) testing in The Lab. Bonnie will track performance for 30 days · if it stays within drift band, it auto-graduates to live and shows up in your group's strategy dropdown. Want me to publish to community as well?"