Japanese Yen 6J EMA Momentum Bot -- Python +70.5% Backtest

Japanese Yen 6J EMA Momentum Bot -- Python +70.5% Backtest

$0.00
Skip to product information
Japanese Yen 6J EMA Momentum Bot -- Python +70.5% Backtest

Japanese Yen 6J EMA Momentum Bot -- Python +70.5% Backtest

$0.00

 * +70.52% backtested return across 83 trades on CME 6J
    * EMA(8/21) momentum crossover with composite 3-factor score
    * Dynamic ATR stop-loss (trailing) + dynamic R:R (1.2-2.8)
    * 15% max-drawdown circuit-breaker baked in
    * Phase 2.5 calibration (60m signal / 5m execution) pre-applied
    * Python 3.10+ standard library only -- zero extra dependencies
    * 10+ labelled BROKER INTEGRATION: placeholders throughout
    * Works with IBKR, Alpaca, Tradier, NinjaTrader, and more
    * 479 lines, fully commented -- readable, not obfuscated
    * Educational use: study a real production-grade algo line by line


JAPANESE YEN FUTURES EMA MOMENTUM BOT  |  CME 6J  |  LONG  |  +70.5% BACKTEST

What if you could skip the months of research, indicator math, and infrastructure
debugging -- and start with a complete, documented, production-style Python
algorithmic trading bot ready to connect to your own broker?

This listing gives you exactly that: the full source code for an EMA-crossover
momentum strategy targeting CME Japanese Yen Futures (6J), built and run live
on September 14, 2026. Every design decision is commented. Every risk control
is explained. Every broker dependency has been cleanly extracted and replaced
with a labelled placeholder so you can wire in your own execution layer.

  Bot ID   : bar_6j_long_20260914_142933
  Created  : September 14, 2026 at 14:29:33 UTC
  Includes : Gen1 portable Python script (479 lines, fully commented)


================================================================================
BACKTESTED PERFORMANCE
================================================================================

  Instrument            CME Japanese Yen Futures (6J), front-month
  Direction             LONG only
  Backtest type         Bar-data simulation (historical OHLCV bars)
  Signal timeframe      60-minute bars  (Phase 2.5 calibration)
  Execution timeframe   5-minute bars   (Phase 2.5 calibration)
  -----------------------------------------------------------------
  Total Trades          83
  Win Rate              25.3%  (see FAQ -- by design, not a defect)
  Profit Factor         1.616
  Total Return          +70.52%
  Max Drawdown (raw)    34.5%
  -----------------------------------------------------------------
  Live Circuit Breaker  15.0% max drawdown hard-cap (session reset)
  AI Profit Probability 45%  (forward estimate at creation, not a guarantee)

IMPORTANT DISCLOSURE: This bot does NOT appear in the profitable_bots_ranking
database, which tracks only live-traded or rolling-forward-tested strategies.
The backtest above was performed solely on historical bar data -- past
performance does NOT predict future results. Always use the 15% drawdown
circuit-breaker and trade with risk capital only.

================================================================================
STRATEGY DEEP-DIVE
================================================================================

WHY 6J (JAPANESE YEN FUTURES)?
CME 6J is one of the most liquid currency futures, avg daily volume >100k
contracts. At creation: ATR=0.059% of price, trailing return=+4.25%, volume
trend=-2.5%. Regime: mature uptrend with weakening participation -- ideal for
asymmetric momentum strategies.

HOW THE ENTRY WORKS  (signal bar -- 60 min)
  1. Warmup gate: requires >= 20 closed signal bars.
  2. Composite momentum score (0-100):
       Trend   (50%): EMA(8) vs EMA(21) gap normalised by ATR(14)
       RSI     (35%): RSI(14) rescaled from 35-70 range to 0-100
       Volume  (15%): EMA5 vs EMA20 of volume (60 if healthy, 40 if not)
  3. Entry gate (all four must pass, relaxed mode -- threshold ~36):
       EMA(8) > EMA(21) AND close >= EMA(8)  [trend aligned]
       Price extension 0.0 - 1.3x ATR above EMA(8)  [mean-reversion filter]
       Volume EMA5 <= EMA20 x 1.1  [volume regime healthy]
       Momentum score >= 36  [composite gate]
  4. On pass: emit pending_signal with anchor price, stop distance, R:R.
     Signal expires after 8 execution bars (~40 minutes).

HOW ENTRY TRIGGERS  (execution bar -- 5 min)
  1. Require pending_signal (not expired).
  2. mid-price <= execution EMA(9) x 1.0015  [pullback filter]
  3. mid-price <= anchor_price x 1.0025      [no excessive chase]
  4. On pass: enter LONG, set ATR stop and R:R target.

DYNAMIC STOP (ATR x multiplier, trailing)
  ATR < 0.04%  -> 2.0x  |  ATR 0.04-0.08% -> 1.8x  |  ATR > 0.08% -> 1.5x
  Phase 2.5 calibration: minimum 5 ticks; multiplier fixed at 2.0.
  Stop ratchets UPWARD as price rises (trailing).

DYNAMIC R:R RATIO  (range 1.2 - 2.8)
  ATR < 0.04% -> R:R 2.3  |  0.04-0.08% -> 2.0  |  > 0.08% -> 1.7
  High momentum (score >= 46): +0.2  |  Low (score < 34): -0.2

FIVE EXIT TYPES  (priority order)
  1. 15% drawdown guard  -- hard halt, force-flat immediately
  2. Trailing protective stop -- ATR ratchet
  3. Soft profit target  -- entry + stop_distance x rr_ratio
  4. 30-bar time stop    -- ~150 minutes on 5m bars
  5. Signal invalidation -- EMA(8) crosses below EMA(21), score < 38

================================================================================
WHAT YOU RECEIVE
================================================================================

  bar_6j_long_20260914_142933_portable.py  (479 lines, broker-agnostic)
  - All Rithmic / Redis infrastructure removed; strategy 100% intact
  - Self-contained BaseTradingBot stub; no external dependencies
  - 10+ labelled # BROKER INTEGRATION: placeholder comments
  - Phase 2.5 calibration (60m/5m) pre-applied at module load
  - Fully commented: every method, parameter, and design decision

  Complete strategy logic preserved:
  EMA(8/21), RSI(14), ATR(14), composite momentum score,
  dynamic ATR multiplier, dynamic R:R, warmup gate, 15% DD guard,
  signal expiry (8-bar), trailing stop, soft target, time stop,
  signal-invalidation exit

  Standard-library only -- zero extra pip installs required
  (asyncio, logging, os, math, typing -- all built in to Python 3.10+)

  Works with any OHLCV data source:
  Interactive Brokers (ib_insync), Alpaca, Tradier, Tastytrade,
  NinjaTrader, Sierra Chart, TradeStation, or any custom feed


================================================================================
WHO THIS IS FOR
================================================================================

  Python developers exploring algorithmic trading for the first time
  Quant hobbyists wanting a real, backtested strategy to study
  Traders who want to understand how production CME bots are structured
  Anyone building a multi-bot portfolio wanting 6J/yen exposure
  Students of systematic trading, momentum strategies, ATR risk sizing
  Researchers comparing EMA-crossover variants on FX futures

  NOT a push-button money machine. Requires Python knowledge and a
  broker API. See FAQ below.


================================================================================
INTEGRATION QUICK-START  (5 minutes to first paper trade)
================================================================================

  Step 1: Python 3.10+ (no extra packages needed)

  Step 2: Environment variables
    export ALLOCATED_CAPITAL=100000
    export CONTRACT_POINT_VALUE=125000   # CME 6J standard

  Step 3: Subclass and wire your broker

    from bar_6j_long_20260914_142933_portable import Bar6jLong20260914142933

    class MyYenBot(Bar6jLong20260914142933):
        def open_position(self, direction, qty, price, stop=None, reason=""):
            # your_broker.submit_order(symbol="6JZ6", side="buy", qty=qty)
            pass
        def close_position(self, price, reason=""):
            # your_broker.submit_order(symbol="6JZ6", side="sell")
            pass

  Step 4: Feed bars
    bot = MyYenBot()
    await bot.on_bar_closed("signal",    {"open":x, "high":x, "low":x,
                                          "close":x, "volume":x})  # each 60m close
    await bot.on_bar_closed("execution", {"open":x, "high":x, "low":x,
                                          "close":x, "volume":x})  # each  5m close

  Step 5: Bot auto-manages signal, entry, stop, target, time stop, DD guard.

