算法和机械的外汇策略 | OneStepRemoved

  • +1 (817) 210-4019
  • Articles
  • Sophisticated Web Sites
  • 自动交易
  • 免费专家顾问
  • 褒奖
  • 联系

工作 8 一个星期天

十二月 6, 2016 由 肖恩·奥弗顿 22 评论

Reaching an all-time high in my equity curve means it’s time to buckle down and keep improving. My Dominari strategy has done very well over the past 7 months and especially this and last month.

Dominari Equity Curve December 6, 2016

Is the party going to continue?

I certainly expect so. Drawdowns are inevitable, but that’s part of trading. Short-term performance is exciting, but my ambitious goal is to turn my starting balance of €8,000 into €50,000 within the next 3 岁月. As of this writing, I’m at €9,323.

You’re probably wondering how a 16% profit leads me to extrapolate an annual return of nearly 100%. The answer is that I dramatically changed my leverage at the end of September… just in time for that ugly drawdown. If I was trading on my current leverage, the current live return would be around 40% (即, right on track to hit my goal).

What really counts is what I’ve really done. 到目前为止, I’m up €1,323 with another €40,677 to go by December 6, 2019.

The research for Dominari is effectively finished. It’s been slightly more than a year since I began researching the strategy. Although minor variations of Dominari popped up or came from traders copying my signals, none of them improved the long term outcomes.

One version that improved the risk profile was to trade with limit orders. The original blog post mentioned limit orders, but the variation placed them considerably further from the current market than what I tried previously. I also lacked a system for choosing settings appropriate to every pair, which I’ve more than likely resolved. The problem is that I have a million things on my to-do list and only 8 每天小时. You’ll see some of my top projects when you scroll down.

Pilum: The latest and greatest

Pilum is a strategy based on a statistical process that identifies momentum. One of the scary elements about most quantitative strategies is that most of them are mean-reverting. They buy when the price drops and sell when the price rises. The approach is favorable (即, profitable) in the long run, but it takes some psychological fortitude to trade.

Pilum is a major advancement because now I’ll have a strategy that should profit exactly when Dominari is most vulnerable to a drawdown.

dominari trade outcome histogramThe new strategy uses 限价订单 to enter the market. 像 90% of these orders never execute. But when they do execute, I win 75% 的时间. 另外, my profile of winners to losers is very comfortable.

Most traders understand the ideas even if the statistical jargon is unfamiliar. Pilum’s biggest winner is larger than its biggest loss. The average winner is bigger than the average loser. 和, it wins 77% 的时间.

Pilum trade outcome histogram

到目前为止, I’ve done a sort of piecemeal backtest using R. When I finish the Quantilator (see below), I’ll redo the backtest in a fully fledged trading platform. 更可能, I’ll use QuantConnect to test the strategy level approach.

Trading platforms drive me crazy! The biggest problem that I have as a trader is continuously reallocating capital across my portfolio. MetaTrader的, NinjaTrader and the likes implicitly assume that I want to trade some percentage of my account balance on every trade. Either that, or that I trade fixed lots.

Trading that way is extremely inefficient. I’m trying to trade 40+ 货币, so I need to be able to decide which ones need the money for trading and which ones don’t have signals. 然后, among the ones that do have signals, I need to dish out their allocations proportionately. The allocations aren’t the same for each instrument. If you know of any good FX platforms that meet this requirement, then let me know in the comments section.

Testing Pilum on its own is important. More important than the performance of Pilum is how that performance interacts with Dominari. That means taking the daily equity values of each currency. Does Dominari lose when Pilum wins and vice versa? Should I allocate capital 50-50 between the strategies or does one strategy deserve the lion’s share of the portfolio? Is one strategy so good that it should get all of the money?

The main concern with portfolio allocation is how it relates to leverage. Dominari historically make 96% annual returns, inclusive of trading costs. 但, it’s also trading with leverage of roughly 19:1. It’s possible for markets to rip over stops and create significant losses.

USDCHF lost 40% of its value in one hour in January 2015. Say that the scenario was even more extreme and that nobody could place a trade during that time at any price. 该 40% move is multiplied by the 19x leverage used. That’s a theoretical 800% 损失; more than the money in the account.

Everyone loves leverage because they think of profits. Leveraging losses is a lot less exciting.

所以, if you could earn 96% annual returns and only use 5:1 杠杆作用, that is exponentially superior to earning 96% 上 19:1 杠杆作用. I need to compare the returns of Pilum to Dominari per unit of risk. That allows me to do cool things like

  • Minimize the negative variance of the returns
  • Increase absolute return
  • Dynamically increase/decrease strategy allocations if I find patterns in their interactions

It’s a lower tech way of averaging strategies, like the litte guy’s version of what Numerai is doing… except that I have to create all of the strategies myself.

Quantilator

I spent the last few months sending surveys to segments of my subscribers asking how I can better serve you. Articles about indicators are overwhelmingly my most popular content. The trouble with that content is that I can’t complete the research fast enough to keep up.

The most valuable thing I’ve learned from the developing algorithms for the past 11 years is my process of deciding whether or not an indicator offers predictive value.

Moving Scale

Say that you’re interested in gaps: do gaps predict future returns? What I normally do is code a gap indicator in R, implement my analysis methodology and give a verdict. My methodology is kind of like a system for building systems. Using my approach usually takes an hour for every new idea that comes along.

An hour is pretty short. An hour is REALLY short compared to when I didn’t have a research methodology. I used to waste 个月 on junk strategies.

With Quantilator, I’ll be able to analyze anything in under 5 分钟. I’ll only have to follow 3 steps:

  1. Run a script in MT4 to export price data and indicator data
  2. Upload the exported data to Quantilator
  3. Analyze the results

