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

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

One line of code makes all the difference

2 月 9, 2017 によって ショーンオバートン 4 コメント

I was really excited about my Pilum strategy two months ago. The research looked great and everything was ready to rock and roll. Demo testing began and then… not much happened.

The Quantilator is (mostly) finished, which finally gave me time to circle back and review what happened with Pilum.

Live demo trading of Pilum

Live demo trading of Pilum. 12月 9, 2016 to Feb 7, 2017

The expected outcome was that I would win 75% 時間の. Trades were infrequent, so I thought maybe I’m just having bad luck. But then my win rate remained stuck around 50%. Simple statistical tests told me this was unlikely to be bad luck.

I used the research time to pour over my research code and to compare it with live trades. What I found was that a single line of code (AHHHHHHHHHHHHHHH!) was incorrectly calculating my entry price, dramatically overstating the profits.

、 flawed code produced this equity curve from a single combination of settings:
Flawed Pilum backtest

When the actual, correct result looks like this with those same settings:

The accurate backtest of Pilum

The accurate backtest of Pilum

I’ll be honest… I like the flawed backtest a lot more!

The new, single-setting backtest isn’t as good, but it’s still trade-worthy. There are some characteristics that I dislike and features that I love. Let’s dig into those.

What I dislike

The frequency of trades is very low. Out of 19 months there were a total of 43 取引. 43 trades to comprise a backtest on 40+ instruments is a very small number.

If it weren’t for the statistical pattern backing up the frequency, I would not consider the test. しかし, there are 20,000 bars each on the 44 instruments. あります。 880,000 total bars used to analyze whether my Pilum pattern offers any predictive value.

The most valuable predictions, しかし, are also exceptionally rare. That’s why I’m not able to get the trading frequency higher, which would potentially smooth the returns.

What I love

My previous systems like QB Pro and Dominari traded actively for relatively small wins. Trading costs exercised a massive impact on the overall performance.

The accurate backtest of Pilum

The accurate backtest of Pilum

Now look again at the correct equity curve (the image to the right). Do you see the final profit of roughly 0.14? That’s a 14% unleveraged return over a 19 ヶ月の期間.

Allocating 2:1 または 3:1 leverage on this strategy could average annual returns of 15-25%.

Detecting hidden risk

A key measure of risk is skewness. You may not use that term yourself, but it’s something most of you already understand. The biggest complaint about people trading Dominari was that the average winner relative to the average loser was heavily skewed towards the losers.

Dominari wins on most months, but when it lost in December it was devastating. I implemented what I thought was a portfolio stop after the December 9th aftermath. Then I had a smaller, but still very painful, loss in January. The portfolio level stop loss of 3% should prevent future blowouts now that I know what goes wrong.

I still believe in Dominari. しかし, I obviously lost the work of most of the year due to those events.

Knowing that skewness is a good measure of blowout risk (even if you’ve never seen it in a backtest, like happened with Dominari), Pilum looks extremely encouraging.

This is a histogram of profit and loss by days. You should notice a few things.

The tallest bar is to the right of 0. That means that the most frequent outcome is winning.

worst and best days

The biggest winning day is dramatically better than the worst losing day. The worst outcome was a loss of 2%. The best outcome is gains near 10% in a single day (unleveraged!).

This is the statistical profile of an idea that’s much more likely to grab an avalanche of profits than it is to get blown out.

It gets even better

low correlation

Would you say that the blue and red equity curves are highly or loosely correlated? Look closely.

Writing this blog post made me think carefully about the Pilum strategy. I decided that maybe I should see if all of the profits are coming from different settings at the same time. There’s very little risk of overfitting the data as my strategy only has 1 degree of freedom.

The blue bars are the equity curve of Setting 1.

The red bars are for Setting 2.

Do you think these are tightly or loosely correlated?

If you said loosely correlated, then you are correct. Notice how each equity curve shows large jumps of profit. Did you notice how those profit jumps occur on different days?

The blue setting skyrockets on a single day in November 2016. It leaves the red equity curve choking in its dust.

But then, look what happens as I advance into December. The red curve dramatically catches up to the blue curve and even overtakes it.

The correlation between the 2 strategies is only 57%.

Combine multiple settings into 1 portfolio

Combined settings Pilum equity curve

This is a much nicer equity curve!

Loose correlations are a GIFT. Combining two bumpy equity curves into a single strategy makes the performance much, much smoother.

The percentages of days that are profitable also increases. Setting 1 is profitable on 58.0% of days. Setting 2 is profitable on 53.5% of days.

しかし… combining them makes Pilum profitable on 68.2% of days. 素晴らしい!

That also provides more data, which puts me in a stronger position to analyze the strategy’s skewness. Look at the frequency histograms below. They’re the same type of histograms that I showed you in the first section of this blog post. As you’ll notice, they look a lot different.

Pilum most probable daily profit and loss

The most probable outcome for any given day is a small winner

The tall green bar is the most probable trading outcome for any given day with filled orders. The average day is a positive return of 0-1%.

The small red bar is the worst trading day of the combined strategy.

The small green bars are the best trading days of the combined strategy.

Look how far to the right the green bars go. The largest winner is more than 3x the biggest loss. と, there are so many more large winners compared to losers.

Giant winners are far more likely than comparable losses.

The Plan

I immediately pushed Pilum into live trading this combination of two strategies. I expect that adding a second degree of freedom and running about 30 different versions of the strategy – all with different settings – will add to the performance and smooth the returns even further.

Dominari hasn’t been working on my FXCM account, which is very difficult to accept because the lacking performance seems to be a buried execution issue. Pilum, しかし, trades very infrequently. It’s unlikely that execution quality will make a dramatic difference in the long term outcomes.

