Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Bid Ask Spread cost simulation using Slippage Parameter
Collapse
X
-
Matthew, there were changes to a new API for BarChart in our upcoming NT7 beta, where I believe this should work as well for this connection with 'Immediate Fills' turned on. It's in closed beta still with a public one expected sooner than later, for beta requests you could email or sales team at sales at ninjatrader dot com.
Thanks
-
Thanks Bertrand,
It sounds like I need to get the NT7 in order to do paper trading with limit orders properly via the barchart.com datafeed. I am not so attached to barchart.com though... I just signed up with them so that I could get some real time data to test on, I don't remember what my criteria for selecting them were.
I have emailed Christopher re his offer of putting me on the NT7 list, so hopefully I will get access to the beta soon.
For me NT7 would be incredibly useful right now if it can do the immediate fills correctly through barchart.com, because at the moment I have a system that gives nice backtests but requires tight cost controls through limit orders, which I currently cannot simulate in paper trading due to this slow fill issue.
Thanks,
Matthew.
Comment
-
Hi,
I have to come back to this issue now.
Some points for clarity:
1. I am now using NT7 and only using market orders. So please let's not talk about stops, limits or any other type of order. I am using market orders and market orders is what I am talking about.
2. It should not matter whether or not I use MACO or any other strategy, the way that slippage applies is independent of the strategy. If I compare "with finite slippage" to "with zero slippage" trades for ANY strategy, then I should see a difference for every trade. The difference should be proportional to the value of the slippage parameter (with the constant of proportionality being a matter of units and a factor of 2 due to a "trade" consisting of two legs for a roundtrip, an entry and an exit).
3. I got the same problem with NT 6.5 as the previous posts on this thread illustrate.
I hope that NT take on board point 1 so that we do not talk about Stop or limit orders here, and agree with statement 2? If statement 2 is incorrect, then could somebody please explain why.
Okay. Phew! :-). So, the problem is that when I run with and without slippage, the entry and exit prices are the same for most trades (but not always all) regardless of the value of the slippage parameter.
This is how I understand things should be:
For a long trade without slippage:
Profit = (exit-entry)
If there is slippage then:
Profit = (exit - entry - (2*slippage))
But I am not seeing this 2*slippage (i.e. spread) being charged for in NT6.5 or NT7.
I do not understand this. What is NT definition of slippage and how does it apply it? If my idea of how backtests should apply slippage to market orders is incorrect, then please explain.
At the moment it is difficult for me to test my systems profitablity with finite slippage, because even with slippage=128, I get an incredibly similar profit. Which is clearly incorrect.
below is code for a simple Strategy which just enters a Long position by Market order and then exits it after 120 bars.
When I run it with slippage=0 and slippage=2, there is no difference whatsoever in the orders, trades, executions or profits. Image of trades tab attached.
Can someone at NT run this simple strategy and confirm/otherwise the situation? I ran it on EURUSD FOREX 1 second data from GAIN, but it applies for othe FOREX data also.
Thanks,Code:#region Using declarations using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Indicator; using NinjaTrader.Gui.Chart; using NinjaTrader.Strategy; #endregion // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { /// <summary> /// Just enters one trade to test application of slippage. /// </summary> [Description("Just enters one trade to test application of slippage.")] public class testSlippage : Strategy { #region Variables #endregion protected override void Initialize() { CalculateOnBarClose = true; } int timeCounter = 0; protected override void OnBarUpdate() { if ( timeCounter == 0 ) EnterLong(100000); if ( timeCounter == 120 ) ExitLong(100000); timeCounter += 1; } #region Properties #endregion } }
Matthew.
Comment
-
update
1. I tried the test I posted below on daily MSFT and the slippage does show up as expected.
2. I tried the test on daily FOREX, and the slippage does show up although with a slippage setting of 2, it shows up in the tenth of a pip - not a full pip. So if you use fractional pips (Which we all should be? Why not?), you need to put slippage = 10 * spread / 2 to simulate the spread if spread is in full pips. E.g. a 2 pip spread must be entered as slippage = 10.
3. The slippage value has no effect on 1 second FOREX bars.
Can NT post the exact formulas for calculating how the slippage parameter affects the entry and exit prices?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
61 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
40 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
21 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
23 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
51 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment