NexusFi: Find Your Edge


Home Menu

 





Autotrading Slippage compared to Replay


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one TheGaryGuy with 8 posts (7 thanks)
    2. looks_two Big Mike with 2 posts (6 thanks)
    3. looks_3 djkiwi with 2 posts (25 thanks)
    4. looks_4 emini_Holy_Grail with 1 posts (2 thanks)
      Best Posters
    1. looks_one djkiwi with 12.5 thanks per post
    2. looks_two Big Mike with 3 thanks per post
    3. looks_3 artemiso with 3 thanks per post
    4. looks_4 TheGaryGuy with 0.9 thanks per post
    1. trending_up 8,485 views
    2. thumb_up 45 thanks given
    3. group 14 followers
    1. forum 15 posts
    2. attach_file 3 attachments




 
Search this Thread

Autotrading Slippage compared to Replay

  #1 (permalink)
 TheGaryGuy 
Bellevue, WA/USA
 
Experience: Advanced
Platform: NinjaTrader, TOS, TDAmeri
Broker: ThinkOrSwim, TastyWorks.com, TDAmeritrade, Interactive Brokers (soon)
Trading: Index and Stock options, Stocks (seldom), Nadex (just starting), Forex
Posts: 33 since Oct 2012
Thanks Given: 47
Thanks Received: 26

I have been building CL strategies for NinjaTrader for the last couple months and have some that perform well in SIM and replay. BUT when I ran with real, live, (MONEY) on friday, my strategies failed. Some of that loss was due to a "Another day of Churn". but at least 50% of the losses were due to auto-trading fills being -2 ticks on the entry and -7 ticks on the exit.

Has anyone else had this problem autotrading with NinjaTrader? And if so, how did you fix this problem?

Note: I am trading off the Renko charts (of various brick sizes).

thanks, Gary

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Could it be that currency futures are way easier to trade?
Currencies
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
Quant vue
Trading Reviews and Vendors
Trade idea based off three indicators.
Traders Hideout
 
  #2 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685

If you're comfortable with sharing: what order sizes/time frames/average holding periods are these? If the holding periods are short, just aggressively taking market orders is going to kill nearly any strategy. If the order sizes are a significant fraction of the average volume in the time scale (of the chart) that you are executing on, then market impact costs are going to outweigh all other slippage factors. To sum it up, the solution is that "It is nice to buy at the bid and sell at the ask." I think this is fundamental, but says nothing much you can do besides improve the strategy itself to remain profitable after taking into consideration the slippage.

There are a variety of ways you can improve things *slightly*. There are ways to reduce market impact (I think Johnson's DMA book has introductory bits on this). Otherwise, you can try provide liquidity on at least one side of the trade, at your desired price. You can find ways to determine an interval about the last price where you are confident that your limit will be filled. The overall profitability of the strategy will decrease because of lost opportunity cost, but this is unavoidable; you will encounter situations where you had the right signal but didn't get the fill and missed the price action. But this beats taking suicide market orders that are doomed to start with a 7 tick loss only to aim for a fraction of that as average gain.

I'm also presuming that the signal(s), minus the slippage, still possess the same edge as in your backtests, and so are not curve-fitted now that you have taken it live and out-of-sample. In that case, at least now you have an estimation of the slippages including the market impact cost to factor into your backtests. (It's harder to estimate the market impact cost than the execution cost from the bid-ask spread or latency.)

Reply With Quote
Thanked by:
  #3 (permalink)
 TheGaryGuy 
Bellevue, WA/USA
 
Experience: Advanced
Platform: NinjaTrader, TOS, TDAmeri
Broker: ThinkOrSwim, TastyWorks.com, TDAmeritrade, Interactive Brokers (soon)
Trading: Index and Stock options, Stocks (seldom), Nadex (just starting), Forex
Posts: 33 since Oct 2012
Thanks Given: 47
Thanks Received: 26


Artemiso, thank you for your rapid response. I am trading a single contract (due to this being a test strategy and first time auto-trading NinjaTrader) I am using a 6 Renko chart (6 ticks per brick or $60/bar on CL) and holding periods during normal trading hours for this strategy are 11.2 minutes (on Friday morning).

Because of the way that Renko bars are created, there is normally a lot of swing up and down above and below the closing price of the trigger bar before the next bar is formed. So with this in mind I tried to put in a limit order at the close of the trigger bar but that strategy did not work well. (even when I turned off Calculate at end of bar).

The strategies as they stood before Fridays live test were making around $50/trade on average, less than 50% were winning but winners were around 5 times the size of loosers. With a loss in slippage of around $90 per trade.. it could drain the account in a hurry (for a strategy I thought would be a winner).

Thanks for your help,
Gary

Started this thread Reply With Quote
Thanked by:
  #4 (permalink)
 
djkiwi's Avatar
 djkiwi 
Mercer Island WA
 
Experience: Advanced
Platform: Ninjatrader/Strategy Desk
Broker: Various
Trading: TF/NQ/ES/Stocks
Posts: 561 since May 2010
Thanks Given: 981
Thanks Received: 1,558


TheGaryGuy View Post
I have been building CL strategies for NinjaTrader for the last couple months and have some that perform well in SIM and replay. BUT when I ran with real, live, (MONEY) on friday, my strategies failed. Some of that loss was due to a "Another day of Churn". but at least 50% of the losses were due to auto-trading fills being -2 ticks on the entry and -7 ticks on the exit.

Has anyone else had this problem autotrading with NinjaTrader? And if so, how did you fix this problem?

Note: I am trading off the Renko charts (of various brick sizes).

thanks, Gary

Gary, unfortunately if you continue with this approach the odds are so mathematically stacked against you, you will lose all or nearly all of your money. I would seriously consider a temporary halt to this approach. Here is an extract from my financial trading plan (some numbers changed for confidentiality reasons) which illustrates some of the challenges (will explain this in more detail in a new thread at some point).

1. Financial Trading Plan - Scenario 1



Basically this scenario assumes you are trading CL using market orders on entries and exits. You place 1 trade per day over 200 days (ambitious) with 2 targets and 2 contracts per target. You have a 10 tick 1st target, 20 tick second target with a 10 tick stop.

Your probability of achieving the first target is 60% ad 35% the second target. Your slippage is 2 ticks but as you pointed out can be higher particularly in the 1st 30 minutes of trading.

Now look at cell F49 which shows the direct costs of slippage and commission is a massive 32%. This is equivalent of playing roulette with 11 zeros on the roulette wheel.

Even though this scenario is slightly profitable $3200 the sensitivity to loss is high. All you need is a slight drop in the winning % of 60% on the first target and the profit is toast.

2. Financial Trading Plan - Scenario 2



Scenario 2 assumes you place limit orders on entries and market orders on exits. You continue to place 1 trade per day with 2 targets and 2 contracts per target, same as scenario 1. The big difference is your targets are larger. Target 1 is now 30 ticks, target 2 is 60 ticks and the stop is 30 ticks.

Your probability of achieving the first target stays at 60% ad 35% the second target. Your slippage is still 2 ticks. Now look at cell F49 which shows the direct costs of slippage and commission is only 7%. This is equivalent of playing roulette with 2.5 zeros on the roulette wheel which is about house odds.

This scenario is much more profitable at $49,600 and the sensitivity to loss is lower. A slight drop in the winning % of 60% on the first target will continue to yield a profit.

3. Summary

-Use limit orders on entries and market orders on stops
-Use a minimum of 30 tick targets and stops. Based on extensive financial modeling the target quantum has the biggest impact on profitability. My research suggests the probability of retail traders trading profitably over the -long term with targets less than scenario 2 are slim to none. Bear in mind the ATR for oil for each 30 minute period which is another reason for using increased targets and stops on oil. You can see in the table below oil ATR for each 30 minute period. For example in the 1st 30 minutes it's 64 cents and then 71 cent average move over the next 30 minutes. This important volatility analysis is a critical actor when I'm trading different instruments.



Cheers
DJ

Reply With Quote
  #5 (permalink)
 TheGaryGuy 
Bellevue, WA/USA
 
Experience: Advanced
Platform: NinjaTrader, TOS, TDAmeri
Broker: ThinkOrSwim, TastyWorks.com, TDAmeritrade, Interactive Brokers (soon)
Trading: Index and Stock options, Stocks (seldom), Nadex (just starting), Forex
Posts: 33 since Oct 2012
Thanks Given: 47
Thanks Received: 26

DJ, Thank you for your response to my question.

First, please assume I do know some risk management, and will not trade my account into the hole.

I can tell by your response and great spreadsheets, you have done a lot of evaluation on the potential losses and gains from your strategies.

I must also tell you that my goal is to create a strategy (or several) that day-trade a single contract to a healthy profit each day. I have several reasons for this but they are not important at this time. I also have programmed exits from my trades and do not use a standard stop loss or target. So we have very different philosophy and trading styles. This is ok.

I do like your "odds of winning" and your 30 stop, 30 first target and 60 second target concepts, but I have not found high probabilities in asking the market to give me even a reliable 30 ticks from any trade opening. Perhaps your entry and exit criteria are well worked out and give you this expectancy, but remember my strategy is a work in progress, and my first attempt at "auto-trading".

Yes, my Friday strategy was using market orders for both entries and exits.. and got excellent fills in replay, but terrible fills in live trading. I did try using limit orders in replay, and very similar results to the previous replay results. I will try limit orders for entry it in the sim later today.

Started this thread Reply With Quote
Thanked by:
  #6 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518


Quoting 
I will try limit orders for entry it in the sim later today