This tool will be 100% 免费. I’m planning to go through the most popular indicators in MetaTrader to analyze whether or not they offer an edge. I’m building a library of small edges that can be combined into powerful strategies like Dominari and Pilum. 和, in the spirit of open source, I plan to make that library available to you for free.

I’m writing this tool in Django, which is a Python framework for displaying web content. The initial version will do the analysis. I’m hoping to use this as an education tool. A bit of momentum can justify make it a fully fledged library with sample data, indicators and training videos and more.

Quantilator’s name comes from a key concept in my system analysis methodology; I break data into quantiles. These quantiles calculate average market returns for a given period of time. The quant in Quantilator refers to quantiles, but I really like the implied double entendre of making you a quant. 毕竟, that is what I’m doing for you!

更新: 该 Quantilator is now freely available at http://q.onestepremoved.com/

提起下: 规则, 指标, 历史上测试你的概念 标记: 回测, MetaTrader的, 组合配置, 组合系统, python, quant, QuantConnect, quantile

Analyze your Trading Algo with 3D Charts

六月 28, 2016 由 Lior 衣柜 发表评论

These days, any mention of the term 3D is associated with entertainment. But in fact, when it comes to charting, and more specifically to charting your trading algo, 3D charting is not only insightful but provides important practical advantages.

The most common chart to measure a trading algo is profit over time. That lets you know how much money the algo is making over a specific duration, usually from a few weeks to several months. As the chart below illustrates, it gives you a good idea how well your trading algo performs over time and it gives an indication of the periods when it was underperforming.

The thing is that, while profit over time are the two most important dimensions, they leave plenty of dimensions out—dimensions that can help you answer important questions. Such as why, during a specific period, was your trading algo under-performing? Or how much risk are you taking in a given time? 常, the answers to such questions can be the difference between profit and loss, between success and failure of a strategy.

Trading Algo

Trading Algo in 3D

First things first. Before we start running 3D charts on our algo it’s important to go over a few practicalities and make the 3D chart work for you.

Assuming you’ve already exported the data of your algo Profit and Loss to Excel you’re likely to have two columns of data, 例如. Time and Profit. Adding a third column will allow you to run a 3D chart, whether it’s volatility, risk or whatever additional dimension you deem necessary.

Once you have your three columns you click to generate a chart—you must choose a type called 3D surface chart. As you will notice, almost always, the Time stamp will be the X-Axis, Profit the Y-Axis and our third parameter will be the Z-Axis.

Now comes the important part—making the chart comfortable to work for us.You must remember that our goal in using a 3D chart in the first place was to identify areas of either exceptional profits or exceptional losses to optimize our algo.

As can be seen in the charts below, Excel divides the Y axes into ranges and each range is colored. The best practice is to choose the same color for levels that are not exceptional and select a contrasting color for the highest range and another for the lowest range. This allows us to spot the exceptional.

The Z axes changes the angle of the chart; the steeper the angle, the higher our Z parameter—say risk or whatever else we choose.

And finally, make the 3D chart clearer through formatting the Plot area. Play with the Y rotation angle as well as the Debt Level until you are comfortable working with the chart

Trading Algo Case Studies

Once you are clear as to how to make a 3D chart, it’s time to decide which dimension is relevant. 平时, besides time and profit, the following dimensions are worth considering—risk, volatility and duration.

例如, the chart above shows a profit over time of a specific strategy; let’s call it Strategy A. 突然, out of the blue, the profit plunges rapidly. It’s not clear why, yet.

Then we add another dimension—risk. 风险, 在这种情况下, will be the Dollar amount risked in a given moment. 现在, the reason is apparent; just before the profit collapsed, risk was rising, 还有. Maybe leverage jumped, maybe several positions were opened simultaneously; it depends on the strategy. But by using a 3D chart we were able to easily detect where trouble was coming from.

Trading Algo

Using 3D charts is not only good to spot weaknesses in a strategy but strengths. Let’s take a look at another strategy, which we’ll call Strategy B.

We will test how Strategy B performs during volatility. 在这种情况下, the volatility will be the standard deviation of each pair we trade. What we see is interesting. When volatility is high, Strategy B performs exceptionally well and not so well when volatility is average to low.

Trading Algo

In such a case, we should consider using the strategy only during high volatility to optimize returns.

More uses could be to measure duration per trade. If the duration is getting longer at certain areas perhaps the trigger for the entry or exit is not working well. The benefit with using a 3D chart here is that we put the opening time stamp on the X-Axis and the closing time stamp on the Z-Axis so we can actually analyze duration per trade over time. A 3D chart then is much more accurate than a two dimensional chart where duration is a trailing average.

结论

There are endless samples and ways in which 3D charts can allow you improve your trading algo and identify both weaknesses and strengths within your strategy. 肯定, you can manage with a 2-dimensional chart. But the benefit of 3D charting is that, 多次, it allows you to zoom in and identify areas of change much easier.

提起下: 历史上测试你的概念 标记: 算法, 杠杆作用, 挥发性

Optimizing Your Algo: Tips for Beginners

六月 6, 2016 由 Lior 衣柜 发表评论

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.

其次, 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 然后

