NexusFi: Find Your Edge


Home Menu

 





Backtesting and bid-ask spread


Discussion in NinjaTrader

Updated
    1. trending_up 3,122 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
Tricks
Neaples Italy
 
Posts: 2 since Mar 2015
Thanks Given: 0
Thanks Received: 0

Hi.
I use NT7 with imported 1 min forex data, that Ninjatrader handles by considering only bid prices.

I saw there is no way to include bid-ask spreads into backtesting, so my workaround is that of setting a commission, then backtesting with "Include commissions" set to true, and simulating trades with a fixed lot size, proportional to commission.

Example:
- I want to backtest on EURUSD, assiming a bid-ask spread o 1 pip.
- On Instument Manager I set Minimum Commission = 0.5 (because it's per side).
- I backtest assuming single trades with 10000 units, so that I pay 1 pip = 1$ per trade and the spread is equalized the commission.

This is all good and working if I want to test the pure signal, or if I'm using a fixed lot type position sizing.

But, let's assume that the lot size traded depends on an ATR stop so that the lot size is variable every time.
In this case I would pay a 1$ spread for every trade, regardless from lot size, and the equity line would be wrong.
This means that I can backtest this kind of strategy only without commission.

Any way to work around the problem?
Would I have this problem were I using Kinetick?
What's another backtasting platform that would not have this inconvenience?
(I'm testing Seer Trading, but it has bugs loading historical data)

Thank you.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NYSE Owner ICE Invests in Crypto Exchange OKX at $25 Bil …
Cryptocurrency
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557

You can do it with GomRecorder and also I think Gom Tookit for Strategies





Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
Tricks
Neaples Italy
 
Posts: 2 since Mar 2015
Thanks Given: 0
Thanks Received: 0


I just saw it can be done using the 'Slippage' options from the Backtester.

I use Slippage instead of Commission so, for a 1 pip spread I set a 0,5 slippage.

Slippage can also be set through NinjaScript and the 'Slippage' keyword.


Reply With Quote




Last Updated on March 25, 2015


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts