Friday, May 10, 2013

Martingale Trading System

Since my crazy trading ride in 2007 which involved a martingale system, I have sworn never to try anything like that again!  As any trading professional will tell you, it is suicide for the retail trader.  It's like playing Russian Roulette but worse because you don't get put out of your misery at the end!

Ever since then, however, I've always told myself that if I learned how to program strategies and could automate the backtesting of them, I would want to see for myself the results for a martingale type system.  Well that day is finally here since I can program in Ninjascript and I'm sharing a simple strategy with anyone who wants to play with it, in NinjaTrader's Strategy Analyzer, and see for themselves why you should NEVER trade a system like this.

This chart explains and shows how the strategy trades, fading moves looking for a reversion toward the mean.  The default is a max position of 128 contracts.  Lots of the variables can be changed but it doesn't make any difference.  There are no settings that avoid huge drawdowns over time.  And sure, you can recode the strategy to go with a trend instead of fading it, but again, it won't matter in the end.

As I state in the strategy code, "This is a martingale strategy and is not recommended for anyone. There are ZERO ways to configure the variables to avoid an eventual huge drawdown. Recommend backtesting with ES only (due to liquidity) and using years of 1 min. data."

Here are a couple examples of results using 6 years of ES 1 min. data. In the first, system is looking for just 2 ticks of profit, on net position, on every trade:

Same settings but looking for 6 ticks of profit instead:

Feel free to download here, import the single Ninjascript assembly (not the 4 files) into your NinjaTrader, and explore for yourself. Let me know if you have any problems or questions.  And if you find any Holy Grail settings, let me know! :)

4 comments:

  1. Hi, I am playing around with your system and I am trying to use the time frame of 5:00 to 5:15PM. For some reason I can only get it to work on AM time frames. Any advice would be appreciated.

    ReplyDelete
  2. I believe you will have to edit the code to do that. There are 2 places in there that says time must before 2pm in order to initiate a trade. Change that to something later. In code it will say "ToTime(14,00,00)". The 14 is military time.

    ReplyDelete
  3. hello there, i am new and interested in Martingale trading system, but i don't know how to use your files because they doesn't seems to me a MT4 platform files.. can you help?

    ReplyDelete
  4. Llyas - the files are Ninjatrader files. I don't know MT4 at all so can't help with that. Sorry.

    ReplyDelete