如果 (马(30)>马(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 作品. 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. Ç) (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.

 

提起下: 历史上测试你的概念 标记: 均线, 优化, 相对强弱指数

Oscillators you need to use

五月 31, 2016 由 Lior 衣柜 8 评论

振荡器, one of the most interesting groupings of technical indicators, are designed to signal overbought and oversold levels. Oscillators are a family of indices that go beyond the mathematics. They focus on one important thing and that is momentum, or more specifically changing momentum. Before we delve into which Oscillators are best to use and how, let me save you some unnecessary pain. Let me tell you first what oscillators aren’t.

How Not to use Oscillators

Some traders believe that Oscillators are some sort of magic indexes. Rest assured when I tell you they are not. Oscillators’ main use is not to tell you whether to buy or sell. 宁, they alert you to when it might be a good time to execute a buy or sell strategy. That is a very big difference. Those who attempt to use Oscillators as an ultimate buy or sell signal should be ready to learn a tough lesson. Those that will use it to fine tune their timing, 然而, will find Oscillators a very powerful tool.

Now that we’ve established what oscillators are good for let’s focus on which oscillators are worth your time and how to use them.

MACD指标

Perhaps the most widely used Oscillator in Forex, 该 MACD needs no special introduction. What it does need is a proper explanation of how to use it and when.

The idea of MACD is to signal your entry point when you’ve already figured out where the trend is going. It’s not going to alert you to a trend. What that means is that you first have to perform your technical analysis. Once you reach a conclusion, 然后 you can use the MACD.

On MT4, the MACD comes with default parameters (12, 26, 9). 12 represents the fast Exponential moving average, 26 the slow exponential moving average and 9 the Simple MACD average. 平时, when you trade on a daily basis, those parameters are fine.

Now in the chart below we see two points, A 和 B. In point A, the histogram moved above the average and that is supposed to be a buy signal. 但, technical common sense says that a pronged bearish trend cannot end abruptly without some form of double bottom. 因此, one should ignore that signal.

But in point B, 这是一个不同的故事. After a double top that hits a resistance level and hits the trend average, there’s a case for a short. But we need to know when. Notice how after the second top the histogram in the MACD falls again below the average? That’s our mark and that is how you use MACD to time your trade. 再次, the lesson here is that Oscillators are for timing, not for point to the pair’s direction.

oscillators

随机震荡

This is one of the most interesting indicators in the Oscillators family. What I like about this indicator is that it essentially gives you a 2-dimensional picture of overbought, oversold and momentum. Unlike the MACD, that’s not always accurate on overbought/oversold level.

The idea of the 随机振荡 is twofold. 第一, it’s normalized from 0 到 100, anything below 20 is oversold and anything above 80 is overbought.

第二, using the convergence between the %K line and the %D line tells you something. Not only can you tell when there is an overbought/oversold level but also when the trend turns bullish or bearish. Thus it affords a 2-dimensional use of momentum. 困惑? Here’s a classic example of how I would use a stochastic oscillator.

In the first part, we can see that in point C, after the pair has bottomed, the stochastic oscillator was below 20. That signaled an oversold level. We can conclude that there the pair is bottomed out, through a double bottom pattern. We can use the oversold level as enforcement but wait before dipping our toes into a buy position. Only in point D, as the blue line crosses the red line, we get our signal for entry.

然而, one other thing is important to note and that is point E. In point E we get the blue line crossing the red line as it does with C. 然而, since the cross occurs very close to the overbought signal that should deter us from establishing it as an entry. Which means if the crossing in point D was close to the stochastic 80 级别, we should have avoided entry.

oscillators

平均真实范围

Last but not least, one of my favorite indicators, the Average True Range or ATR for short. Unlike the other two Oscillators the ATR is useful in anticipating potential rises or falls in volatility. Also unlike the other two, there is no oversold or overbought levels. If the ATR is high it suggests volatility is high. 反过来, if the ATR is low it suggests volatility is low.

How can we use this to predict volatility? We know, 当然, that volatility is cyclical. Thus we can assume that when the ATR is at record lows for a prolonged period (point F) it’s a signal that a spike in volatility is coming. 和, 事实上, we can see volatility did come and we got the big spike.

If we decide to use the support as an entry signal we can ATR to gauge whether there’s a chance our buy trade will have a strong momentum. If the ATR was at a record high when we decide to buy that would have been a cautionary note. Not to entry but because it signals that volatility might fall and that means momentum might have been weak. The same principle, 当然, works for a sell signal.

oscillators

提起下: 历史上测试你的概念 标记: 平均真实范围, MACD, 振荡器, 随机

Beware of a Trading Strategy That Does Too Well

五月 10, 2016 由 Lior 衣柜 2 评论

Can a trading strategy be doing too well? That sounds counter-intuitive, certainly. Like suggesting that someone can be too rich or too successful. You might be thinking there’s no such thing. But when it comes to managing your trading strategy, one that is performing too well is a warning sign. That’s because, 经常, an over-achieving trading strategy can turn into a honey trap.

In this article we will focus on a couple of cases studies where a “too good” strategy is something to watch out for. 希望, that’s a lesson one can learn from now rather than, painfully, at some later date.

A Trading Strategy with a High Win Ratio

The first case study is one of a strategy of mid- to short-term timeframes. In this case study, the frequency of executed trades is higher than 100 a month.

平时, a solid strategy has an average 赢得比例 的 45% 到 60%. That ratio might sometimes be lower if the risk reward ratio is very strong. But higher than that is almost always is unsuitable.

In the strategy below we can see that the average win ratio per month runs from as low as 44 to as high as 64. Sometimes it is on the rise in the higher range and sometimes in the lower range. Regardless which, eventually it will all revolve around the average.

例如, in the month of January 2014, the win ratio was 52%. That means that for every 100 trades executed, 52 是盈利的.

But in the second part(红), we can see things start to go a bit too well. The win ratio jumped to above 80% and stayed above that level for 3 个月. 自然, 在 80%, that was far beyond the norm. What would come next was inevitable.

后 3 months of more than 80% of profitable trades, the win ratio fell to roughly 20% for the following 3 个月. Because a long-term win ratio always has a long-term expectancy of maximal 50-60%. That means that a prolonged period of a high win ratio can be followed by a prolonged period of a very low win ratio.

Trading Strategy

Why is it Risky?

第一, if you had 3 months of roughly 20% win ratio means you lost 80% of the trades. That means that, assuming you trade 100 times a month, you lost 80 行业. That’s a pretty hard hit. And if you risk $50 in every trade you lost $6,000 on aggregate (80 losing, 20 profitable) 后 3 个月. That is a big blow.

The second reason it is risky is more psychological but still very common. That is that many traders fail to realize that an overly high win ratio is very temporary in nature. Having failed to see that, what do they do? They raise their leverage. And when the sweet turns to bitter and they have only a 20% win ratio for 3 个月, then what? All they’re left with is an empty account.

What should you do? This is rather simple; you reduce the risk you take per trade by lowering your leverage. It’s true you will gain less but you will also avoid the pitfall that comes after. 当然, if your leverage is already low and your account can sustain a prolonged period of a low win ratio than let statistics reign. But be prepared, psychologically, for choppy times.

Trading Strategy Profits that are Too Much Too Fast

The second case study is common in trading strategies that are low in frequency. The durations may range from a few days to even a few months. Let’s say you enter into a buy trade after your trading strategy indicated a bullish trend. You set the limit at 1,290. 平均, you expect the limit to be reached within 3 到 4 天. But suddenly the trade advances in a fraction of the time and reaches relatively close to your trade.

Why is it Risky?

Because many times traders insist on waiting for their limit to be hit so they leave the trade open. But then the pair moves into overbought territory and before you know it the trend has reversed. You either close the position with a much smaller gain or, even worse, you lose the trade. Because you trade at a low frequency, this one outcome can be quite painful. You lost precious time when your position was open and missed the potential profit that you could have made.

What should you do? The solution here is rather simple, 还有. You could use a trailing stop loss which is the most obvious tool to avert such cases.

另外, you could use oscillators to identify a potentially hazardous situation. Add a component to your trading strategy to alert you if your pair reaches an overbought (or oversold) 级别. Make it a practice to exit the trade even if the target was not reached.

Trading Strategy

提起下: 历史上测试你的概念 标记: 风险, 胜利损失率

Become an Algo trader in Baby Steps

四月 4, 2016 由 Lior 衣柜 10 评论

The world of traders is divided into two groups; those who trade using algorithms and those who don’t. Those who trade using algorithms, aka algotraders, are well aware of the advantages of trading with an algo… And for those who don’t use algos? They are equally aware of the algo advantages but are reluctant to dive into its complexity; they are deterred from learning how. But the road to success in trading is not by avoiding challenges, but overcoming them, perhaps in baby steps.

First Baby Step to becoming an Algo trader

Let me ask you a question. What do you think is the first thing you’d need to do to become an algotrader? You might respond, “Learn programming, 当然! How else?” Well, you’d be wrong.

If you plan to learn programming for the sole purpose of becoming an algotrader, you’re likely to get lost. 终于, in despair or frustration, you’ll give up on algotrading.

There are numerous languages, from MQL to R to Python, and you have to decide which one to start with. You might find yourself wasting valuable time learning far too many trivial functions. It may take quite a long time before you even create a trading algo, let alone a profitable one.

But there’s another way, which I call reverse engineering.

The first step is to figure out which trading algo you want to make. 换句话说, what are the functions and strategy it should implement? Then you test it and finally, move on to the programming part. 这边走, you’re focused like a spotlight. You know exactly what your algo should do and can focus on the exact functionalities you need to learn to make it happen.

Everything will just come intuitively; which language, how and in what. All the pieces will fall much quicker into place because you already know what to look for.

The best way to start is by using a flowchart. It is actually one of the first things you learn in programming schools.

And what determines the flow? 当然, it’s the conditions. What we call the “ifs.” “Ifs” can be one condition or have many “ands” and “ors.” That’s how you decide what your algo should do in any given circumstances. The conditions to the algo are what the brain is to the body; they do the thinking.

Second Baby Step: Use Excel

Once you’ve made a flowchart of conditions, rather than using a complex tool, use Microsoft Excel or some other spreadsheet software.

Algo

来源: MT4

Extract historical data of a price data; start by using only the closing price. If you want to trade on a daily interval, extract daily data and so on. Use a separate column for each of the conditions in the flowchart, that way it’s easy to write and figure out. Add another column for a buy and sell output to mark when you “opened” and when you “closed” a position. And finally add one column of accumulated profit/ loss.

Use separate columns for each conditions and fill the chart. All you need now is to run a linear chart on one column, accumulated profit/loss, and look at the algo’s historical performance.

Once you master the basics you can move on to move advanced back-testing and curve fitting. But for a start that will do.

Algo

最后, Learn to Program

行, you’re not a “baby” anymore; you have a good idea of what an algo trader needs to do. Now that you’ve got the concept down pat, you’re ready to begin learning programming.

In terms of which language to start with, that will depend on the circumstances. If you are already using an MT4 platform, it’s a no brainer; learn MQL which runs on MT4. The MQL website is filled with “how to” materials. And since you already have a diagram of your algo and an idea what you want to do, finding your way should be simple.

But if you trade with a different broker, you’ll have to decide which best suits. 亲自, I recommend starting with MQL, just because it’s easier. 然后, you can move into Python, which is a rather easy language to learn or C++ if your algo needs to work fast. If you algo is heavy on the math then perhaps R would fit.

Here are some places you can learn online:

MQL

Coursera

Code Academy

EDX

或, 当然, you can learn from a book. I am more of a book person, but that’s just me.

Then there is another issue—API. API is the mechanism that enables your algo to communicate with your broker and execute your trades. Some brokers work better with certain programming languages than others. Most large brokers have communities and forums that can go into detail as to the best way to use an API.

Unlike the first two baby steps, no one would ever say that learning to program was a baby step. 宁, it’s more of a giant leap. It takes time to learn and to master, though it is worth it in the long run. 与此同时, you can always use libraries of codes on the web for more complex algos. The thing is that once you’ve accomplished the first two baby steps, making the final leap into programming is a no brainer.

提起下: 历史上测试你的概念 标记: 算法, API, 高强, MQL, 程序设计, ř

大的变化,以Dominari

三月 9, 2016 由 肖恩·奥弗顿 24 评论

I said it 这里 和 这里 和 这里. The biggest issue with my Dominari is trading costs. Things aren’t going to really take off until I do one of two things.

  1. Reduce the trading costs
  2. Make more money on each trade

I’ve been working on Dominari since around September or October of last year. After racking my brain for months, I more or less wrote off the idea of improving the trade profitability.

That suddenly changed last week on Friday after the market closed. The best reason to trade my own systems live is that the agony of underperforming forces creativity. The feeling reminds me a lot of Daymond John’s (the guy from Shark Tank) new book the Power of Broke. When life isn’t going your way, it’s the resourceful and creative who are best able to get to the top.

Nobody wants to feel broke or under extreme stress. As much as we hate those feelings, they’re often the strongest drivers of performance. That’s how I feel right now with Dominari. I’m so close to getting there and wasn’t sure how to fix that missing ingredient.

If it weren’t for that stress, I would not have had my simple but very powerful insight last Friday.

And please don’t laugh. The change is so dumb and obvious that you’re going to wonder what’s wrong with me. When you’re in the thick of designing a system, the ugly truth is that sometimes you get lost in the weeds. Or to use another botany metaphor, you only see the trees instead of the forest.

My key insight was to slightly modify the exit strategy to use limit orders, whereas previously I only exited based on the close of the bar. I noticed two repeated behaviors that finally beat me over the head enough that the point finally sank in.

The number of occasions where my trade closed in the optimal location seemed to be significantly outweighed by the amount of money left on the table. The key insight for me was realizing where to optimally place that limit order. And for those of you on my newsletter, it happens to be closely related to the 自动止盈 that I’ve been talking about all week.

Backtest assumptions and results

My operating mantra when doing backtests is to minimize the number of assumptions. Spreads for retail traders have changed dramatically from 2008 to today. I remember working as a broker at FXCM when our typical spread on GBPCHF was something like 8-9 点子. I now routinely pay something like 2 点子. It’s impossible to model what happened in the middle without haphazardly guessing.

I find it far more convincing to analyze the raw signal, both on historical and recent market data, then to interpret whether trading costs are likely to be favorable in today’s markets. “Raw signal” is the ideal signal, one which assumes perfect execution, no slippage, no rollover, no spreads and no commissions. The natural result is that you’re overstating historical performance, but the benefit is that you have a very clear idea whether the core idea is a system capable of predicting the market with reasonable risks.

The total leverage employed in the portfolio is 7:1. If I have a $50,000 trading account and held a position in every currency pair in the portfolio, then the notional value of those trades would equal $350,000 (50k * 7).

Another key point is that I used a fixed position size of $12,500 每笔交易. The size of the trade never increases or decreases during the backtest, which allows me to isolate the impact of the raw signal without adding the variable of money management.

Here are my trade metrics with version 1 of Dominari. Click the images to view them in full size.

Version 1 backtest of Dominari

The first version of Dominari had a profit factor of 1.26.

After here’s the change with Dominari version 2.0.

My new version of Dominari increases the profit factor to 1.59 with a significantly lower drawdown.

My new version of Dominari increases the profit factor to 1.59 with a significantly lower drawdown.

My best case scenario was to hope that the profit factor would jump another 10 points or thereabouts, maybe stretching the profit factor to 1.35 or thereabouts. It’s incredibly exciting to see the edge over breakeven more than double (going from a $0.26 edge to a $0.59 cent edge).

What I’m most excited about is the skew in the returns. Most mean reversion systems look for an edge but are overwhelmed with the impact of losing trades. That was the case with version 1.

Skew of Dominari version 1

The largest losers outweighed the largest winners in version 1.

This new version of Dominari is the very first 均值回归 strategy that I’ve ever developed where the winning tails (ie, the biggest winners) nearly equal the losing tails (the biggest losers). It’s almost always the opposite with mean reversion strategies. 所述另一种方式, the risk profile of the extreme outcomes significantly improved with version 2.

Fat tails in Dominari v2

The impact of the biggest winners is nearly identical to the biggest losers with version 2.

And the metric that most traders care about the most, 提款, is wildly improved. Version 1 showed a drawdown of 5.72%. The new version is a fraction of that at 1.77%.

Out of sample backtest for Dominari version 2

The out of sample performance is nearly identical to the in sample performance, despite significantly different market conditions.

When I walked my test out of sample onto recent data, covering 2013-2015, the performance characteristics of version 2 are nearly identical to the in-sample test. The profit factor was identical at 1.59, and the max drawdown was 2.01% 为 2013-2015.

Translating the theoretical into expected performance parameters

再次, those metrics above are in the ideal world of perfect execution and no trading costs. The real world performance will have lower returns and higher drawdowns. The advantage to having live trade data is that I can now make some kind of intelligent estimate of my expected trade accuracy and profit factor. Just how overstated are the idealized returns likely to be?

The process that I went through to calculate the expected profit factor in the real world is a 5 步骤的过程. I don’t think it’s going to make any sense if I try to write out the steps in conversational English. 代替, I’ve chosen to share a spreadsheet where you can view the step by step process for how extrapolating live trading data into expected performance with the new strategy. 点击这里 to view the spreadsheet.

The expected profit factor for my live trading is expected to be between 1.29 到 1.39. The expected percent accuracy for live trades should jump from 62.55% 到 70.8%.

The traders who will get first crack at the Total Access Apprenticeship are those are subscribed to the free newsletter. If you’re not signed up, make sure to fill in your email address in the orange box at the top right of this page.

提起下: 规则, 历史上测试你的概念 标记: 回测, 肥尾, GBPCHF, 杠杆作用, 均值回归, 获利因素, skew

Engineers Can Leverage Their Experience to Trading

二月 25, 2016 由 Lior 衣柜 5 评论

There are many kinds of engineers in the world. 事实上, given the vast variety, it would be an effort in futility to try and name them all. But what does it really mean to be an engineer? And the bigger question: how exactly is this related to trading? A good friend of mine who is an engineer said, very aptly, “Scientists do the work of God; engineers do the work of man.”

Although I am not sure he can claim that quote as original, there is nothing better to describe what engineers do. Being an engineer is a mindset. You must be able to solve problems and build mechanisms in the imperfect world of man. And often times, those conditions are far from ideal.

And that is 确切地 the state of mind you need to build a profitable 交易策略, whether discretionary or algorithmic. 所以, if you are an engineer, that’s great! This article could help leverage your experience in trading. And even if you’re not, you might still learn something useful.

Engineers define the project in detail

If I were to ask an ordinary trader what trading strategy he plans to build, what might be the answer? More than likely I’d hear that he wants to build a strategy that is profitable. And while that it is, 自然, the ultimate goal it’s hardly enough to build a successful strategy.

If I were to ask an engineer the same question, 然而, I’d surely get a very different answer. Engineers define each project they’re working on in great detail. In our case, 然后, the trading strategy they’d likely wish to build would have a number of inputs. An engineer’s definition of a strategy might be something like this:

Strategy Interval: 1-3 天

Type: Momentum

Maximal Drawdown: 20%

Value at Risk: $500

Target Profit Limit: 100 到 150 点子

Target Stop Loss per Trade: 50 到 75 点子

Target Win Ratio: 50%

By having these very detailed parameters, the engineer already knows several things. 第一, that he has to design a trading strategy that’s built on momentum (rather than something else). 第二, it has to have a maximal draw down of 20% with a maximum risk of $500 at any given time. 第三, each trade has to have the potential of at least 100 pips and a stop loss of maximum 75 点子. And fourth, in the longer run, 至少 50% of all trades must be profitable.

明确地, an engineer doesn’t choose a trading strategy arbitrarily. He already knows exactly what he wants to build and chooses all the tools (均线, 等等) and strategies accordingly. 肯定, it does not guarantee he will be successful. And he may eventually have no choice but to change his targets. 毕竟, he is doing the work of man where nothing is perfect.

But the point is that setting a plan in detail narrows irrelevant options. 因此, everything is more result-oriented.

Engineers anticipate what could go wrong

大多数人, when they have a good trading strategy, think about how much money they can make. 你懂的, they dream about how good it can get. But an Engineer’s natural instinct is just the opposite. 代替, an Engineer is trying to figure what could go wrong.

An aeronautical engineer would test an airplane in extreme weather to ensure it doesn’t crash. 同样, an engineer building a trading strategy will test it for failures. The end result, 当然, is that the engineer will build a better and safer strategy.

Engineers are open to ideas

When there is a particular mechanism of functionality to be filled an engineer looks first for a readymade mechanism. 在交易, 例如, it could be finding a good tool to identify volatility. Or perhaps a good signal for momentum. Once found, provided that it is acceptable, an engineer will incorporate it in his strategy.

An engineer will not be fixated on investing his own idea. Engineers do not believe in re-inventing the wheel. 简单地说; if it works, it works.

结论

Many engineers might now realize they already have the mental tools needed to succeed in trading. They just need to implement their ingrained work habits and apply them properly. And many successful traders will find that they have already implemented the lessons learned here.

Engineer or not, successful trader or not, it’s never too late to learn how to think “smarter.” In the long run, it will enhance your trading strategy.

提起下: 历史上测试你的概念

Monitoring my live trade execution

二月 10, 2016 由 肖恩·奥弗顿 29 评论

Dominari’s biggest risk is its trading costs. In the midst of losing 6 days in a row, I found myself extremely concerned about Dominari’s performance. Did the signals go bad all of a sudden or is this a normal drawdown? Is Dominari losing because of trading costs?

I decided to start analyzing my FXCM account. Part of the nerves were driven by the fact that it took 2 weeks to setup the account. The compliance process took far longer than usual because I’m a former employee. Two weeks later, I turned on the account just in time to a) miss the biggest equity growth and b) to catch the biggest drawdown.