Regarding to your strategy (with trend, countertrend) there are higher or lower execution risks. Your strategy eliminates risk due to market impact to zero - so we don't bother with that issue. You are an advanced trader so i don't want to spam you, but you can't test or evaluate execution risk in SIM mode. In NT you have settled values for slippage. I think it would be much more meaningful if you run your limit order tests on an real account.

Reply With Quote
Thanked by:
  #7 (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,460 since Jun 2009
Thanks Given: 33,234
Thanks Received: 101,655


TheGaryGuy View Post
losses were due to auto-trading fills being -2 ticks on the entry and -7 ticks on the exit.

Note: I am trading off the Renko charts (of various brick sizes).

Renko bars have false opens and cannot be backtested without using a secondary dataseries like a 1-range or 1-tick for execution. This is also probably why your strategy shows a profit, because of the false open. If the same strategy does not show a profit on a range bar, it's a clue the strategy is not profitable.

Switch to a range bar and you should see a high degree of matching between backtesting/sim and live.

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 TheGaryGuy 
Bellevue, WA/USA
 
Experience: Advanced
Platform: NinjaTrader, TOS, TDAmeri
Broker: ThinkOrSwim, TastyWorks.com, TDAmeritrade, Interactive Brokers (soon)
Trading: Index and Stock options, Stocks (seldom), Nadex (just starting), Forex
Posts: 33 since Oct 2012
Thanks Given: 47
Thanks Received: 26

Mike,

Thank you so much for your input.

I have noticed that as a new Renko bar is built the price can swing up just under 1 brick above the current bar to
just under 1 brick to the downside before it goes that extra tick and the candle is formed. So the open of the
candle happens at that time.

So while there is a 2 tick loss (similar to bid ask spread) on the open, I can happily accept 2 ticks (cost of doing
business) on entry.

However the 7 tick loss on close is confusing to me (and not acceptable). Why would market orders be 5 ticks
different on the opening of a short or long trade from the close market order?

By the way, I do find the strategy works fine with a smaller percentage slippage as I increase the brick size.
The number of trades goes down as well as the profit. and the size of max loss with this strategy increases too.
Once again a work in progress and still working.

In any case.. the biggest benefit of Renko bars (like HeikenAshi) is to make an incoherent market look coherent.
It makes it much easier to see trends, support and resistance, and patterns of price movement.
Strategies that use this information can be modified to successful time based strategies on any time period chart.

Thanks again for your great input and help,

Sincerely, Gary

Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 TheGaryGuy 
Bellevue, WA/USA
 
Experience: Advanced
Platform: NinjaTrader, TOS, TDAmeri
Broker: ThinkOrSwim, TastyWorks.com, TDAmeritrade, Interactive Brokers (soon)
Trading: Index and Stock options, Stocks (seldom), Nadex (just starting), Forex
Posts: 33 since Oct 2012
Thanks Given: 47
Thanks Received: 26

Hi Guys,

Thank you all for your posts on this topic. With your responses and a lot more study of charts and experiments I finally understand what is happening when trying to auto trade Renko charts.

When a Renko brick is formed the price must move 1 tick beyond the brick size, up or down from the open or close of the previous brick. Using a 6 tick Renko as an example
1. We just formed a red brick. Price is currently 1 tick below that close (bottom of candle)
2. Price rises to Open of red candle +7 ticks and we get a green candle.

When using historical backtesting with Ninja Trader, the backtest will show the entry into a trade at the open of the next brick. If the next brick is RED it will be pretty accurate. If the next brick is GREEN it will be WRONG as the open of the GREEN candle is 7 ticks above the close of the RED brick.

So, backtesting results will not match with either sim or replay due to this difference between Renko charts and normal candles or bar charts who's opens are normally equal or close to the close of the previous candle.

Summary: To be able to use Renko charts for auto trading it is best to avoid the larger brick sizes AND be ready to give up the brick size +1 tick on a triggered exit (if using calculate on bar close). So it is possible to build a auto trading Renko system but it is not as easy to verify with backtesting on the current version of Ninja Trader.

Thanks for all your input and help.

Gary

Started this thread Reply With Quote
  #10 (permalink)
 
djkiwi's Avatar
 djkiwi 
Mercer Island WA
 
Experience: Advanced
Platform: Ninjatrader/Strategy Desk
Broker: Various
Trading: TF/NQ/ES/Stocks
Posts: 561 since May 2010
Thanks Given: 981
Thanks Received: 1,558


Gary, yes that is true on Renko bars. Have you tried Better Renko bars? I've been using Better Renko for a few years now without the issues of the stock Renko.

Here is a note from Mike who has a ton of experience backtesting/forward testing these bars



Cheers
DJ

Reply With Quote
Thanked by:




Last Updated on October 27, 2013


© 2024 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 - Privacy Policy - Downloads - Top
no new posts