アルゴリズムと機械の外国為替戦略 | 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 プロ, リスク, スキュー, 統計情報

QB プロ – 5 月 2015

6 月 1, 2015 によって ショーンオバートン 7 コメント

4 月と 5 月が歯で本当に迅速なキック. There’s no hiding around the fact that the market wasn’t very nice to me or my trading accounts.

The vast majority of pairs in the portfolio blew out into major trends. That is bad news for a mean reversion strategy. When one currency trends, there are usually a handful bouncing around the mean. It gives us a chance to offset the losses. That didn’t happen recently, which is why my traders and I had a rough go of it.

I expect things to get better

Last month was bad enough that I completely ceased trading for two weeks. After turning the system back on in the second week of May, QB Pro continued to endure minor losses. That was thanks to one of the best trading decisions that I’ve made in the past year, which was to dramatically reduce the leverage.

The high risk account took a 6.2% 損失. That would be very troublesome on a normal leverage account, but it’s a drop in the bucket by high risk standards. I look at it as more or less breaking even.

As a sign of my increased confidence, I increased my total deposits to $7,500 across the two accounts. As of today, the high risk account is back to trading on 20:1 レバレッジ. It was at 5:1 for the past few weeks.

Changes to QB Pro

、 信号対雑音比 contains enormous predictive power for my trades. I asked the question, “Does the signal to noise ratio at the time of entry predict the outcome of my QB Pro signals.

Judge for yourself.

Signal to noise ratio predicts returns of QB Pro

The signal to noise ratio predicts the returns of QB Pro

The first two dots to the left represent 82.62% of all the QB Pro signals. That’s the reason that the strategy makes money.

I use 1/2π as the barrier between a range and trend. When the SNR < 1/2神父, the profit factor is 1.5 (very profitable). When the SNR > 1/2神父, the profit factor drops to an atrocious 0.62.

結論: only take trades if the SNR is in the good area. That’s exactly what the updated strategy is doing as of last Friday.

Based in part on experience and largely based on statistical analysis, I found a way to bend QB Pro into a historically profitable trending system on yen crosses. I’m sort of rushing this out the door because the market conditions are favorable. The accounts are trading USDJPY, EURJPY and GBPJPY on 1/3 of the overall portfolio. Perhaps I’m tapped out on the creativity front, but I’m calling this sub-strategy QB Yen.

Here’s a screenshot of the equity curve for USDJPY in MetaTrader. This was part of my quality control analysis to ensure that the signals generated at the proper times.

usdjpy-qbyen

I eventually want to analyze whether QB Yen can tolerate the spread costs of more exotic crosses like CADJPY. Until then, heavy weights will go on the most liquid yen crosses until it looks like they can handle the higher costs of the more exotic pairs.

QB Pro historically wins in 2 out of every 3 ヶ月. I don’t have enough data to judge whether consecutive losing months are dependent or independent, but it’s only happened twice historically where the system lost 3 months in a row. It’s never lost more than 3 consecutive months going all the way back to 2008.

QB Pro May 2015

Based on the new changes, the changing market conditions and the historical analysis of drawdowns, I feel much more comfortable putting more money into the account. For those of you that decided to take a break, I personally believe that the worst is over. The market will of course be the judge of that.

以下の下でファイルさ: QB プロ タグが付いて: デジタル信号処理, QB プロ, 信号対雑音比

どうなっているのですか?

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

それはどんな定義によるでこぼこ月をされています。. 先月の連銀発表の余波でお金のトンを作りました。, only to give it all back the next week. QB Pro recovered most of the earlier gains, then last week’s drawdown took it all back again. It’s been painful.

The good news is that the new changes to QB Pro are rolled out. Several of you sent in emails asking about new currencies like GBPNZD and AUDCAD appearing in your account. Kudos to you for paying close attention to the trading.

The total currencies traded in the basket is up to 16 ペア. While the max leverage is unchanged at 36:1 (still very, very high), the leverage per pair is only 2.25:1. Future losses like the one from last week will still occur.