I felt more hostile to the FXCM account performance because I didn’t have any profits to pad the losses. This is all coming from my original risk capital. And I’m having my third child soon. Giving birth to kids in the US is incredibly expensive. I’ve got better uses for the money than to throw it away in the markets!

所以, the real question is: am I losing because it’s just a rough patch or because FXCM is eating my lunch?

backtest-equity-fxcm

This image is a 测试有效 equity curve over the same period of my live performance. I’ve traded live since January 28, but the trading didn’t begin until the afternoon. 如你看到的, I again missed another patch of strong performance.

The rest shows something of a fairy tale. The backtest shows a return of 19.13% over that period, whereas my live performance is down 10%. How much of that is due to commissions, 传播, rollover and slippage?

The backtest shows a profit of $956.65 with no trading costs.

My real results, 哪 1) show a profit on the backtest but 2) are actually showing a loss in real life, can be used to estimate a floor for my trading costs. The formula for that is
( Total profit and loss + 佣金 + rollover) / 总交易, which is currently $1.58 in costs per trade.

The commissions and rollover are easy to separate out using either Myfxbook or the FXCM account report. The grand total spent so far on commissions is -$239.80 和 -$3.05 on rollover.

The hardest part to separate is the spread paid. I’m not recording the spread paid on every trade (maybe that’s a mistake and I need to add it). But I’m going to use the table below to estimate. I took a random sample of 30 trades from the 501 trades completed at the time of my analysis.

