Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

Don’t Bet the Farm

August 8, 2011 by Shaun Overton Leave a Comment

I gamed out all of the various scenarios and felt that I had a good understanding of how I would make and lose money on the trade. Sometimes, though, you depend on a few key assumptions without realizing it.

In July, I bought the front month options (August/September) and sold a back month (December) on VXX thinking I would a) earn the heavy skew present in the distant options and b) earn the rising deltas associated with front month, which would increase faster than the back month. As last week and today showed, I was certainly correct to expect higher volatility.

I assumed that long, nearby calls would take care of the margin requirements for the naked December short calls. Wrong! Apparently, options margins at Interactive Brokers only offset when you sell the front months and go long the back months. I noticed, somewhat concerned at first and later with alarm, that the margins on the position grew exponentially every day even though I was making money on the trade. Friday’s VXX open forced me to a point where I obviously would not be able to maintain the position as volatility picked up.

The important take-away from this experience is that it’s important to go into a new trading situation small, even if you think you have everything figured out. Trades like this make me feel a little more accomplished. Not because I made a lot of money (I barely broke even), but because six years ago I would have let this turn into a margin call.

Here are the good things that happened:
1) I expected that I could get away with heavily margining the position under any scenario. Knowing that my forex and equities are my forte, I thankfully opted to go with only 25% of what I thought my margin could sustain in the worst case scenario. This was in spite of feeling like this was potentially the trade of a lifetime.
2) Cutting the trade before it got out of hand. Although it took a few days to piece together what was happening, I decided to avoid the expanding margin requirements before it affected other long term trades.

Filed Under: Stop losing money, Trading strategy ideas

How To Test Your Broker’s Latency

July 29, 2011 by Shaun Overton 24 Comments

It seems like a trivial thing, but the quality of the connection between you and your MetaTrader broker can dramatically affect the quality of execution. When the markets move rapidly, delays in milliseconds make the difference between execution at a requested price versus heavy slippage. It is a wise idea to ensure you do everything in your power to minimize trading risks.

The steps to check the latency to your MT4 broker are simple.

1) Figure out their IP/Domain address. It is not the obvious “mbtrading.com” or whoever your broker is. You’ll have to look it up inside of your MetaTrader installation. Go to C:\Program Files (x86)\YOUR BROKER HERE\config. The example below shows the list of servers for Alpari.

Configuration files for MT4

2) Double click on the server that your live account is linked to. If you’re not sure which server you connect to, you’ll find it when you log on to your account inside of MetaTrader.

Login screen for MT4

3) Double click on the appropriate .srv file that you found in step 1. When you do so, a box will come up. Select the “Select a program from a list of installed programs.”

Select a program

4) Choose Notepad and push OK.

Choose Notepad

5) You’ll see a lot of gobbledy-gook come up. Only a few words are obvious. You’re either looking for an ip address (as shown on the Alpari image) or a web address (as shown in the Forex.com image).

Alpari's Server IPIP/Domain for Forex.com's live server

6) This step is the only one unique to your operating system. If you have Vista or Windows 7, just click on the button in the bottom left corner, then type in “Command”. If you have XP, you’ll need to push Start. Select Run, then type in “cmd” and push enter.

Select the Command Prompt

7) Now type in “ping SERVERNAME” without the quotes, as you see near the top of the image.
A slow connection between the client and the broker

You can see that my connection is on the bad side. This is not surprising. The broker, GO Markets, is in Australia, while this test was done from Dallas, TX. It’s not realistic to expect a blazing fast connection halfway around the world.

Your options for improving connectivity are rather limited.

1) Move your computer closer to your broker. If you are not familiar with trading using a VPS, I strongly recommend reading that link. I can resolve my slow connection to Australia in this example by finding a reputable VPS provider in that country.
2) Try switching ISPs. Upgrading your plan is not likely to help. If you live outside of a major city, your only option is probably VPS.

Filed Under: MetaTrader Tips

You cannot measure the angle of price

June 8, 2011 by Shaun Overton 2 Comments

Traders commonly refer to the angle formed when the price or moving average changes.  Big changes form big angles, while small changes form small angles.

That's the idea, anyway.  The mathematically reality is that the concept of angle does not exist.  Let's take a look at an example that most people would be comfortable with.

A simple overview of a triangle measured in feet

The angle θ in this triangle is 48.59°.  The reason we can do this simple geometric comparison is that the units of each side of the triangle are measured in feet.  If the units are not the same, it is not possible to take the angle.  Now let's do an absurd example to prove the point.

