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

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

Optimizing Your Algo: Tips for Beginners

6 月 6, 2016 によって リオル Alkalay Leave a Comment

You have created a trading algo. The Algo is profitable in the backtester. Before unleashing it with real money, you’ve got to first tighten the screws. それです, ensure your algo is fine-tuned so it can deliver optimal returns. There’s one major challenge ahead of you.

まず, your strategy is rather simple. You may go through the detailed process of building and optimizing a strategy, including curve fitting, correlation and so on. But you want a simpler process; something leaner, that will fit your modest needs.

Secondly, you may not yet have mastered the full technique of optimizing. You are still learning and want to try off with a simple process.

One technique I find especially simple in optimizing your algo is 確率. The probability method, in essence, contains many components of a full optimization technique. しかし, it tends to rely more on common sense and logic to narrow the options and optimise the algo. That makes it a pretty good way to begin the entire concept of optimizing a strategy. さらに, you will find it easier to digest.

The essence of the strategy—optimize by elimination.

Algo Case Study

The following Algo is a simple one. Let’s call it RSIMV which is RSI and Moving Average. Here is what RSIMV describes through conditioning:

If Open Positions = 0 その後、

場合 (MA(30)>MA(14)) and RSI=<60 その後、

Open Buy (50,000) {It will buy 50 たくさん}

Set Stop Loss = Price – 50{ピップ}

Set Limit= Price+ (50*2)

End

戦略: If the moving average cross points on a bullish trend and the RSI is equal or below 60 it means that the rally has some length before reaching an oversold level (RSI above 80). That points to a good buying opportunity.

Looking at RSIMV, you can conclude there are four parameters to optimize: RSI and two Moving Averages

Starting with the Moving Averages, we will look at the 14 と、 30 日. Seemingly, the options are endless, with many combinations of moving averages to test. 理論的には, それは正しい, but that is where 確率 comes in.

Algo

MT4

When we look at the chart, we can see that the longer the averages (orange and red) the lesser the chance that there is a combination of a low RSI and a bullish momentum.

さらに, a combination of a low RSI and a bullish signal のみ occurs when the two averages, the fast and the slow, have more or less a 2 宛先 1 比 (such as a 30 と 14).

Those two conclusions help us narrow the parameters we are looking for.

The highest likelihood of finding a better set of averages is with faster averages, not slower, and those that have a ratio of 2 宛先 1. And let’s not forget we already know that 14 と 30 works. So we shouldn’t move too far up the scale.

We will use 25 と 12 as the first combination and 20 と 10 for the second. Both are faster than the original parameters, have a roughly 2 宛先 1 比, and are close to the original settings.

  1. 25,12
  2. 20,10

Moving into the RSI parameter, narrowing the options is even simpler. We know the RSI cannot possibly be higher than 60, because then we will be left with insufficient upside before the pair turns oversold.

反対に, if we try an RSI below 40 it’s unlikely that it will occur while the moving average cross is bullish.

以来, as in the Moving Averages case we know the original setting worked, we know we only need a minor tweak. With no way to go but up we are left with two reliable options – RSI<55 and RSI<50.

Hence our options are:

  1. C) (55)
  2. D) (50)

As we can see from testing all the alternative parameters, what we needed was a better entry for the RSI. As we intended… minor tweaks.

Algo

Don’t Optimize Too Much

Ironic as it may sound, optimization sometimes has a downside. At times, we are tempted to over-optimize to such an extent that our newest strategy no longer resembles our original, pre-optimization plans. That can throw us into an eternal loop and waste precious time. Don’t be tempted! Don’t fall in love with the optimization process. 結局その程度です, optimization is merely tightening the screws, not building the engine. If your strategy works, confine your optimization to minor tweaks. それがない場合, optimization won’t help and you’ll need to start from scratch.

と, finally, a practical tip; always keep records of the results of your original strategy and compare it to your current, post-optimization strategy. This way you can always make sure that you’ve really optimized your strategy.

ボトムライン

確認して, the optimization technique isn’t perfect. But the take away here is that if you really understand your strategy, you can use logic to in order to find better settings. If you’re a beginner and lack the knowledge for advanced optimization techniques, optimizing through the logic of probability is a powerful tool to have.

 

以下の下でファイルさ: あなたの概念を歴史的にテストします。 タグが付いて: 移動平均, 最適化, RSI

遅いストキャスティックスのクロス オーバーを最適化

5 月 24, 2015 によって リチャード ・ Krivo 3 コメント

歴史的な毎日の価格から、 4 hour charts of this AUDNZD pair are making lower highs and lower lows and are trading below the 200 SMA as well, we are only looking for opportunities to short the pair…we want to optimize our strategy.

