Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Trading Platform Limitations

October 18, 2015 by Shaun Overton 6 Comments

This post was authored by Ben Fulloon, a respected trader and subscriber to OneStepRemoved.

I developed an awesome strategy with a drawdown ratio of 13.67. Sounds amazing, right? Too bad that my trading platform overstated the results by more than double!

It’s important to learn about both your brokers and platforms limitations. Sometimes these intricacies only become apparent through time and experience. It’s so frustrating when your trading platform doesn’t function or report results as expected.

In this article I’ll point out two limitations of NinjaTrader 7, one bad limitation and one which can actually turn out surprisingly better for the trader in certain situations. However, this is more to do with the broker I’m using and not the platform itself.

NinjaTrader is definitely not the only platform that has limitations: MetaTrader, TradeStation, X-Trader, Matlab, etc. all have limitations for quantitative finance.

I’ll just be writing about NinjaTrader in this article to keep it fairly short and easy to read. I am also not intending to make out NinjaTrader as being a bad platform either. But, there are definitely some improvements that could be made to make it a lot easier and more convenient for quantitative traders to develop and trade strategies.

The first quirk relates to the broker I’m using. Specifically, it’s the day trade margins that I care about. These day trade margins end 15 minutes before the close of the session. For instance the ES (Emini S&P500) has a day trade margin of $500, which ends at 4:00pm CT that then reverts back to the full trading margin of $5060 before the session closes at 4:15pm CT. (Times stated are correct at time of Writing, The ES now closes at 4:00pm CT and the Day Trade margin ends at 3:45pm CT)

I’ll show you a screenshot of the results of a day trading strategy that I developed. This strategy trades the ES, NQ (Emini Nasdaq 100) and the YM (Emini Dow) all at the same time. The easiest way to exit on close with NinjaTrader is setting “Exit on Close” to true which will then exit on the close of the session.

All trades together in the report

According to the results the strategy makes a total of $332,771.60 with a maximum drawdown of $25,912.27 since 2008 to now. This is a drawdown ratio of 12.84. That’s oustanding!

The issue is… and you knew there’d be a problem… is that the strategy exits at 4:15pm CT. Day trading margin ends at 4:00pm CT. The strategy is therefore highly likely to get a margin call with a small account size.

It makes sense to tweak the strategy to make best use of the day trading margin. Ninjatrader offers a custom session template, which in this case I made end at 4:00pm CT. The results of the custom session template is as follows.

Day trading with all instruments together

The exact same strategy applied to the same instruments to avoid a margin call makes $335,819.30 with a maximum drawdown of $24,560.51. This is a drawdown ratio of 13.67.

I didn’t change the strategy with the goal of improving the drawdown ratio AND the profit. But hey, I’ll take it. Finding a limitation in the platform can actually benefit you in some situations.

This strategy is based on trading 3 different instruments. The ES, the NQ and the YM. The problem is that I backtested it using an instrument list in NinjaTrader. What this means is they’re all tested separately. NinjaTrader then combines the test results for you as a total result like the results of the screenshots above.

Here’s what it looks like when you test them as an instrument list. This shows the different profits and drawdowns of the individual instruments.

Results by instrument

Now at first glance it reads that the trader would have made $335,819.30 with a maximum drawdown of $24,560.51 if they traded all three instruments together. Don’t you agree?

The problem is that this is incorrect. NinjaTrader doesn’t actually combine the results like you’d think. The trader still would have made roughly that money. However, all the statistics aren’t quite correct.

To show this I recreated the exact same strategy however it will trade the ES, NQ and YM all at the same time instead of trading them separately like it does by default. These are the results when you program it into a multi-instrument strategy

Combined trading

It makes $335,915.30 which is roughly the same amount, but it has a maximum drawdown of $59,937.60 instead of the $24,560.51 it originally looked like it would be. This makes it a drawdown ratio of 5.60, which is a lot worse than the original 13.67.

If the trader decided to trade based upon the maximum drawdown of $24,560.51, they may get a nasty shock when the drawdown turns out to be twice as bad as they were expecting.

Incorrect calculations on such an important metric could jeopardize an account. You might assume that you can get away with half of the equity that’s actually required to trade the strategy. Oops?!?

The misleading statistics in NinjaTrader makes this strategy look really nice. But when the drawdown is more than double what it appeared that it would have been originally, you might get a nasty shock.

This is why it’s important to learn both your platforms and brokers limitations as early as possible. You don’t want to learn these limitations the hard way.

In a few weeks time, I’ll reveal a simple way to create multi-instrument strategies which show more accurate metrics. Stay tuned for my next article in the series.

Filed Under: NinjaTrader Tips, Test your concepts historically Tagged With: drawdown, ES, futures, margin call, NQ, portfolio allocation, YM

SPY Crisis Strategy

October 11, 2013 by Shaun Overton 3 Comments

Yesterday’s musings on an S&P 500 doji strategy led to a general discussion of stocks and market crises. I promised to analyze a price-moving average cross strategy and to analyze the performance in times of exceptional volatility.

The results are in and they’re exactly what I predicted. I’m shamelessly tooting my own horn on this one – it’s so rare where strategies do exactly what I predicts.

SPY Crisis Strategy Returns

The direction of the returns matches any traders definition of crisis and regular trading periods over the past decade

SPY Crisis Strategy Rules

The trading rules only initiate short trades. No long positions are allowed.