A triangle with incorrect units

 

A 4 foot long triangle that's only 3 inches high does not have an angle of 48.59°.  We expect the small height to produce a small angle.  This is correct.  The actual height of the triangle is 0.25 feet, which forms an angle θ = 3.58°.

Turning our attention back to trading, think about each leg of the triangle as it appears on your chart.  The horitzontal leg is time.  The vertical leg is price.  Are these units identical?  No, they are clearly different.  Therefore, you cannot find the angle between them.

A triangle showing price and time

 

Filed Under: Trading strategy ideas Tagged With: angle, moving average, price

The Pitfalls of Automated Trading

June 3, 2011 by Shaun Overton Leave a Comment

Trading books often focus on the psychology of trading.  They talk about the importance of confidence.  They talk about knowing and documenting the reasons behind every trade.  Most importantly, they talk about how to handle unexpected string of losses.

I often read articles that promote automation as a way to cure that last problem, emotional trading.  That’s a half truth.  Emotion in trading doesn’t go away simply because MetaTrader places the trades for you.  There is, after all, a human being that owns and operates the computer.  He is entirely capable of interfering with the emotionless machine, despite advice to the contrary.

It’s important to approach the subject of automation with a realistic assessment of what it can and cannot do.  It is not a panacea to all trading problems.  You are not going to stumble across a magical piece of software that suddenly turns your account into an ATM machine.  Many of the same problems that plague you as a discretionary trader will continue to plague you as an automated trader.  If you suffer from highly emotional trading performance, you should expect to continue experiencing the same problems until you address them.

EAs and strategies bring the same benefits that a solid automated system brings to a factory or office.  If the underlying business model is garbage, automation will not turn a bad business into a good one.  Where a solid business exists, a systematic approach can achieve spectacular efficiencies that no human could ever hope to match.

Expert Advisors offer the ability to backtest.  Unfortunately for the novice, MetaTrader also offers the ability to optimize.  This is where most make their biggest mistakes.

It is totally unrealistic to assume that it is possible to program an Expert Advisor, run the settings through the biggest optimization trial that the computer will handle and expect to walk away with a viable strategy.  I often receive jubilant emails from first time clients showing spectacular equity curves, incredible winning percentages and a seemingly no-lose plan.

The best analogy that I can think of is Shaun the college student versus Shaun the family man.  When I was in college, it was acceptable to wake up at 10 am and attend classes when I felt like it.  It might not have been the optimal academic approach, but it certainly was an optimal lifestyle.

As an adult, my optimum lifestyle changed dramatically.  I now have to juggle family and professional responsibilities with the leisure time that used to be so important.  The optimum solution is not constant over time.  It has always shifted and always will.

Markets are no different. Early in my forex career in 2006, the markets fell to record low volatilities.  Day in and day out, almost nothing of consequence happened.  An abnormally large percentage of my then employers’ clients were making money.  They did so because the most common trading mistake around – holding onto losers until they turned into winners – always worked. One could almost bet the farm that the market would come back.

Anyone that traded in 2008, or even today for that matter, can testify that the optimal solution then is not today’s optimal solution.  While backtesting certainly adds a great deal of clarity and understanding to an Expert Advisor, it does not tell the whole story.  Human judgment and experience are inseparable.  Knowing  the mechanics of an Expert Advisor, the reason that the trader expects it to succeed and the types of market conditions that it favors are all integral to the process.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: mistakes, pitfalls

Function is not referenced and will be removed from exp-file

May 31, 2011 by Shaun Overton Leave a Comment

The MT4 compiler likes to issue warnings whenever some components of the source code are not used. When you see this message, it means that MetaTrader decided to remove this unused portion of the code from your compiled file.

The fact that the MetaEditor labels it a warning is a misnomer. It does not impact your code in any negative way at all. It actually speeds up the file by removing unnecessary portions.

Filed Under: MQL (for nerds) Tagged With: metaeditor

Color Changing Indicators in MetaTrader

May 6, 2011 by Shaun Overton 5 Comments

Many custom indicators in MetaTrader use lines that change colors to indicate a change in trend or market condition. Those types of indicators are among the more common requests that we get for programming Expert Advisors. Unfortunately, these indicators often present problems. What you see on the chart is not necessarily what the indicator says.

