Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

Using Parabolic SAR vs MACD

July 5, 2016 by Lior Alkalay 1 Comment

Parabolic SAR and MACD are both very effective in spotting pivots and yet there is a difference. In some cases, you will find the Parabolic SAR is more effective while in others you might find the MACD more useful. That is why, in order to make the best of both, you must know the advantages and weaknesses of each.

Parabolic SAR has Higher Sensitivity

The first thing you will notice when comparing a Parabolic SAR to an MACD indicator is that the Parabolic SAR signals many more pivots. That is because the Parabolic SAR has, by default, more sensitivity to minor changes. Of course, you can reduce the level of sensitivity, but even so, it delivers more signals than the MACD. The benefit of such sensitivity is that, at times, the Parabolic SAR predicts a pivot before the MACD. But that sensitivity has a downside. In small fluctuations the Parabolic SAR can occasionally produce fake pivots. As you can see from point A to point B, the pair has been trending sideways and still the Parabolic SAR delivered plenty of signals, most are falls. However, the MACD during the same time frame was much more effective.

Parabolic SAR

MACD is better at Momentum

One advantage the MACD has over Parabolic SAR is the measurement of momentum. As can be seen in the chart above, the MACD indicator, through the lows and the highs of its histogram, illustrates how strong the momentum is to either direction. If the histogram falls sharply lower, the momentum is strongly bearish, if it rises sharply higher, the momentum is highly bullish, if the histogram is fluctuating close to 0, the momentum is weak.

While the Parabolic SAR does a good job in identifying the direction of momentum quicker, it is much less effective in identifying the strength of a pair’s momentum. And that is why, when it comes to momentum, MACD is more effective than Parabolic SAR.

Limit/Stop Loss

Another way in which MACD and Parabolic SAR differentiate is in the way they influence stop loss and limit strategy.

Parabolic SAR, being an upper indicator, is overlaid on the price rather than being presented below. The dots of the Parabolic SAR are natural stop loss and limit levels for the short term. Moreover, when used in conjunction with Fibonacci levels, can also be effective in placing long term stop loss and limit orders.

MACD, however, being a lower indicator, i.e. presented below the chart rather than overlaid, has a more complex relationship with stop loss and limits. The MACD can be effective as an indicator for a stop loss when momentum shifts to the other direction, thus pointing to a pivot. But for the MACD to be effective as a stop loss indicator it needs a Gann Fan or an area where the MACD momentum converged more than once, indicating a strong support, or resistance if the trend is bearish.

In Conclusion

Both the Parabolic SAR and the MACD are strong tools for working with pivots, but are different in their effectiveness. One is better in identifying pivots quickly and in placing limits and stop loss, the other is better at analyzing momentum strength and timing entry. Knowing the advantages of each can allow you to optimize the use of both and, more importantly, optimize your performance.

Filed Under: Trading strategy ideas Tagged With: limit, MACD, parabolic SAR, stop loss, Take Profit

Tactics for Managing a Trade in a Range

March 11, 2015 by Richard Krivo 5 Comments

Tactics

 

Range trading is simply finding a currency pair that has been moving between a defined  level of support and a defined level of resistance for an extended period of time. 

Once the setup has been identified, the trading plan is to buy at support and sell at resistance as long as the range remains intact.

Let’s take a look at the range on the historical 1 hour chart of the NZDCAD below…

Chart 1

 

In this straightforward scenario when price trades at support the trader would take a long position with a stop just below the lowest wick in the range.  The limit (take profit) would be set at the top of the range and the trader would let the trade play out.  If all goes according to plan and price trades up to the limit, a profit of 40 pips would be gained.  If price retraces and take out the stop the trader would incur a loss of about 8-10 pips.

Now let’s take a look at a few trade management variations on this same trade…

Chart 2

Here we have the same trade set up but we are going to increase our likelihood of taking profit by moving our limit down slightly – a bit closer to our entry. 

Here’s why this can work.  Notice that price has hit the very top of the range four times.  (This would be each time a candle body or wick touched or pierced the .8130 level.)  On the other hand, price has touched our pierced our new take profit level a total of 15 times!

By doing this we will give up some profit if the pair does trade to the top of the range.  However, we are increasing our odds of having our limit hit while still achieving a solid profit and having at least a 1:2 Risk Reward Ratio in place.

The choice is yours…

Take the chance of gaining more pips but with a lower probability of success or take the chance of gaining a few less pips but with a greater probability of success.

Now let’s take a look at the same set up but this time we will open two positions instead of one…

Chart 3

 

Personally, I like to trade multiple lots since it allows me more flexibility in my trade management. 

Keep in mind, however, that anytime we increase our position size, we also increase our risk.

For example, if our stop is set at 10 pips, with one lot we are risking 10 pips; with with two lots we are risking 20 pips and so forth.  To stay within our Money Management guidelines of never placing more than 5% of our trading account at risk, check to be sure that the trading account can handle the added risk.

When looking at the chart above, the set up remains the same but this time we would open our trade with two lots instead of one.  (This strategy would remain the same whether we open two, six or ten lots.)