Spread PaidSlippage
0.0001985231.49E-05
0.000153951-5.13E-05
0.0004558230.000227912
9.98E-050
0.000161242-0.00313413
2.76E-05-9.19E-06
5.55E-056.94E-06
0.000110898-1.01E-05
9.24E-050
9.91E-05-1.57E-16
6.55E-051.31E-05
4.85E-052.08E-05
8.22E-05-1.67E-16
6.87E-050
6.95E-05-1.65E-16
0.00015173-2.17E-05
9.43E-05-2.36E-05
9.38E-05-0.00225922
7.61E-05-0.0024735
0.0001600381.00E-05
0.000135020
0.0035426254.52E-05
0.000222978-0.00376275
7.62E-050
0.0004327977.73E-06
2.61E-050

The average slippage (the right column) is a stunning -0.044%. I’m getting negative slippage on average with FXCM. That’s outstanding! FXCM is improving my fills even though my entries are requested at a worse price. Whatever misgivings I’ve had about FXCM in the past are alleviated. That’s impressive execution.

Estimating the spread paid is much more difficult. I’ve chosen to take my average trade profit on a $5,000 account as the starting point. The trouble is that the value of an average winner can depend on the account performance. If I use stagnant position sizing, then the drawdown doesn’t effect the value of the average winner. Under that assumption, the average winner is $3.48 每笔交易.

