アルゴリズムと機械の外国為替戦略 | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • お客様の声
  • お問い合わせ

Buy and Hold Gold

12 月 11, 2012 によって ショーンオバートン Leave a Comment

I came across a paper entitled A Quantitative Approach to Tactical Asset Allocation by Mebane Faber. This paper appears to have been extremely popular over the years. Reading through the contents and reviewing the charts, I loudly wondered if the strategy might apply to gold.

Rules for buying gold

The idea is very simple. Taken directly from the paper, the rules are:

BUY RULE
Buy when monthly price > 10-month SMA.

SELL RULE
Sell and move to cash when monthly price < 10-month SMA.

1. All entry and exit prices are on the day of the signal at the close. The model is only
updated once a month on the last day of the month. Price fluctuations during the rest of
the month are ignored.
2. All data series are total return series including dividends, updated monthly.
3. Cash returns are estimated with 90-day Treasury bills, and margin rates (for leveraged
models to be discussed later) are estimated with the broker call rate.
4. Taxes, 手数料, and slippage are excluded.

Test results

The tests were done using Kinetick’s free end of day data. The data extends from August 4, 1997 until December 10, 2012.

One thing which drives me crazy about NinjaTrader is that the percent return calculations are so opaque. The actual numbers used a clearly wrong. The buy and hold return for gold is easy to calculate. 、 1997 price was about $350 an ounce. 今日, gold trades near $1,700. The buy and hold return should be in the neighborhood of 385%. NinjaTrader claims that the return is somewhere near 150%. I’ve gone through the charts to confirm that the trades are correct. You can download the gold strategy for NinjaTrader and verify the trades for yourself.

The percent return metric is consistent within the platform, so luckily the exact numbers are unimportant. The only thing that really matters is whether or not the strategy returns a bigger number than the buy and hold approach.

Equity curve of buying and holding gold

A chart of gold’s daily equity curve, extending back to June 1997.

Equity curve of the gold trading strategy

The tactical gold strategy dramatically underperforms the buy and hold return.

Reverse gold strategy equity curve

Pursuing the opposite idea of buying on crosses underneath the SMA10 doesn’t help

The strategy severely underperforms the buy and hold return. The idea held in the paper itself is deeply flawed. Buy and hold is a silly concept. Most of the “返します” in the portfolio stem from long term inflation and the devaluing of the dollar. The prices of the securities rose because the dollar, which you can think of as the counter currency, declined enormously in value over this time period.

さらに, the idea of the price crossing the moving average implies that the trend escapes the moving average. The MA, 実際には, gets dragged along with the price. While this is true with a handful of monster trends, the way that price moves usually work is something along the lines of 10 steps forward, 9 steps backward. The results of the test indicate this.

If the proposed strategy returns less than buy and hold and the total buy and hold strategy returned 150%, then it stands to reason that the total buying return is trades taken by the strategy + trades not taken by the strategy. The test includes what are supposed to be trades not taken by the strategy – the reverse signals. Adding up the proposed strategy’s returns with the returns of the opposite signal only accounts for roughly one third (22% + 34%) の 150% earned. Where did the rest of the money go?

Most of the move happens around the short term moving average. The majority of the move has already happened after the price to crosses and closes above the moving average. The instinct of many novice strategy developers is to move to intrabar signals. Intrabar trading ignores the basic problem; you cannot know whether or not the bar will close above the moving average.

以下の下でファイルさ: NinjaTrader ヒント, 戦略の取引のアイデア タグが付いて: ゴールド, intrabar, ninjatrader, SMA, 戦略

Trading Time in Programming

2 月 1, 2012 によって ショーンオバートン Leave a Comment

The major automated trading platforms such as MetaTrader 4, NinjaTrader and TradeStation all count time in the same way. This makes it quite convenient for ordering trading strategies and expert advisors; you don’t have to do any mental gymnastics to describe the strategy in different platforms. The consistent arrangement of time makes it easy for us to translate trading strategies across multiple platforms.

We tend to think of time as moving in the same direction as when we read. English speakers, who read from left to right, think of time as moving the same direction. If you speak a language like Arabic that reads right to left, you tend to think of time as marching to the left.

All of these charting platforms are written by speakers of left to right languages. The past is anything that’s not on the far right side. The present is the square on the far right. Each square represents an equal time interval. Traders know these as bars.

Time as an Array

A visual display of time and how it's segmented

What tends to confuse everyone ordering expert advisors is that even though time marches to the right, trading programmers count the bars to the left. What makes things more confusing is that programmers always start counting from 0 代わりに 1.

How to count time in an array

Even though time moves to the right, we count it from the right and move back left

If you want to trade a moving average cross strategy that waits for the bars to close, what you’re looking at is “bar 2” と “bar 1”. The way I describe this in the 仕事の範囲 is the value at two closed bars ago and the value at the last closed bar, それぞれ.

An expert advisor that uses closed bars ignores bar 0 because it is still open, which causes the moving average values to fluctuate. The only way to know for certain a moving average value at a particular bar is to wait for the bar to close, which means it is no longer bar 0. When a client requests an expert advisor that trades intrabar, they intend to compare the moving averages at “bar 1” と “bar 0”. In plain language, that means to compare the value at the last closed bar with the currently open bar.

うまくいけば、, this description makes sense when you open a chart and see the bars already loaded. The final confusing element is when a new bar pops onto the screen. The previous examples showed 5 bars on the chart (バー 0-4). When a sixth bar pops up, the count is reset to the new time period on every update.

Say that we’re looking at an H1 chart in MetaTrader and that the current time is 06:00. When the new hour strikes, the chart loads a new candle to represent 07:00. It’s at this time that the count resets.

Time udpates

When a new bar appears, your charting platform resets the count based on the newest bar.

以下の下でファイルさ: メタト レーダーのヒント, NinjaTrader ヒント, 戦略の取引のアイデア タグが付いて: 専門家アドバイザー, intrabar, メタト レーダー, moving average crossover, ninjatrader, プログラマ, 仕事の範囲, 時間, 売買

メールで無料の取引戦略

トレンド分析

申し訳ありませんが. No data so far.

アーカイブ

  • ルール
  • 外国為替市場のしくみ?
  • インジケーター
  • メタト レーダーのヒント
  • MQL (オタクのため)
  • NinjaTrader ヒント
  • Pilum
  • QB プロ
  • お金を失うことを停止します。
  • あなたの概念を歴史的にテストします。
  • 戦略の取引のアイデア
  • 未分類
  • What's happening in the current markets?

翻訳


無料の取引戦略

プライバシー ポリシーRisk Disclosure

著作権 © 2022 OneStepRemoved.com, (株). すべての権利予約.