The flexibility that this allows is that we can close out one or a portion of the trade when price reaches the halfway point in the range.  By doing that the trader locks in profit when that position is closed.  Additionally, the stop at that point can be moved to breakeven , that price at which the trade was entered.

Now, if price retraces and hits our stop we are closed out of that portion of the position with no gain but no loss is incurred either.  We also have the 20 pips from the first portion of the position locked in.

Should price continue to move to the top of the range, the second position would be closed out thereby gaining the full amount of pips encompassed in the range.  In the case of this example that would be 40 pips.  Those pips would then be added to the profit gained when the first position was closed out at +20 pips for a net gain of 60 pips.

Bottom Line:  There are a variety of ways to manage the same trade setup.  Choose the one that makes the most sense for you and the size of your trading account.

 

All the best and good trading,

Richard Krivo

 

RKrivoFX@gmail.com

#RKrivoFX

Filed Under: How does the forex market work?, Trading strategy ideas, What's happening in the current markets? Tagged With: NZDCAD, range trading, stop, Take Profit

Probability Trailing Stop

November 28, 2012 by Shaun Overton Leave a Comment

Generic trailing stops maintain a steady pip distance between the most favorable price seen and the stop loss. One thing that I don’t like about this is that trailing stops ignore the take profit. My goal was to increase the information available by using a trailing stop in the context of a take profit.

The only information needed for doing so is the ratio between the stop loss and take profit. If I use a 50 pip take profit and a ratio of 1, for example, then the stop loss is also 50 pips. If I used a ratio of 2, then the stop loss is 100 pips.

As the price moves closer to the take profit, the stop loss should maintain the same ratio over the remaining distance. The original take profit was 50 pips. Say that the price increased 20. Only 30 pips remain to hit the profit target. The probability trailing stop adjusts the stop loss to 30 pips from the current price if the ratio is 1. If the ratio was 2, then the stop would adjust to 30 * 2 = 60 pips. The idea was that perhaps the stop loss should ratchet closer to the take profit as it becomes increasingly likely to occur.

An easier way to think about where to set the stop is to ask, “How many pips are left until the trade hits its take profit?” If the answer is 40, then the stop loss adjusts to 40 pips away from the current price and not the entry. If the answer is 25, the stop loss changes to 25 pips from the current price. The stop loss adjusts faster and faster as a trade nears its take profit.

Changing the stop ratio to something like 0.5 makes it more complicated. If 40 pips remain before a trade reaches its limit, then the stop loss adjusts to 40 * 0.5 = 20 pips away. If 25 pips remain, then the stop ratchets to only 12.5 pips away.

Test Results

I backtested the idea using a variety of forex pairs and DOW 30 stocks for the first quarter of 2009. The direction of a trade, whether long or short, was chosen using a random number. The date chosen was simply because I have M1 data for multiple instruments. The broad spectrum of results would reflect the same trend regardless of the time periods used.

All backtests were on M1 charts. The unit sizes of the trades don’t matter much; I set the trade size to a standard lot on forex pairs and 1,000 shares for equities trades. All used a 50 tick take profit with an equidistant stop loss (the stop loss ratio was 1.0). The profit factors help keep the information consistent among the different instruments.

InstrumentProfit Factor
EURUSD0.96
USDCAD0.88
DIS0.91
MSFT1.0
WMT0.87
XOM0.87

All of these backtests involve a minimum of 300 trades. The EURUSD backtest included more than 1,700 trades. The sample size for all tests are more than sufficient for drawing a conclusion. Using a probability stop with a ratio of 1.0 is a bad idea.

Although the equity curves naturally varies among instruments – and would differ using new random numbers – the equity curve below shows what it generally looks like.

Equity curve of probability trailing stop

The equity curve for a probability trailing stop on Exxon (XOM) for Q1 2009.

The entry efficiency of the system appears solid. However, that is because the worst possible exit always shifts up. The idea trades exit efficiency for a hint of entry efficiency. Knowing that the trades pick their direction using random numbers, it is not worthwhile to get excited about this seemingly non-random metric.

Entry efficiency for Verizon (VZ)

The entry efficiency consistently comes out near 55-60%. The above image shows the entry efficiency for trading Verizon (VZ).

The losses have to come from somewhere. Clearly, as the image below demonstrates, it results from the terrible exit efficiency. Results typically ranged from 35-40%.

Exit efficiency for probability trailing stop

The exit efficiency for a probability trailing stop ranges from 35-40%. The above image is taken from trading McDonalds (MCD).

If you would like to test the concept for yourself, you can download the NinjaTrader export file by clicking Probability Trailing Stop. You need to email me for the random number file, which needs to be placed in the “C:\” directory. The code will not function without it.

Although the tests for a stop ratio of 1.0 look terrible, all is not lost. I can flip this on its head and turn it into a profitable concept by blending it with the random trailing limit. Outcomes using a ratio of 3.0 also offer potential hope. We’ll cover those outcomes in future blog posts.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: stop loss, Take Profit, trailing stop

Optimize an Expert Advisor