But if I use compound position sizing, the drawdown eats away most of the profits. That drops the average trade value down to $1.70.

I converted the spread paid from pips into percentages. Using EURUSD as an example, 一 1 pip spread works out to 0.0001/1.12727 = 0.000089. The reason for doing this is so that I can compare the spread on EURUSD to something with a much wider spread like AUDNZD. The spread is wider on AUDNZD, but the value of a NZD pip isn’t the same as a USD pip. Percentages allow for an apples to apples comparison.

The average spread paid in my sample was 0.00026157605, 这是 0.026%. Putting that back into terms relative to my account balance, I’m paying 0.026% * $5,000 = $1.31 per trade in spread. Across 420 行业, 这是 -$550.20 in spreads.

Total costs are spread, commissions and rollover:
$550.20 + $239.80 + $3.05 = $793.05

On a per trade basis, 就是说 $1.78 in costs per trade from my estimates.

The total profit on the backtest was $956.65, but I missed about $550 of it because trading didn’t start until 17:00 on the 28th of January. That leaves the backtest profit somewhere around $406.65.

That puts the re-estimated profit and loss at $406.65-$793.05 = -$386.40. The actual loss is -$469, which I feel is a reasonable discrepancy based on the fact that I’m estimating how much profit was contributed on January 28 instead of knowing for certain.