website-optimization

When using Slow Stochastics in a downtrend, as we have on the chart below, the optimum sell signal given by the indicator occurs when the two moving averages comprising the indicator have been above 80 and then move below 80.

ss1

逆に, when using Slow Stochastics in an uptrend, the optimum buy signal given by the indicator occurs when the two moving averages comprising the indicator have been below 20 and then move above 20. This condition can be seen on the historical 4 hour chart of the USDCAD pair below…

ss2

Since the above signals are the optimum signals, not as much attention is paid to the crossovers that occur between the levels of 20 と 80. How should a trader react to those?

しばらくの間 “mid-level” crossovers are valid technical trading signals, 私の意見で, they do not offer as much “pip-potential” as do crossovers occurring at the 80 または 20 レベル.

ss3

Allow me to create an analogy…

Think of the lines (moving averages) that comprise Slow Stochastics as a string on a bow that is used to shoot an arrow. The farther that the bowstring is pulled back, the more power it has behind it and the farther the arrow will go. With this in mind, look at the optimum Sell Signal on the chart above and compare it to the Mid-Level Crossover. The crossover that takes place above 80 will have more downside momentum associated with it than will the mid-level crossover that takes place between 20 と 80. The bowstring is not pulled back nearly as far.

While both are valid signals to short the pair, the signal with the most pip potential behind it is the one that had the greater amount of momentum. In this case the pullback to above the 80 level would present the trade with the greater pip potential. While it is not an absolute and will not prove to be true each and every time the condition presents itself, it does represent a “trading edge” that I believe is worth taking.

For the above reason, I generally do not take mid-level crossovers as entry signals in my own trading. むしろ, I exercise patience and discipline and wait for the higher probability signal to set up.

良い取引,

リチャード ・ Krivo

RKrivoFX@gmail.com

@RKrivoFX

以下の下でファイルさ: 戦略の取引のアイデア タグが付いて: crossover strategy, 最適化, ストキャスティックス, USDCAD

あなたの取引に機械学習を使用する方法

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

Machine learning presents many unique and compelling advantages for traders looking for an edge in the market. Just in the last year we have seen a huge amount of resources from the world’s top hedge funds, like Bridgewater Associates, dedicated to exploring these techniques.

While using machine learning or artificial intelligence seems incredibly complex and difficult to implement, there are still ways to leverage their capabilities without needing a PhD in math or science.

この記事で, we’ll go through 3 different ways that you can use techniques from machine learning to improve your own trading.

Indicator Selection

One of the most important decisions is deciding on which indicators to use to trade. Whether you are a technical or fundamental trader, or you just use price action to trade, your success is going to be largely dependent on the indicators that you use and how you interpret them.

幸いにも, there are many different methods for selecting your indicators and this is known as “feature selection” in the machine-learning world.

Using a Decision Tree to Select Your Indicators

indicator decision tree

Decision trees are very versatile algorithms that have the benefit of being easily interpretable. Given a large dataset of indicators and the price movement of the asset, a decision tree will find the indicators, and indicator values, that best split the data between price increases and price decreases. Indicators closer to the top of the tree are seen as better predictors than those closer to the bottom of the tree, and following a particular branch will allow you to easily find interdependencies and relationships between the indicators.

The decision tree will also give you a set of rules that you can use to trade based on those indicators, but you must be sure to properly prune the tree and test for overfitting.

The decision tree is a powerful, visual tool that can help you decide which combinations of indicators to trade and at what values to trade them. You can find a tutorial on how to build a strategy with a decision tree ここで or for a more general guide, in R ここで is a good resource.

最適化

Once you have the basis for your strategy, the next step is optimization, or choosing the correct parameter values to maximize your chance of success. Many strategies have a wide variety of parameters, such as indicator settings, the entry and exit conditions, stop loss and take profit levels, and position sizing, that make “brute force” methods of trying every single combination extremely difficult and time consuming, if at all even possible.

human-brain-gears

Solving these types of problems is another area where machine learning excels.

Optimizing a Strategy Using Genetic Algorithms

Genetic algorithms mimic the process of natural selection by creating a unique set of “child” strategies that contains a mixture of the best “parent’” strategies, with a chance of random mutation.

The process begins by encoding your strategy into an array. For example it could read as something like:

インジケーター 1 期間インジケーター 2 期間Buy ConditionSell Conditionリスク:Reward Ratio

Where a 50 – 200 period moving average cross, ととも​​に 50 pip to 100 pip risk-to-reward ratio would be:

