Wednesday, April 24, 2013

ZS1 System

2:20pm CDT - Well after much head banging, compiling, editing, and compiling again, I have finished coding my ZS1 system strategy in Ninjatrader.  This was certainly a learning opportunity and I'm sure I'll be quicker coding future strategies.  Plus ZS1 was never designed with "ease of coding" in mind.  In fact, there was one alternate entry in ZS1 I didn't even bother coding.  More on that later.  But here's the P/L curve:
And here's the exact same period below (same 1 lot trades, same commission/slippage) that I had recorded over past year into Excel after scrolling through the charts and seeing where I would have entered and exited following the same rigid rules I coded into the chart above.
Not quite identical eh?  In fact, they barely look related at all.  Perhaps my alternative entry played a bigger role than I thought?  I may have to look at that more.  And my Ninja code did not consider fast or slow markets - it took every trade.  I'm sure I filtered out some trades during news, etc. in my manually recorded backtest.  And I'm sure there are other reasons that don't come to mind.

A few numbers for you from the Ninja backtest: 135 wins, 114 losses (net after slippage & commissions) or 54.2% win rate. Avg$Win = $211, Avg$Loss = -$217.  Avg$Net per trade per contract is just $14.80 or just over 1 tick.  Not great!

Keep in mind this is all the data I can get for this strategy since it does not use time-based charts.  Normally I would like to test years of data which I can only do with 1-minute or higher timeframes.  And even minute based timeframes aren't easy to test in the grains because I do not have access to a reliable continuous contract.  I have to test each contract separately and piece together.  Below is what I sent both Ninja and DTN:IQ last month but they have no solution.  IQ sets the continuous contract rollover dates based on the contract specifications. 


  1. Rollover or adjusting for continuous contracts are not set on your end (cannot be changed through Ninja) - it is set by the data provider.

  2. Is $11.40 for commission and slippage per side, or per round trip? I typically use $25-$30 per RT for Beans, but I don't enter on limit orders.

  3. JMF - thanks yes, as I learned from Ninja and IQ Feed. It's crazy they can't allow you to customize this!

    Kevin - that is per round trip and is based on my experience with ZS and this system which uses limit orders for about 1/4 of the fills. As long as you are trading less than 5 or so contracts, 1/2 tick slippage per round trip with stop orders to enter and exit (when stopped) is about the norm. I believe when you set stop orders to enter in advance, you are slightly higher in the queue than if you wait for price to hit that level and send a market order. I could be wrong and would be curious if anyone knows this. Of course if you assume $25-30 you are really conservative and safer but I can tell you that you will not average 1 tick of slippage per side unless you are throwing some size.

  4. Thanks MBA, but shouldn't 1/2 tick slip per side be $12.50 total, and then you have to add $5 commissions, for $17.50 total? If you are in the queue first, you'll get filled first (except for markets like Eurodollar, which have non-FIFO fill algorithm). The one other benefit to being conservative with slippage is that it usually leads you to trade less (fewer trades = less slippage). This might be important if your system trade multiple times per day - it might lead you to trade only 1-2 times per day, with higher quality trades.

  5. according to this you have to do cont. contract yourself by specifying rollover dates for back testing purpose. ##-## is not good for back testing.

    1. Much thanks for link Cory - just read it over. That seems to work!! Why didn't Ninja or IQFeed tell me this? It certainly wasn't intuitively obvious to me that you could display the current front month contract and get all the previous ones with the proper merge policy settings! I'll have to test this more to see if I'm dreaming...

  6. Kevin, I am assuming 1/4 tick per side avg. or 1/2 tick ($6.25) per round trip. I agree with trading less per day to keep your costs down but then again, if I can consistently make NET 1 or 1.5 ticks per trade per contract on a day trading system, with manageable drawdowns, I would trade it! ZS1 does not fit that bill (so far...).