Enter short next bar at market when:
The price crossed and closed below the 20 day SMA on the last closed bar
The trader believes that a crisis environment either currently exists or is about to exist

Exit an open short trade when:
The price crosses and closes above the 20 day SMA on the last closed bar

The position size is equal to a fixed dollar value divided by the current share price. As an example, SPY currently trades at $169.24. If you wanted to control a position size worth $1,000, then the number of shares is the floor of $1,000/$169.24 = 5 shares.

This strategy is intended to be timely for the current trading environment. Based on all of my proposed definitions below, most of the crisis alarm bells are ringing at the moment.

Defining a crisis

The most difficult part of this type of strategy comes from defining a “crisis environment” quantitatively. Crises don’t happen very often by definition, so I don’t think it’s a worthwhile endeavor to try to quantity the crisis bit. That said, a few obvious crisis indicators come to mind based on basic market mechanics.

PE Ratio

The morons on Tout TV (CNBC and company) keep on screaming how cheap stocks are. I’m not a fundamental trader, but the PE ratio contains useful information. Even the most hard core technical analysis buff would agree that companies generating huge positive cash flow and earning growth have to appreciate at some point. The argument isn’t about if that type of stock will rise; it’s just a question of when.

I don’t see how anyone could possibly look at the current PE ratio of 19.3 and argue that stocks are cheap. They aren’t. Stocks are currently very expensive based on a historical comparison.

VIX

VIX is a CBOE benchmark index that allows traders to compare the price of front month options traded on the S&P 500. A more detailed explanation of the VIX is available on Wikipedia if the concept is new. There’s nothing magical about the 20 level. It’s my general experience that most traders consider that number the one to watch. They think of VIX < 20 as "normal" and VIX > 20 as a severe market move.

VIX danger level

Most traders regard a VIX above 20 as a dangerous level.

Put-Call Ratio

Options are effectively leveraged bets on market movements with fixed downside risk. When traders load up on puts, they’re expecting the market to fall. When traders buy more calls, they’re expecting the market to rise.

The put call ratio is simply the number of put contracts traded / the number of call contracts traded. A number > 1 means that more puts were purchased that day than calls, indicating an expectation of a market drop.

Theory has it that short term traders are wrong, making the put call ratio a contrarian indicator. I see the put call ratio as more of a lagging indicator.

ES Put call ratio

When a move is real and already happened, traders react too late and buy protection that they no longer need. The 2008 financial crisis a great example when the ratio spiked to 1.5, a wild number. Just in the past week the ratio went as high as 1.3 before settling back down. The volatility in the number indicates a panicky crowd in my opinion.

Margin debt

Leverage is a two way sword. The theory is that it’s a way to multiply returns by risking debt in the market.

Most traders, and especially retail traders, wind up using leverage as the rope to hang themselves with. Stocks are most commonly purchased with cash among investors. Unlike forex and futures where almost every trader enters a position with leverage, the average retail stock trader enters a position using only the cash present in his account.

An increased willingness among traders to move from cash to margin debt is typically a sign of froth, bubble fever or whatever you want to call it. The chart of margin debt from Business Insider and Zero Hedge show that stocks are currently trading near historical highs.

margin debt business insider

Margin debt Zero Hedge

Conclusion

The 20 day SMA price cross strategy is a great way to run account protection whenever market warning signs are going off. The warning signs may not predict the precise market turning point, but the strategy can function as an effective form of insurance.

The strategy would roughly break even over time if someone were foolish enough to run it that way. Say that you mistime the crisis. Big deal. This type of strategy can run for months without causing irreparable harm to the account.

The signals can run in the background. If you’re only a little bit right with your crisis predictions, the risk reward ratio is massively in your favor. If you’re wrong, the consequences appear to be slow losses that lose a couple of percentage points per quarter. If you’re feeling edgy, I think it’s a great strategy to run in the background to calm your mind.

Filed Under: Trading strategy ideas Tagged With: contrarian, dot com bubble, ES, etf, financial crisis, forex, futures, margin debt, moving average, Put call ratio, risk reward ratio, S&P 500, SPY, stocks, VIX, volatility

Fibonacci Fluff

January 16, 2013 by Shaun Overton 5 Comments

I read a post on Zero Hedge highlighting an alleged Fibonacci time pattern. The chart shows a convincing countdown between the March 2009 low and an exponentially decreasing time period between market peaks.

ES Daily chart

The ZeroHedge post claims to find a Fibonacci pattern in the ES low going back to 2009.

I would expect the pattern to show up in other instruments if the observation had any merit. It’s well known that the strength or weakness of the US dollar largely drives the price movements in equity indices, especially in the S&P 500.

If it shows up in the SPX ETF, surely a similar patten would appear in EURUSD? It’s the most liquid and actively traded forex pair in the world.

A quick look at the EURUSD doesn’t give any encouragement.

Fibonacci time

A current look at the EURUSD doesn’t show any relationship to the ZeroHedge Fibonacci time observation

I even did some cherry picking in the drawing to get the time span between trends to decrease. My original drawing counted the 128 and 97 day periods as a single group.

A lot of readers out there swear by Fibonacci price movements. I’m not sure how many subscribe to analyzing time with Fibonacci.

Do you think it’s a useful tool? Let me know what you think by leaving comments below.

Filed Under: What's happening in the current markets? Tagged With: ES, eurusd, Fibonacci, forex

FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.