February 20, 2012 by Shaun Overton 1 Comment

One of the lesser known features of the MetaTrader backtester is the optimization feature. It’s so small that you could be forgiven for overlooking it.

Optimization is the process to maximize a certain outcome. In this case, it’s profit. Any EA developer wants to maximize the amount of profit made over a given period of time. The MetaTrader optimizer allows the trader to search for the combination of inputs that yielded the maximum profit over a given period of time.

The process is identical to running a backtest, except that MT4 runs multiple backtests at the same time. It then organizes the results and offers up the best combination.

Telling the backtester to run in optimization mode is easy. Simply put a check next to the word Optimization. MetaTrader will then sort through the combinations that you tell it to consider.

MetaTrader EA Optimization option

Place a check in the box next to Optimization in the MT4 backtester

The next step is to click on the Expert properties button to the right. A new window appears that contains three tabs: Testing, Inputs and Optimization. These screens allow the trader to inform MetaTrader which variables to consider for testing and how to weight the results.

Testing

The top of the testing section applies to every type of backtest. Here you can select the starting balance. MetaTrader defaults the option to $10,000, although you can make this any amount of your choosing.

The second default option allows the trader to restrict the direction of trades. It’s a frequent expert advisor programming request. It’s also one that is unnecessary. Both the backtester and expert advisor options screen allow the trader the option of restricting trades to long only or short only without additional programming. If the EA is not well programmed, this setting may cause errors 4110 or 4100 to appear all over the trading journal. It’s harmless. The only effect should be that the backtester slows down. It’s the result of writing to the journal hundreds of times or more.

The testing tab of the MetaTrader backtester

The testing tab of the MetaTrader backtester

A groupbox appears underneath these options that inexplicably relates to the optimization process. You’d think it would make more sense to place it in its namesake tab. That’s typical MetaQuotes logic at work.

The first line contains numerous parameters for choosing the best option. User overwhelmingly select for the largest account balance, but other options include the profit factor, expected payoff, maximum drawdown and drawdown percent.

The last line automatically uses a genetic algorithm. Optimization processes use either brute force methods or genetic algorithms. Brute force strikes most people as intuitive although obviously exhausting. The software tests every combination possible. Genetic algorithm’s attempt to make the process more intelligent. When the software sees that certain parameters almost inevitably lead to a losing performance, the algorithm skips similar tests where it expects to lose.

This is a great idea if you have a quality genetic algorithm. My opinion of the MetaTrader backtester is less than stellar. I don’t feel very confident about the algorithm at all. If you don’t mind spending extra time waiting for test results then I suggest unchecking this option. You don’t want to miss a potentially important combination.

Inputs

Most people find this screen confusing. The first column, called value, strictly controls inputs for simple backtests. The Value column is totally ignored during an optimization run.

The inputs tab of the MT4 backtester expert settings

The inputs tab of the MT4 backtester expert settings

The important columns for this task are Start, Step and Stop. Start is the lowest number that the MT4 backtester will consider. Step refers to the interval between the lowest value and the highest value. Tightly controlling this setting allows the user to gain quick insights into how changing the variable values affects performance without dragging the tests out for a full week. Stop is the highest number that the expert advisor will use.

The most obvious candidate for testing in this example is the Take Profit value. The default setting is listed at 50. If you trade the majors, you might want to consider settings ranging between 10 pips and 200 pips. That means that you set Take Profit row to 10 for the Start column and 200 for the Stop column. The real trick here is selecting the Step. If you choose Step = 1, then MetaTrader will run a separate test for every value between 10 and 200. That’s 190 tests, which is overkill. A step of 10 cuts the total number of tests down to 19.

Optimization

This section is the nit-picky part. If a trader feels it’s unacceptable to have 10 consecutive losses in a row, he can place a check next the the Consecutive wins box. MT4 automatically discards any tests which yield a result that contains anything checked off.

The optimization tab in the MT4 backtester expert properties

The optimization tab in the MT4 backtester allows users to discard tests with undesirable traits.

When you finish going through each of the tabs, push OK in the bottom right corner. It’s time to launch the tests.

Curve fitting in the MT4 Optimizer

A word of warning: my personal opinion is that optimizing an expert advisor is usually a very bad idea. The unique settings that yield the most profit in 2012 are unlikely to yield the most profit in 2013. If you don’t control for random chance, there’s a good probability that the 2012 best combination may result in catastrophic losses in 2013.

I recommend that traders pursue any strategy development work in NinjaTrader. I don’t like the idea of optimizing at all. Instead, I always focus on testing strategies for entry and exit efficiency. I know from years of experience that these values never fundamentally change on instruments of the charts traded. Entry and exit efficiencies make wonderful metrics for automated trading because they are so stable.

Filed Under: MetaTrader Tips, Test your concepts historically, Trading strategy ideas Tagged With: backtest, backtester, brute force, curve fitting, drawdown, EA, expert advisor, genetic algorithm, inputs, MetaQuotes, metatrader, mt4, optimization, optimizer, profit factor, Take Profit, testing

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.