The difference is that the size of the positions is reduced by over 2/3. The impact of getting caught in losing trades that are all reflective of USD weakness decreases significantly. We’re now trading a mix of AUD, CAD, スイス フラン, ユーロ (EUR), 英国ポンド, 円, NZD, USD and XAG. No one currency should dominate the performance.

The system also does extremely well on emerging market currencies. I’m holding off on adding RUB, MXN and others until I determine the impact of the spreads on overall profitability. They’d do amazing if we could trade for free!

Short term performance expectations for QB Pro

We’re coming into the summer, which is when the forex market traditionally falls into the doldrums. That’s generally a good thing for QB Pro. The markets whipsaw up and down without really going anywhere.

The alternative is that the Fed hikes rates in June and sends the market into a USD buying frenzy. That’s also good news. Most of the money that QB Pro made over the past 8 months was driven by USD strength. A rate hike would unleash chaos in emerging markets and equities. That’s the kind of condition to push volatility into our new crosses, creating opportunities for us to trade.

QB プロ 2.0 isn’t happening

I’m extremely disappointed. After several thousand dollars in programming expenses, and not to mention the 100+ hours that I spent coding myself, the QB Pro 2.0 change is a wash.

I had a trusted developer audit my code to make sure I wasn’t doing something stupid like trading on future prices or anything. Neither him nor myself caught anything from December until March.

Towards the end of last month, a single line of code ruined it all. One of my key features was deciding when to bail on trades and go the opposite direction. まあ, it turned out that I accidentally introduced data snooping into the backtesting platform. I pre-calculated when losing trades occurred to calculate probabilities.

In plain English, my goal was to calculate “If today was a big loser, then do the opposite tomorrow.”

What I accidentally coded was “If tomorrow is a big loser, then do the opposite.” If only that were possible!

I don’t want to muddle up the explanation with code examples. Suffice it to say that the idea didn’t work out when I took away the ability to look into the future.

There are some features of the 2.0 system that I wish to analyze in the coming months, but for now it’s going to have to take a back seat.

What’s next?

My plan is to sit tight for a few weeks to ensure that the new pairs are working as intended. Whenever I am personally satisfied with the system behavior, I intend to increase the amount of capital in my account.

Don’t hold my feet to the fire. This part is a subjective process, so I can’t put a precise time frame on it. If and when I am satisfied – and it’s going very well the first few days – then I will make a decision about increasing my capital at risk.

If and when I choose to increase my capital in the account, I will then re-open QB Pro to new traders.

PS: I hope that the drawdowns encourage some of you to withdraw profits the next time the opportunity presents itself. You don’t want to lose more than you are comfortable risking.

以下の下でファイルさ: QB プロ, あなたの概念を歴史的にテストします。 タグが付いて: バックテスト, ドローダウン, QB プロ

12 月の QB プロ利益を撤回します。

1 月 1, 2015 によって ショーンオバートン 12 コメント

QB プロ treated everyone well in December. 私は報告書に満足します。 100% 今月のクライアントの収益性.

My advice is that you do in your account exactly what I do with mine. I withdrew my monthly profit of $1,376.08 today to make sure that I cannot lose on this trading system since I’m trading house money. I suggest that you transfer your profits, あまりにも.

My total deposits to date are $2,000. これまでのところ, I’ve pulled out $4,000 利益で.

You don’t need to remove the funds entirely from Pepperstone. I opened a second account whose sole purpose is to hold trading profits. For my situation, it’s not worth wiring the money until my company needs it. The point is that the money is out of the main trading account so that it’s not subject to loss.

I’m working hard to tweak QB Pro to minimize our drawdown risks (my money is at risk, あまりにも). I’ve spent the past 7 days developing a custom backtesting platform so that I can make smarter trading decisions across the portfolio.

The backtester is almost done. I have about another day of programming until I can analyze the initial results. It will undoubtedly require some tweaking, but I feel optimistic about reducing the drawdown risks (or even turning long term drawdowns to our advantage).

以下の下でファイルさ: 外国為替市場のしくみ?, QB プロ タグが付いて: QB プロ, QuantBar

メールで無料の取引戦略

トレンド分析

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

アーカイブ

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

翻訳


無料の取引戦略

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

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