Skip to main content
Home / Guides / NinjaTrader 8 / Optimise a PFX strategy
Guide · NinjaTrader 8 · about an hour, then the PC does the rest

Optimise PFX SLM or HTF on your own data.Without fooling yourself.

Written by Dan Freeman · last checked

The PFX SLM and PFX HTF strategies ship with a kitchen-sink template: one optimisation that searches the settings that matter, on your instrument, your dates and your costs. This guide takes you from the download to a result you can trust, or to the honest answer that there isn't one. No results are shown until a strategy has an out-of-sample test, and when they are, the optimised numbers sit next to the out-of-sample ones so you can see the difference.

~1 hourof your time
9 stepstick each one off
20,000tests per run, at most
Freeboth strategies
!
An optimiser always finds settings that look good.

That is the search working, not an edge. Every step after step 5 is about one question: does the result survive data it never saw? Most will not, and knowing that before you risk money is the point.

0

Before you start

Four quick things. Tick them as you go.

1

Install the strategy

One zip, one import, one folder copied.

  1. Download the strategy from its page: PFX SLM Strategy or PFX HTF Strategy, and extract the zip.
  2. Already have the matching indicator download? Remove it first: Control Center → Tools → Remove NinjaScript Assembly → PFX_SLM_NT8 (or PFX_HTF_NT8) → Remove, then restart NinjaTrader. The strategy download already contains the indicator.
  3. Control Center → Tools → Import → NinjaScript Add-On → pick PFX_SLM_Strategy_NT8.zip (or the HTF one). Restart when it asks.
  4. Copy the templates folder from the download into Documents\NinjaTrader 8. Say Yes to merge folders.
Documents\NinjaTrader 8
Not seeing it?

The import fails and mentions duplicates or existing files. The indicator download is still installed. Remove it (point 2) and import again.

No templates in the Strategy Analyzer later. The folder must end up as Documents\NinjaTrader 8\templates\Strategy\PFXSLMStrategy. Copy the whole templates folder, not the files inside it.

2

Load the kitchen sink

One template sets the whole optimisation up.

  1. Control Center → New → Strategy Analyzer.
  2. Strategy = PFX SLM Strategy (or PFX HTF Strategy).
  3. Template → PFX SLM Kitchen Sink - MGC 3m or PFX SLM Kitchen Sink - MNQ 3m (HTF: PFX HTF Kitchen Sink - MGC 3m / PFX HTF Kitchen Sink - MNQ 3m).
  4. Check it loaded: Backtest type = Optimization, Optimizer = Genetic, and the searched settings show a range (a start, an end and a step) instead of one number.
Every other setting stays at the strategy's own default. Nothing in the template is anybody's tested result. It is a search, not a preset.
Not seeing it?

Every setting is a single number. The template did not load. Re-copy the templates folder (step 1) and restart NinjaTrader.

3

Set your own commission

Costs change which settings win, not just the totals.

  1. The template starts on NinjaTrader Brokerage Free, NinjaTrader's own fees, so a test is never cost-free.
  2. Find the Commission setting and pick the template for your broker. Not listed? Create one with your fee per contract per side (NinjaTrader Help: Commission templates), then pick it.
  3. Keep Include commission ticked and Slippage at 1 tick or more.
Why it matters. A setting with 500 trades pays the commission 500 times; one with 100 trades pays it 100 times. Wrong costs pick the wrong winner.
4

Split your data in two

The most important step in this guide.

  1. Instrument: the template says MGC or MNQ. Pick the market you trade and its current contract. The settings are in ATR and ticks, so other markets work too.
  2. In-sample (searched): the older two thirds of your history. The template is set to 1 January 2026 to 31 August 2026.
  3. Out-of-sample (kept back): the newest third, everything after the in-sample end.
  4. Write the out-of-sample dates down now, before you see any results. You will not look at them until step 7.
In-sampleOut-of-sample
What it is forSearching for settingsChecking them, once
How muchAbout two thirdsAbout one third, the newest
May you change settings because of it?YesNever
5

Run the optimisation

Then let the PC work.

  1. Optimize on = PFX profit / drawdown (50 trades). It ranks net profit against the worst drawdown and scores any setting with fewer than 50 trades as zero, so a lucky handful of trades cannot win.
  2. Press Run. The SLM template searches 15 settings at once (1,593,188,352 combinations), HTF 14 (768,144,384). The genetic optimiser tests up to 20,000 of them.
  3. Expect a few hours. Let it finish.