50 – period Moving Average100 – period Moving Averageインジケーター 1 crosses above Indicator 2インジケーター 1 crosses below Indicator 250:100

 

You would then generate a large population of strategies with random variations of these parameters. These strategies all have different combinations of moving average periods, entry and exit conditions, and risk-to-reward ratios.

次, you would test this population by running each strategy over a test set and selecting the top strategies based on a performance metric of your choice.

最後に, you randomly combine the traits of the top strategies, with a small chance of “mutating” some of the parameters, to create a new generation of “child” strategies. You then repeat the evaluation procedure and once again mate the top performing strategies from this new generation. This leads to a survival of fittest scenario where only the top strategies “survive” to pass along their genes to the next generation

Repeat this process a large number of times or until a certain performance criteria is reached and you are left with a very robust strategy built from generations of the best performing strategies!

You do have to make sure that you select an appropriate performance metric (such as risk-adjusted return) and always test the final strategy over data that wasn’t used to build the strategy to ensure that you aren’t overfitting to a particular data set.

This is a very powerful and robust method that has been successful in a wide variety of applications, including the world of trading. You can find a more detailed description ここで and a tutorial on how to implement it in R ここで.

Live Trading

One of the more attractive aspects of machine learning is having an algorithm that is able to learn and adapt to changing market conditions. しかし, this creates a “blackbox” strategy that, if you do not completely understand how the algorithms work and thoroughly tested it yourself, is very difficult to trust on a live account. Not knowing when or why a strategy is entering a trade can be a scary proposition.

しかし, there are ways to get the benefits of an intelligent, algorithmic approach while still maintaining transparency and understanding in your strategy.

Association Rule Learning

Association Rule Learning is the process of deriving a set of clear, understandable rules from the patterns uncovered by a machine-learning algorithm.

Algorithms, like the Apriori algorithm, search a dataset of indicators, indicator values, and the resulting price movement to produce a set of conditions; basically “if-then” statements, that lead to the highest-performing results. しかし, it’s still difficult to know exactly where these rules are coming from, the Apriori algorithm requires a fairly large number of parameters to be tuned and this process does not lend itself well to changing market conditions.

と TRAIDE, we took the process one step further and allow you to see the patterns found by an ensemble of machine-learning algorithms, from which you can create your own trading rules. These rules are then easy to implement and adjusted to changing market conditions, all without requiring any programming or mathematical experience. You are able to get the benefits of using machine-learning algorithms to trade while still maintaining complete transparency, an understanding of your strategy, and including your own domain expertise in your trading.

Using machine learning and artificial intelligence to find an edge in the market does not need to be exclusively owned by only the largest financial institutions. As this technology becomes more accessible and these techniques more common, you too can use machine learning to improve your trading.

Tad Slaff

CEO/Co-founder

Inovance

 

以下の下でファイルさ: あなたの概念を歴史的にテストします。 タグが付いて: artificial intelligence, decision tree, machine learning, 最適化, 最適化

The Difference Between Optimization and Curve-Fitting

2 月 3, 2014 によって アンドリュー ・ セルビー Leave a Comment

Optimization and curve-fitting are two terms that are very common among quantitative traders. They are so common that many traders confuse the terms, or use them as synonyms when they actually have very different meanings.

Michael Harris recently published a guest post on System Trader Success that broke down the meaning of each of these terms and explained how they interact with each other. He also shared a process for determining how likely a strategy was to be exposed to a curve-fitting bias that is based on how its parameters are utilized.

curve-fitting

Knowing the difference between optimization and curve-fitting can help you avoid exposing your strategy to backtesting biases.

Optimization vs. Curve-Fitting

Michael began by defining each of the two terms individually. What this shows us is that they have subtle differences with respect to each other. Here is how he explains it:

As already mentioned, curve fitting may involve optimization but the latter is a process with a much broader scope and includes many more possibilities than curve-fitting.

Michael looks at strategy optimization from the viewpoint of finding the best collection of entry and exit signals for a backtesting period. He explains that curve-fitting focuses more on the results than the signals that caused the result.

Is Curve-Fitting Really The Problem?

Another interesting point that Michael brings up is that there is no mathematical proof that optimized systems are more likely to fail because they are curve-fit. He suggests that it is possible for any optimized strategy to fail at any point, and that the strategy failure has nothing to do with what parameters the system uses.

He explains that a different form of bias is far more likely to cause a failure:

それにもかかわらず, optimization that causes selection of entry and exit collections is in general a problematic process because it introduces survivorship bias.

Michael argues that in almost every case where an optimized strategy fails, サバイバーシップ ・ バイアス is more likely to blame than a curve-fitting bias.