The conclusion is that I need to turn off this trading at FXCM. Even if I joined their active trader program and traded in the top tier, it would only save me half the commissions. Most of the trading costs are in the spread and not commissions. I’m seriously considering a move to a broker that will allow me to make a market by posting limit orders. 但第一, I’ll need to go over my Pepperstone account to review the trading costs for myself and clients.

提起下: 规则, 历史上测试你的概念 标记: 回测, 福汇, 滚下, 滑移, 传播

现场演示测试与限价单的新战略

11 月 24, 2015 由 肖恩·奥弗顿 17 评论

我拿出了惊人的期待backtests所有的时间. 这是使用了最新的例子 SB得分.

backtested equity curve

新战略没有交易成本的资金曲线.

该战略的自由和假设版本得到 $79,618.82 对于一个的未归还 796.19% 经过一段 3 岁月. 该战略交易所有的主要外汇交叉盘. 正如你可以告诉, 信号质量保持在多个市场条件几乎不变. 看起来不错.

问题是交易成本. 它总是交易成本,使生活困难.

交易成本下降的利润 98.22%

交易成本下降的利润 98.22%

我始终以一个重悲观的看法,当谈到假设交易成本和延误. 它需要大量的智力诚实的, 但在努力避免乐观的假设节省了很多痛苦和失望的道路. 该假设是在这里我们假设利差和滑移北跨币种真的严重 5 点子.

与悲观的交易成本假设的性能下降到只有使 $1,000 利润. 该策略并不需要去垃圾桶, 但它远没有准备好黄金时间. 有没有场景,这是有道理的市场订单交易.

一般特性

平均交易每天: 39
货币对交易: 27
%的准确率: 66.52%
风格: 均值回归
排行榜: 每小时

如何在低价交易

我是出了名的节俭. 一个在大学我的兄弟会还是讲述我的故事计数零钱并跟踪它在MS货币.

那种心态驱使我的妻子疯了… 但它是一个交易者一个真正的资产! 交易商使他们的钱像其他商业人士的利润.

我花了昨天下午的编码有轻微的扭曲这一新战略. 而不是支付对每一个行业蔓延, 如果我使用限价单是什么,试图赚取价差?

目前原料价差在欧元兑美元 0.3 点子, 这是值得 $0.03 每microlot. 的交易佣金是 $0.03 每microlot. 如果我获得一个额外的 $0.03 每microlot, 至少覆盖所述交易成本. 像NZDCHF对那里的原始传播 1 果仁, 这增加了额外的 $0.04 ($0.10 – $0.03) 每侧. 即, 入门信号,使额外的 $0.04 和出口也使得一个额外的 $0.04 在每一个行业.

即使在NZDCHF安静的对仍然表现出对每一个酒吧程度的噪声. 我没有做任何研究来支持它, 但我的主观经验说的是,灯芯 90% 或更多的杆将至少只要蔓延是宽.

交易商使他们的钱像其他商业人士的利润.

所述另一种方式, 如果欧元兑美元的价差为 0.3 点子, 然后就开和低价格之间的差额 90% 酒吧应至少 0.3 点子, 太. 这是我的假设, 无论如何.

扭使用限价单的策略的例子

再说说我的信号输入刚才弹出市场. 目前的价格为欧元兑美元 1.06457 X 1.06462, 这是 0.5 点子. 该backtests以为我会击中 1.06462 要价并支付蔓延.