だから, I’m going to convert the FXCM account to trading Pilum exclusively. That will be offered as a strategy on Collective2 within the next few weeks, a company with whom I’ve been working closely. Their users are more investor rather than trading oriented – they’re far more likely to view low trading frequency as a good thing. I suspect that most people here have a different opinion and want to see a lot of market action.

I’ll write an update on Dominari shortly.

以下の下でファイルさ: Pilum, 戦略の取引のアイデア タグが付いて: 相関関係, カーブフィッティング, 自由度, ルール, equity curve, 周波数, FXCM, histogram, レバレッジ, QB プロ, リスク, スキュー, 統計情報

Measuring Equity Curve Straightness

10 月 15, 2013 によって アンドリュー ・ セルビー Leave a Comment

Some of the most interesting posts that have been published at QUSMA compare and contrast a number of different methods of measuring a given condition. The most recent post in this style sought out to compare different methods of measuring the straightness of an equity curve.

Here are some of the metrics the article looked at:

There are of course some “standard” straightness metrics. R-squared is the most popular, and it works pretty well. I like to raise it to the 4th power or so in order to magnify small differences and make it a bit more “readable”. Another popular metric is the K-Ratio, of which there are at least 3 different versions floating around. The K-Ratio also takes returns into account, so it’s not purely a straightness measure. I prefer the Zephyr versionwhich is calculated as the slope of the equity curve divided by its standard error.

The author continues by suggesting some other variables that would be interesting to consider:

Some other numbers I think may be interesting: the ratio between the area of difference above and below the ideal, the volatility of the difference, the volatility of the difference below the ideal, average absolute deviation, and average absolute deviation below the ideal (both standardized to the magnitude of the curve).

この時点で, the author throws a curveball and introduces a brand new metric called the Qusma Equity Curve Straightness, Downward Deviation, and Stability Measure (QECSDDSM). This new metric is designed exclusively to measure the straightness of the equity curve.

equity curve

Measuring the straightness of an equity curve is an interesting way to assess volatility.

 

The rest of the article uses the new metric and compares the results it calculates to those of the other possible metrics across four different data sets. The results ended up showing that there wasn’t much difference between the different methods:

In general most of the numbers roughly agree with each other in terms of ordering the curves from best to worst, so the actual formulation of QECSDDSM doesn’t really matter all that much.

The article goes on to test the metrics on a different collection of data sets. Once again the new metric failed to significantly outperform the already existing metrics. しかし, the offer believes that the new metric could be potentially useful following further development.

以下の下でファイルさ: あなたの概念を歴史的にテストします。 タグが付いて: equity curve, straightness metric

迷惑なバックテストサプライズ

1 月 22, 2013 によって ショーンオバートン 2 コメント

The first backtest results are in from segmenting my price-SMA cross forex strategy. Looking back, I really should have pre-researched this idea before publicly moving ahead. Look before you leap!

I rediscovered the same irritating problem that wasted 2 months of my life back in March 2012. I’m more irritated about finding the same results again than anything. If you were able to trade crosses over the SMA 200 without the スプレッド, the strategy makes gobs and gobs of money.

The idea led to using SMA 200 price crosses to trade with limit orders for free using BBBO (Best Bid Best Offer). That fell flat after orders received an 80% fill rate at multiple brokers. It needed 95%+ fill rates in order to work.

Equity curve EURUSD

The strategy looks deceptively appealing. It’s completely useless.

Real world trading costs including the spread and slippage works out to something like 2 ピップ EURUSD. The strategy traded 29,132 times on the M1 chart to earn a profit of $118,970. The problem is that the 2 pip spread cost would have cost $582,640. The pretty equity curve costs $4 for every $1 of profit. よくないです.

Trade report for all sma price crosses

The price crossed the 200 period simple moving average more than 29,000 times in 2011.

The SMA distance curve analysis didn’t turn out as I expected. There were far fewer trading opportunities away from the moving average than what I predicted – the SMA is stickier than I previously thought. No matter where I looked, the strategy always spent more money on trading costs than it earned. I posted all of the images here for the sake of thoroughness.

I’ll be moving this up to the M5 chart in the next round of tests. Everyone can say a loud, “I told you so!”

Trades entering at ±0.1% away from the SMA 200.

Trades entering at ±0.1% away from the SMA 200.

M1 price crosses 0.2% 以上 200 SMA

Trades entering at ±0.2% away from the SMA 200.

M1 price crosses 0.3% 以上 200 SMA

Trades entering at ±0.3% away from the SMA 200.

M1 price crosses 0.4% 以上 200 SMA

Trades entering at ±0.4% away from the SMA 200.

M1 price crosses 0.5% 以上 200 SMA

Trades entering at ±0.5% away from the SMA 200.

M1 price crosses 0.6% 以上 200 SMA

Trades entering at ±0.6% away from the SMA 200.

The next step is to take a quick look at the M5 charts to see if I can make the basic idea viable there.

アフターの考え

このシリーズは、最終的に収益性の高い取引戦略につながった. 旅を読むしたい場合, 記事を順番に読んでほしい

初期の戦略アイデア
適切なタイム フレームを選択します。
研究計画
初期 backtests の厄介な驚き
範囲の取引の試み
範囲の取引結果
移動平均エンベロープ ダフ屋

以下の下でファイルさ: あなたの概念を歴史的にテストします。, 戦略の取引のアイデア タグが付いて: バックテスト, equity curve, SMA

メールで無料の取引戦略

トレンド分析

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

アーカイブ

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

翻訳


無料の取引戦略

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

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