How To Gauge Optimized Trading Strategies

While Michael does not believe that curve-fitting failures are nearly as prevalent as many traders believe, he does discuss how some strategies are more likely to be exposed to curve-fitting than others. In order to gauge how likely an optimized strategy is to be exposed to curve-fitting, Michael divides them into three different classes.

The first class contains strategies where the optimized parameters define both the entry and exit signals. These strategies are the most vulnerable to curve-fitting.

The second class contains strategies where just the entry signals are defined by optimized parameters. These strategies are less likely to be exposed to curve-fitting than those in the first class.

The third class contains strategies where the optimized parameters define only the exit signals. These strategies are the least likely to be exposed to curve-fitting.

 

以下の下でファイルさ: あなたの概念を歴史的にテストします。 タグが付いて: バックテスト, bias, カーブフィッティング, 最適化

3 Forex System Tips

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

Many systems nowadays promise profits without effort and easy pips right to your account. You probably know by now that real life doesn’t work that way. A genuinely profitable system is hard to come by. In this article I will describe three simple tips that help you enhance your existing trading systems. The goal is to make them more powerful and accurate.

Stop and Limit Entries to Catch Trends

Many trading systems use market orders to enter and exit the market. Market orders frequently exhibit low entry efficiencies. They get you in the market at a price that is not optimal. Placing a buy or sell order 10 pips from the price you wish to enter, in the direction of the trend for trending systems can make a big difference. For long trades put a buy order 10 pips higher than price, and for short trades put a sell order 10 pips lower than price. Range trading systems might consider limit entries, which would place the orders in the opposite direction of the example above.

Using ATR to Account for Volatility

Many novice system designers use constant pip distances in their forex trading system, すなわち. 15 pips for stop loss, 10 pips for take profit, など. This is a mistake as it doesn’t take into account changes in volatility. If the pair you trade exhibits changes in volatility, the system faces an increased likelihood of failure.

The Average True Range indicator (a.k.a. ATR) gives the average range of a forex pair or stock, and accounts for gaps as well. Instead of using constant numbers, use a percentage of ATR such as 50% ATR or 30% ATR. Once you do this change your system will automatically take into account volatility and will become much more flexible. Such systems will work better and will maintain profitability even in changing market environments.

Avoid Overoptimization

This is a tip especially for the programmers of you: over-optimization is the kiss of death of a trading system. 以上-最適化, a.k.a. カーブフィッティング, means that you add many Forex indicators and filters and use them all to confirm your signals, and optimize them all for maximum profits. In the バックテスト it will seem that your system is becoming better when in fact it will become good only for the past and will fail in any forward-test on real, live data. したがって, it is crucial to only include the most important parts of your system and do not add indicators that don’t make sense at the price-action level. Remember the principle of Occam’s razor: “The simplest solution is usually the most efficient one”.

Michael Wells is an FX programmer and trader. His site contains his insights about Forex trading systems.

以下の下でファイルさ: 戦略の取引のアイデア タグが付いて: atr, カーブフィッティング, efficiency, limit entry, 最適化, stop entry, ボラティリティ

専門家アドバイザーを最適化します。

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

One of the lesser known features of the メタト レーダー 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. この場合, 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 バックテスト, 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 最適化. 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: テスト, Inputs and Optimization. These screens allow the trader to inform MetaTrader which variables to consider for testing and how to weight the results.

テスト

The top of the testing section applies to every type of バックテスト. 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 または 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 メタト レーダー 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 値, strictly controls inputs for simple backtests. 、 値 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, ステップ と 停止. 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. 停止 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 ピップ. That means that you set Take Profit row to 10 ため、 Start column and 200 ため、 停止 column. The real trick here is selecting the ステップ. If you choose ステップ = 1, then MetaTrader will run a separate test for every value between 10 と 200. That’s 190 テスト, which is overkill. A step of 10 cuts the total number of tests down to 19.

最適化

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. 代わりに, I always focus on testing strategies for 入口と出口の効率. 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.

以下の下でファイルさ: メタト レーダーのヒント, あなたの概念を歴史的にテストします。, 戦略の取引のアイデア タグが付いて: バックテスト, backtester, brute force, カーブフィッティング, ドローダウン, EA, 専門家アドバイザー, 遺伝的アルゴリズム, inputs, MetaQuotes, メタト レーダー, mt4, 最適化, optimizer, プロフィットファクター, 利益を取る, testing

メールで無料の取引戦略

トレンド分析

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

アーカイブ

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

翻訳


無料の取引戦略

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

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