Skip to content

Neural Network MACD

Neural Network MACD

Overview

Trades the turn of a small network that weighs the MACD signal line now against where it stood a few lags back - long while it reads above the threshold, short while below.

How it trades

  1. N = W1 × now + W2 × 1 lag back + W3 × 2 lags + W4 × 3 lags of the MACD signal line (Lag step bars apart).
  2. Above Threshold - long, below -Threshold - short; Entry on the sign change or on any bar.
  3. With Exit on opposite signal the position closes when N turns.
  4. The network is the Network MACD indicator - add it to a chart with the same settings to see what the strategy reads.

Parameters

Entry Signal

Parameter Default What it does
Signal bar offset (bars) 0 Which bar the network is read on: 0 = the last closed bar; 2 = the one two bars before it. The exit on the opposite signal reads the same bar.
MACD fast 12 The fast EMA period of the MACD the network reads.
MACD slow 26 The slow EMA period of the MACD.
MACD smooth 9 The period of the MACD's signal line (Avg) - the line the network weighs.
Lag step (bars) 3 How many bars apart the network's four readings of the signal line are: 7 = now, 7, 14 and 21 bars back.
Threshold 10 The network must read above this for a long and below minus this for a short; in between is no signal, so a network hovering at zero does not flip the position back and forth.
Entry On sign change Any bar: enter whenever flat and the network reads to one side - after an exit by ROI or a limit it goes straight back in. On sign change: only on the bar where the network crossed to that side.
Exit on opposite signal On Close the position as soon as the network reads the other way. Off: the position is left to the stop, target, trail, ROI and time exits of the core.

Weights

Parameter Default What it does
W1 (now) -3 The weight of the signal line on the signal bar. The network is W1 * now + W2 * one lag back + W3 * two lags back + W4 * three lags back.
W2 (1 lag back) 6 The weight of the signal line one lag step back.
W3 (2 lags back) 0 The weight of the signal line two lag steps back.
W4 (3 lags back) 0 The weight of the signal line three lag steps back.

Core settings

Order handling, position size, stops and targets, trade management, trading hours, account limits and the ML Engine are core settings - the same in every strategy. Hover a group or a core term for a short explanation.

Core defaults

This strategy starts with these core settings; change any of them in its settings.

Group Setting Default
NinjaTrader Calculate On bar close
Quantity Quantity 1
General properties Stop loss On
Stop loss Mode Ticks
Stop loss Ticks 80
General properties Profit target Off
Money management (off) Daily loss 500
Money management (off) Daily profit 500
Subsessions (off) S1 Start 03:00
Subsessions (off) S1 End 06:00
Subsessions (off) S2 Start 09:30
Subsessions (off) S2 End 12:00
Subsessions (off) S3 Start 13:00
Subsessions (off) S3 End 14:00
NinjaTrader Exit on session close On
NinjaTrader Exit on session close (s) 660

Version history

v.3.1.0.0 - October 2026

  • Changed: the network is read from the Network MACD indicator (with its lag step and threshold) - the strategy draws it on the chart.
  • Changed: the signal follows NinjaTrader's Calculate setting - On bar close by default; On each tick reads the forming bar.
Earlier versions

v.3.0.0.0 - October 2026

  • Rebuilt on the Strategy Core: orders, sizing, stops and targets, trade management, sessions, limits and the ML Engine are core settings.

v.2.1.0.0 - May 25, 2026

  • Direction forecast: added COT (Commitment of Traders) features.
  • Added contract quantity forecast module.

v.2.0.0.0 - Mar 9, 2026

  • ML Engine filter feature added.

v.1.1.0.1 - Oct 26, 2025

  • Trading hours and days logic updated — if all sessions are disabled, the strategy now runs without time restrictions instead of stopping trading.

v.1.1.0.0 - May 24, 2025

  • Added ROI function for trade exit.
  • Added session end position closing function.
  • Added descriptive names to exit orders for better understanding of position closure conditions.
  • Sort properties.
  • Improved position recovery function.

v.1.0.1.2 - May 29, 2024

  • Improved and optimized the function of raising the position after a signal interruption from the data provider.
  • Optimized the function of defining stop loss levels and profit target levels.
  • Shortened the display of the auto strategy name on the chart for easier chart viewing.

v.1.0.1.1 - Mar 14, 2024

  • Improved conditions for closing a position when the daily loss or profit is reached.
  • Changed parameter determining the priority of strategy position or account position.
  • Fixed the problem of strategy transition to the next state while placing an entry order.

v.1.0.1.0 - Dec 24, 2023

  • Improved conditions for partial fulfillment of orders.
  • Improved the function of raising the position after connection loss.

v.1.0.0.9 - Dec 1, 2023

  • Improved conditions for partial fulfillment of orders.
  • Improved the function of raising the position after connection loss.
  • Added functions for order execution log.

v.1.0.0.8 - Nov 12, 2023

  • Improved trading session time.
  • Improved the function of raising the position after connection loss.

v.1.0.0.7 - Sep 29, 2023

  • Improved the function of raising the position after connection loss.

v.1.0.0.6 - Sep 1, 2023

  • Added additional setting for specifying the trading session.
  • Added functions to raise position after connection loss.
  • Daily profit and drawdown functions can be used in backtest.
  • Added option to specify trading on specific days of the week.