Take a look at the image below or click the link to view it in full size. You'll notice that I included the data window for the indicator, which is SuperTrend. As we walk from left to right, the data window does not suddenly shift from Trend Up to Trend Down. Instead, it shifts with an in between period where the trend is both up and down.

MT4 Color Changing Indicator

While the visual effect is immediately obvious, the numbers do not clearly indicate the indicator's condition. In fact, it frequently happens where the indicator entirely misrepresents its true calculation. If the last bar was only green and the indicator says that the current bar is red-green, then we can safely assume that the indicator is switching from green to red.

When the indicator says it's red-green and the past bar was red-green, it gets more tricky. We are forced to keep looking back through time until a "clean" red or green value appears. This enables us to capture the indicator's real value.

It does not, however, make for a happy trader. Consider the case where the indicator plots red-green, red, red-green, red. Because of the way MetaTrader draws lines from point to point, the indicator actually appears as a solid red line – a long, beautiful sell signal, right?

In fact, its true calculated values are red, green, red, green. This glitch can make for some ugly surprises. This is especially so when traders expect to ride a down trend and the line appears as solid red, but the indicator (and thus EA) keeps flip flopping on the trade direction. You have to keep this in mind when building EAs around custom indicators.

Filed Under: MetaTrader Tips, MQL (for nerds)

Risks of Broker Arbitrage

April 28, 2011 by Shaun Overton

Every month or two, someone asks about picking off  brokers with slow or manipulated prices.  The basic concept is that you can buy or sell "risk free" when two parties misprice certain assets. 

Example of differing Bid/Ask:

Broker A shows EUR/USD trading at 1.48250 / 1.49264

Broker B shows EUR/USD at 1.48227 / 1.48239

Notice how it is possible to buy EUR/USD at 1.48239 at Broker B and instantaneously sell the same contract at Broker A?  The idea is that you could make 1.1 pips without worrying about the direction of the price.  Although it sounds farfetched, arbitrage differences actually occur all the time.

Arbitrage is a perfectly sensible strategy.  But, there are a number of risk factors to consider when taking this approach in MetaTrader:

  1. The price you see on the screen may not be tradeable.  Latency, a glitch on the server or any number of reasons can cause your price feed to lag unreasonably.  This means that the price is not actually real.
  2. Slippage.  You do not have any way to guarantee that your order will be filled at the requested price.  Considering that the normal slippage is often more than the amount of money that you're trying to earn, you still face a very real risk of loss.
  3. Brokers aren't stupid – they notice scalpers who seem to win all the time. If a broker manipulates the price and sees you taking advantage of it, I guarantee that your account will not remain open very long.
  4. The amount of time it takes to execute orders means that the price on the other half of your trading is dancing around while you have a naked position.

Think about the time involved with every step of the process of executing two trades.  Assume that you have a respectable internet connection with a 40 ms latency to the trading server.  The following steps have to occur:

  1. The broker sends the price quote (40 ms)
  2. MT4 communicates with the other broker to determine if an opportunity exists.  MQL4 is a slow langugage, so let's say this takes 10 ms.
  3. MT4 sends the first part of the order to Broker A.  Broker A checks with their counterparty, confirms the trade and then forwards this on to you.  My experience is that this takes anywhere from 200 ms up to several seconds in MT4, depending on the broker and market conditions.
  4. You receive the trade confirmation and send the new request over to the Broker B MT4 platform (40).
  5. MT4 only updates on incoming ticks, so you're unable to send the order request programmatically until a new incoming tick arrives.  Market conditions dictate how long this might take.  We'll call the optimistic scenario 200 ms.
  6. MT4 sends the second part of the order to Broker B (40 ms).
  7. Broker B takes the same 200+ ms that Broker A took in Step 3.

At this point in time, the entire sequence completes its execution.  How long did it take?  The best case scenario looks like it takes something around 750 milliseconds, if everything goes smoothly.  If any one of the 7 steps hits a bump in the road, it could take 5 seconds (5,000 ms)  or longer to actually complete both sides of the order.

A lot can happen in 5 seconds!  Most of these opportunities appear during volatilie markets, which means that the worst case scenario is most likely to happen precisely when you're trying to arbitrage the market.

 

Filed Under: Trading strategy ideas Tagged With: arbitrage, broker, latency

  • « Previous Page
  • 1
  • …
  • 20
  • 21
  • 22
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 © 2021 OneStepRemoved.com, Inc. All Rights Reserved.