Free · NinjaTrader 8 add-on · beta 0.3

Guard for NinjaTrader 8

Your limits are easy to set on a calm morning and easy to break at 3pm. Guard holds them inside NinjaTrader, where the orders happen: an order over your size is cancelled, a daily loss limit flattens you and locks the account until tomorrow.

Download LAYER0Guard.csVersion 0.3 beta · free · source code you can read

It's a beta. Test it on Sim101 before you trust it with a real account, and keep the daily loss limit at your broker too.

What it holds

Daily loss limitClosed trades plus the open position. When it's reached, the position is flattened and every new order is cancelled until the next trading day (17:00 Chicago).
Max contractsAn order that would take a position past your max is cancelled. If one fills anyway, the position is flattened.
No adding to a loserAn order that adds to a position while it's in the red is cancelled.
Max trades a dayAfter your last allowed round trip closes, the account is locked for the rest of the day.
Lockout after a loss20 minutes after the first losing trade, then 35, then 50. Orders that open or add are cancelled meanwhile.

Every limit is set per account, and any of them can be switched off. Limits can be tightened during the day, never loosened: raising one after a loss only counts from the next trading day. Orders that reduce a position (stops, targets, exits) always go through, so a lock never leaves a trade unprotected.

Install (5 minutes)

  1. Copy LAYER0Guard.cs to Documents\NinjaTrader 8\bin\Custom\AddOns\
  2. In NinjaTrader: New → NinjaScript Editor, then press F5 to compile. The bottom of the editor must show no errors.
  3. Restart NinjaTrader. New → NinjaScript Output should say “LAYER 0 Guard 0.3 is running.”
  4. The first run creates Documents\NinjaTrader 8\LAYER0Guard.xml. Open it in Notepad and add your accounts:
<GuardSettings>
  <LockoutMinutes><int>20</int><int>35</int><int>50</int></LockoutMinutes>
  <Accounts>
    <GuardAccountSettings Name="Sim101" DailyLossLimit="100" MaxTradesPerDay="3"
      MaxContracts="3" LockoutAfterLoss="true" NoAddingToLoser="true" />
    <!-- your real account, with the name exactly as NinjaTrader shows it -->
  </Accounts>
</GuardSettings>

Save and restart NinjaTrader. The account name must match NinjaTrader exactly (Control Center → Accounts). 0 switches a number off.

Test it on Sim101 first

Outside market hours, connect Connections → Simulated Data Feed to trade Sim101 with moving prices. Then try to break your own rules: place an order for one contract more than your max, add to a losing position, lose past a low daily limit. Each should be cancelled or flattened, and the Output window says why. Check that your stop still works while the account is locked.

What it can't do

  • It only sees orders placed through NinjaTrader, and only while NinjaTrader runs. An order from your broker's website or phone app goes around it, so keep the daily loss limit at the broker too.
  • NinjaTrader has no way to refuse an order before it's sent, so Guard cancels it the moment it appears. In a fast market an order can fill first; then the position is flattened at once.
  • It counts contracts, not their size: one NQ counts the same as one MNQ, though it moves ten times as much. Read the symbol before you click.
  • It runs on your own computer, so you can always get around it: delete the file, edit the settings, change the clock. Each takes deliberate steps. That pause is the point.

Good to know

Guard runs entirely on your computer. It doesn't connect to the internet and sends nothing anywhere: no account data, no trades, no usage. The download is the source code itself, so you or anyone you trust can read every line before compiling it. It's free, with no account and no email needed.

Guard holds the rules. LAYER 0, the app, works on why you needed them: a check of your state before every session, limits you sign on a calm day, a lockout after a logged loss, and a coach that reads your day every evening. If you trade a prop account, the Drawdown Ladder tells you how much to risk with what's left, and the Loss Check shows how you lose from your own trade export.

Start Free — No Card Required

Guard stops the order. LAYER 0 works on the urge behind it.

Start Free

Beta software, provided as is, without warranty. You are responsible for your own trades and accounts; test on a simulated account first. Not financial advice. NinjaTrader is a trademark of its owner; LAYER 0 is not affiliated with it.