6

Read the results honestly

Look at the top 20 rows, not just the first one.

CheckKeep a row only if
Trades100 or more in the in-sample window. Fewer is a coin toss.
NeighboursRows with similar settings also do well. A lone spike is noise; a plateau is worth testing.
EdgesThe setting is not at the very end of its range. If it is, widen that one range and run again.
DrawdownYou could sit through it with real money, at the size you would really trade.
SimpleWhen two rows are close, prefer the one with fewer filters switched on.

Pick three to five rows that pass and write each row's settings down.

7

Test out-of-sample

Once per row. No second tries.

  1. Set Backtest type = Backtest and the dates to your out-of-sample window from step 4.
  2. Type in each row's settings and run it once, with the same commission and slippage.
  3. Do not tweak and re-run. The moment you change a setting because of this result, that data is no longer out-of-sample.
A row that loses, or is much worse than in-sample, failed. If every row fails, the honest answer is that the strategy has no edge on that market and timeframe with your costs. Try another market or timeframe, or stop there. That answer just saved you money.
8

Sim first, then small size

Weeks, not days.

  1. Open a chart of the market and timeframe you tested. Add the strategy with a surviving row's settings, Account = Sim101, and enable it.
  2. Leave it for weeks. Compare its fills, costs and results with what the test led you to expect.
  3. Only if Sim matches: one micro contract, on an account you can afford to lose.
!

On a live account it places real orders

Through NinjaTrader, on your account. The PFX Perps Bridge inside it stays Off unless you trade BTC or ETH on MyFundedPerps and have followed its own guide.

What each kitchen sink searches

The ranges, in full.Everything else stays at its default.

Entry on a confirmation close, same-bar ties counted as stops, New York session hours, the trade log off and the PFX Perps Bridge Off are pinned on purpose.

PFX SLM Strategy 2.37

SettingRange searched
Swing length (bars) for structure SwingLen2 to 12, step 2
Require a change of character RequireChochOn / Off
How far back a gap may be (bars) FvgBack10 to 70, step 20
Smallest gap (x ATR) FvgMinAtr0.3 to 1.5, step 0.2
Largest gap (x ATR, 0 = no limit) FvgMaxAtr0 to 3, step 0.5
Entry depth into the gap (%) RetracePct30 to 90, step 10
Trade only with the EMA bias UseBiasGateOn / Off
Bias EMA length BiasGateEma20 to 200, step 30
Target (x risk) TpRunR0.5 to 2, step 0.3
Smallest stop allowed (ticks) MinRTicksMGC 0 to 60 step 20, MNQ 0 to 120 step 40 ($0 to $60 a contract)
Structure filter UseStructFilterOn / Off
Move the stop to break-even RunBEOn / Off
Time exit TimeExitOn / Off
Session start hour (New York) SessionStart0 to 20, step 4
Session end hour (New York, start = end means all day) SessionEnd0 to 20, step 4

PFX HTF Strategy 1.08

SettingRange searched
Swing length (bars) for structure SwingLen2 to 12, step 2
Smallest higher-timeframe gap (x HTF ATR) HtfMinAtr0.35 to 2.75, step 0.3
Largest higher-timeframe gap (x chart ATR, 0 = no limit) HtfMaxAtr0 to 3, step 0.5
Setups armed per gap MaxHtfSignals1 to 3, step 1
Entry depth into the gap (%) HtfRetracePct30 to 90, step 10
Trade only with the EMA bias UseBiasGateOn / Off
Bias EMA length BiasGateEma20 to 200, step 30
Target (x risk) TpRunR0.5 to 2, step 0.3
Smallest stop allowed (ticks) MinRTicksMGC 0 to 60 step 20, MNQ 0 to 120 step 40 ($0 to $60 a contract)
Structure filter UseStructFilterOn / Off
Move the stop to break-even RunBEOn / Off
Time exit TimeExitOn / Off
Session start hour (New York) SessionStart0 to 20, step 4
Session end hour (New York, start = end means all day) SessionEnd0 to 20, step 4
All done

You tested it yourself.That is the whole idea.

Whatever the answer was, it came from your data and your costs.

Risk warning: Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one's financial security or lifestyle. Only risk capital should be used for trading, and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

NinjaTrader is a registered trademark of NinjaTrader Group, LLC; PrecisionFX is not affiliated with or endorsed by NinjaTrader.