================================================================================
TECHNICAL SPECIFICATIONS
================================================================================

  Instrument                 CME Japanese Yen Futures (6J), front-month
  Direction                  LONG only
  Signal timeframe           60 minutes  (Phase 2.5 calibration)
  Execution timeframe        5 minutes   (Phase 2.5 calibration)
  Original timeframes        10m signal -> 2m execution  (preserved in code)
  Entry indicator            EMA(8) x EMA(21) crossover + momentum gate
  Momentum score             Composite: trend 50% + RSI 35% + volume 15%
  Stop type                  ATR-based, trailing (ratchets up)
  ATR period                 14 bars
  ATR multiplier             Dynamic 1.2x - 2.4x (Phase 2.5: 2.0x)
  Min stop                   5 ticks  (Phase 2.5)
  R:R ratio                  Dynamic 1.2 - 2.8  (typically ~2.0)
  Max drawdown guard         15% of account equity (session halt)
  Signal expiry              8 execution bars (~40 minutes)
  Time stop                  30 execution bars (~150 minutes)
  Contracts                  1 (configurable via num_contracts)
  Capital env-var            ALLOCATED_CAPITAL (default $100,000)
  Point value env-var        CONTRACT_POINT_VALUE (default $125,000)
  Python version             3.10+
  Dependencies               Standard library only (asyncio, logging, os, math)
  Lines of code              479


================================================================================
FREQUENTLY ASKED QUESTIONS
================================================================================

  Q: Does this require Rithmic or Redis?
  A: No. All Rithmic and Redis code has been removed. You supply the data
     (any OHLCV source) and the order execution (any broker API).

  Q: Why is the win rate only 25.3%?
  A: Intentional. The strategy uses asymmetric R:R (~2.0-2.3). At 2:1 R:R,
     a 34% win rate breaks even; 25% with PF=1.616 means winners are
     significantly larger than losers. This is a mathematically sound design.

  Q: Why does raw backtest show 34.5% DD but you advertise 15%?
  A: The raw backtest does not include the live circuit-breaker. In live
     operation the bot halts and flattens when drawdown exceeds 15%.

  Q: This bot is NOT in the profitable bots ranking -- should I be concerned?
  A: The ranking covers live-traded/forward-tested bots only. This is a
     bar_historical bot backtested at creation (September 14, 2026). It is a
     strategy blueprint with historical basis, not a live track record.
     Forward performance depends on whether the current regime resembles
     the trend regime at creation.

  Q: Can I paper-trade without a real broker?
  A: Yes. Override open_position() and close_position() with logging stubs.
     Promote to live once paper results satisfy your criteria.

  Q: Can I use this on instruments other than 6J?
  A: Yes. Update SYMBOL, CONTRACT_POINT_VALUE, and the TIMEFRAME_CALIBRATION
     block at the bottom of the file for your instrument.

  Q: Does the 15% drawdown cap reset daily?
  A: Session-based -- re-instantiate the bot to start fresh. Wrap in a
     daily scheduler or cron.

  Q: Is Gen2 included?
  A: No. Gen2 had no backtest data at creation time. Gen1 is the verified,
     fully backtested version included here.


================================================================================
RISK DISCLAIMER
================================================================================

This software is provided for EDUCATIONAL PURPOSES ONLY and does NOT
constitute investment advice, financial advice, or a solicitation to trade.

Futures trading involves substantial risk of loss and is not appropriate for
all investors. The 15% drawdown circuit-breaker is a software control -- it
does not eliminate risk. Bar-data backtests do not account for slippage,
commission, exchange fees, liquidity constraints, or live market microstructure.
Past backtested performance is NOT indicative of future results.

You are solely responsible for any trading decisions. Consult a qualified
financial professional before committing real capital. Only trade with money
you can afford to lose.

 

 

You may also like