这个想法对我的测试是把我的极限秩序 1.06457. 因为我是一个分销商, 这意味着我要问,市场向下移动半个点子之前,我会得到有一个位置. 需要一个小的举动对我有利理论上收入超过跳进市场双脚.

现场演示测试开始

我可以在后台测试理论模型的想法, 但也有让毫无意义的关键假设.

1) 平均利差可我 2009-2011 回测期间远远宽于他们的今天
2) 全天的价差显著变化. 欧元兑美元是经常低 0.2 在欧洲sesssion点子, 但可以很容易地撞过来 1.0 点子在亚洲交易中最乏味的部分.

第二项可以在一个后台测试完全有害. 这是更好地验证这一想法上的现场演示,并得到更接近于真实的交易数据.

Demo testing

第一 15 现场演示的测试时间.

我只是 15 小时到测试, 但至少一切都是一个良好的开端.

为测试的目的是简单: 把至少 300 在帐户交易. 这应该只需要大约 2 周以来的策略是让多动.

该标准的成功也同样简单: 并实时模拟交易性能达到或超过了同一时期的回溯测试性能?

我开始交易日晚 23, 这意味着我应该打我 300 各地交易的10天交易门槛. 该交易次数会波动, 但应该发生的某个时候周围12月4日.

即使我有现场演示数据, 我要运行十一月进入市场的回测 23 至十二月 4. 如果模拟交易, 它采用限价订单, 超出市场进入后台测试, 然后,我有一个合理的理由假设的策略是准备在一个小的真实账户交易.

comparison scale

我也烫了现场模拟过程中出现的bug. 更可能, 这些日期将被推迟. 我已经找到 2 之后只需要调查的问题 22 行业. 有一个在判断它是否坚持不完全是一个战略毫无意义的规定.

代码相同的策略两倍?

你可能注意到,正向测试的资金曲线是从MetaTrader的. 为什么我会测试于一体的平台,但在另一个执行? 我所有的backtests是在先知做.

如果有两个人的工作问题,他们都以同样的答案到达, 那么他们可能正确地回答这个问题. 同样的逻辑也适用于编程. 如果我编写一个版本的策略和经纬程序的版本策略, 他们应该把完全相同的交易. 任何差异意味着一个人的编程错误.

我经常使用这种方法,因为逻辑丝毫的错误可能导致完全不同的交易结果. 这是赚了很多钱,失去了很多钱之间的区别. 是的, 我牺牲效率. 赌注的策略是如此之高,这是更好地使 2 人做同样的工作,以换取知道这是正确完成的信心.

MetaTrader的是劣质通过各种手段先知. 我在MetaTrader的写我的代码的唯一原因是,我渴望验证这一想法. MQL4是容易的,我的代码 – 编程为MetaTrader 是我们的主要业务之一.

经纬结束下周编程先知版本后 (她断过感恩节), 我会依据对她比较我的MT4版本. 这是非常低效, 但我也知道,我怎么可能是浪费周分析根据交易规则不我的战略完全匹配放置. 有备无患!!!

如何催肥边缘

有一件事我恨零售交易是极少数场馆提供了一个真正的ECN. 交易对传统的零售外汇经纪商意味着我必须等待价差回落摸我的订单. 在这个例子中我使用了欧元兑美元, 它要求市场招 0.5 对我有利点子之前,我的填充.

交易中的ECN将显著增加接到限价令上填充的概率. 使用欧元兑美元例子,目前的价格是 1.06457 X 1.06462, 我会放置一个限购令的出价在 1.06457. 如果有人在市场上销售,当时, 它意味着至少所述订单的一部分将几乎立即填补.

有效, 交易在零售点差包含最坏的情况下执行. 价格有调整 0.5 点子对你有利为了得到填补. 如果你交易的一个ECN和价格下跌 0.5 点子, 你会得到填补每一次. 但你也有机会获得更早更快填充,因为如果有人进来,去短期在市场, 书上的顺序坐等着别人来打它.

fat margin

聪明的商人在其权力范围催肥边缘做的一切

我在进行演示测试现在. 如果达到或超过后台测试结果, 然后我就知道具有最高的可信度可能的方法是准备现场交易. 我可能会开始与几千元的第一个月. 然后, 如果成功, 我真正开始它的规模.

没有理由,所有的交易必须发生在H1图表. 我总能一分钟却将交易间隔, 2分钟… 59分钟. 甚至有, 这是可能的

我的理想的方案是在一个ECN场地交易策略, 这需要一个最低余额 $250,000. 这笔钱是远远高于我很舒服冒险. 交易的旧规则是,你永远不会冒险超过您舒适输球.

这意味着我很可能会寻找一个合作伙伴,以确保战略可能最好的环境中运行 (一个ECN). 您可能是该合作伙伴? 如果是这样的, 发送电​​子邮件至info@onestepremoved.com~~V和介绍自己. 什么都不会发生了好几个月, 但它总是需要一段时间来建立关系,并感到舒适与项目.

提起下: 规则, 历史上测试你的概念, 交易策略的想法 标记: 回测, 限制, 传播

  • 1
  • 2
  • 3
  • …
  • 10
  • Next Page »
通过电子邮件免费交易策略

趋势

抱歉. No data so far.

档案

  • 规则
  • 如何在外汇市场工作?
  • 指标
  • MetaTrader的提示
  • MQL (书呆子)
  • NinjaTrader提示
  • Pilum
  • QB临
  • 停止赔钱
  • 历史上测试你的概念
  • 交易策略的想法
  • 未分类
  • 这是怎么回事,在当前的市场?

翻译

EnglishEnglish
中文(简体)中文(简体)
DeutschDeutsch
日本語日本語
Bahasa MelayuBahasa Melayu
PortuguêsPortuguês
EspañolEspañol
由 Transposh - translation plugin for wordpress

免费交易策略

隐私政策Risk Disclosure

版权 © 2019 OneStepRemoved.com, 公司. 版权所有.