› Forums › Development › Perfect Entry or "Perfect Trader"?
- This topic has 74 replies, 11 voices, and was last updated 11 years, 4 months ago by
simplex.
- AuthorPosts
- March 28, 2015 at 12:46 pm #6040
Hi Brother GG53,
I already answered your PM, in case there’s trouble with the file download from PM, (since I experienced that previously) I also post the mq4 file here..
also the screenshot example
GBPUSD H1, Using daily (1440)/default with GMT 0 server

GBPUSD H1, Using Daily/default with GMT 0 server, and London Open Price (8 am).

Hope it help and best regards
MTH
Attachments:
You must be logged in to view attached files.Intuition, Experiences and Common sense..
http://www.binaryoptionsedge.com/March 28, 2015 at 1:21 pm #6042Using %Balance or %Equity is too simplistic and reduces your earning potential. My favorites are the trade-size techniques introduced by the “Kelly Criterion” (either half or full Kelly) or the “Fixed Ratio concepts” by Ryan Jones (Google it and watch the results).
Actually I came across the Kelly Criterion earlier, but put it aside then thinking a simpler approach would make more sense. Your post made me google again and reconsider my former decision. Those concepts seem to make perfect sense.
I didn’t dig in deeper yet, so I can’t say whether Kelly or Jones seems more reasonable to me. I must admit that Jones’ Fixed Ratio is completely new to me. Especially under the guidance of a trader who has gained practical experience with those methods it would be extremely interesting and certainly rewarding to code an automatization based in an EA.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
March 28, 2015 at 1:54 pm #6045Using %Balance or %Equity is too simplistic and reduces your earning potential. My favorites are the trade-size techniques introduced by the “Kelly Criterion” (either half or full Kelly) or the “Fixed Ratio concepts” by Ryan Jones (Google it and watch the results).
Actually I came across the Kelly Criterion earlier, but put it aside then thinking a simpler approach would make more sense. Your post made me google again and reconsider my former decision. Those concepts seem to make perfect sense. I didn’t dig in deeper yet, so I can’t say whether Kelly or Jones seems more reasonable to me. I must admit that Jones’ Fixed Ratio is completely new to me. Especially under the guidance of a trader who has gained practical experience with those methods it would be extremely interesting and certainly rewarding to code an automatization based in an EA.
Academic research suggest that Kelly is slightly more profitable while “Fixed Ratio” is better in handling DD.
I haven’t seen real traders long term results on this.
G.
March 28, 2015 at 2:59 pm #6046I’m confused… If the entry was based on higher TF – than looking at a higher TF is no change in “tactics”. Same goes for MM & Risk. But you suggested, or my understanding was, to CHANGE the initial entry logic to another logic, while in the tade- and my response was based on this “tactic”. G.
Yes I see you confused. I didn’t mean to give a system of any sort just an hint of another way to manage a losing trade using the fact that the market is fractal-like. Let me try with a (admittedly cherry picked) example.
Attachments:
You must be logged in to view attached files.March 29, 2015 at 10:47 pm #6055Another post on our topic I just came across:
There are other systems to calculate position sizing, but most of them share a common problem: they were originally developed for gambling, not for trading, like the Kelly Formula. In gambling, you can calculate with mathematical certainty the odds of winning, but that’s not possible in trading, no matter how well you have tested you systems, so those formulas should not be used for trading. Not only do they make you take excessive risks, they also do not take into consideration the volatility, so that’s why I created my own formulas.
A conclusion that’s at least worth taking it into account, IMO.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
March 29, 2015 at 10:48 pm #6056…
-
This reply was modified 11 years, 4 months ago by
simplex. Reason: DELETED: duplicate post!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
March 30, 2015 at 7:47 am #6058My personal “strategy” for exit a trade with “no reason”: If the trade is not in profit after 4 bars – I exit the trade. Reason: My entry signal was probably false, …
This is a very nice piece of know-how. Thanks. I’ll personally implement such a criteria for my trading…

Nothing has ever motivated me more than this...
March 31, 2015 at 7:44 am #6075On position sizing: The main target of money management is on how to MAXIMIZE the geometric return in our account. Using %Balance or %Equity is too simplistic and reduces your earning potential. My favorites are the trade-size techniques introduced by the “Kelly Criterion” (either half or full Kelly) or the “Fixed Ratio concepts” by Ryan Jones (Google it and watch the results). It requires logging of previous trades results and calculating positions based on it – but it worth the extra one-time effort to program it into the “PT” EA. G.
When you describe “MAXIMIZE geometric return” it sounds like you’re referring to Kelly. Are you using discrete or continuous Kelly for your calculations?
The only other way that I know of to maximize return in some optimal sense is by using Markowitz. But Markowitz generally is thought of more in relation to a portfolio than to a single strategy. The two ideas are related in that Kelly converges to a single point on the efficient frontier, but Kelly is perhaps easier to calculate / implement.
Kelly is interesting in that it is a bet sizing algorithm that also implies “add to winners” and “cut your losses short” in some gradual sense. Kelly can be thought of as being in the class of % of equity methods, but with Kelly the leverage multiple used can change depending on the strategy’s statistics over time, so it is adaptive.
March 31, 2015 at 4:25 pm #6088Academic research suggest that Kelly is slightly more profitable while “Fixed Ratio” is better in handling DD.
Can you provide links to such research results? Would be interested in some background info before coding.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
March 31, 2015 at 5:15 pm #6089Hi Brother GG53, I already answered your PM, in case there’s trouble with the file download from PM, (since I experienced that previously) I also post the mq4 file here.. also the screenshot example GBPUSD H1, Using daily (1440)/default with GMT 0 server GBPUSD H1, Using Daily/default with GMT 0 server, and London Open Price (8 am). Hope it help and best regards MTH
Hi MTH
I think this is the simplest and powerful indicator I’ve ever seen, thanks.I want to report a couple of bugs that I found:
1) levels are drawn only after 1 hour from the server reset time (00:00), so it starts to plot levels at 01:00 time , before 01:00, for 1 hour, there is nothing on the chart
2) the gmt offset only works for integer (no half hour or i.e. 09:44) time and more important, only positive values. If I put -1 nothing happens and I need this to align levels calculation to NewYork close time (17 EST)… (stupid broker with Sunday candle).I tried to change it but I’m not a good coder, I realized that the point 1) is related to Hour() function and using Minute() it works .. but not completely ..
So .. , when possible, can you make the changes ?
And possibly post again the indicator in mq4 format so I can learn a few tricks …Thank you
March 31, 2015 at 5:46 pm #6091Another post on our topic I just came across:
There are other systems to calculate position sizing, but most of them share a common problem: they were originally developed for gambling, not for trading, like the Kelly Formula. In gambling, you can calculate with mathematical certainty the odds of winning, but that’s not possible in trading, no matter how well you have tested you systems, so those formulas should not be used for trading. Not only do they make you take excessive risks, they also do not take into consideration the volatility, so that’s why I created my own formulas.
(see: https://www.dukascopy.com/fxcomm/fx-article-contest/?How-To-Calculate-Position-Sizing&action=read&id=1070 ) A conclusion that’s at least worth taking it into account, IMO.
That’s why I mentioned logging trade results and using Kelly based on your trade log.
The difference in performance, in my case and experience, is HUGE.
G.
March 31, 2015 at 5:51 pm #6093On position sizing: The main target of money management is on how to MAXIMIZE the geometric return in our account. Using %Balance or %Equity is too simplistic and reduces your earning potential. My favorites are the trade-size techniques introduced by the “Kelly Criterion” (either half or full Kelly) or the “Fixed Ratio concepts” by Ryan Jones (Google it and watch the results). It requires logging of previous trades results and calculating positions based on it – but it worth the extra one-time effort to program it into the “PT” EA. G.
When you describe “MAXIMIZE geometric return” it sounds like you’re referring to Kelly. Are you using discrete or continuous Kelly for your calculations? The only other way that I know of to maximize return in some optimal sense is by using Markowitz. But Markowitz generally is thought of more in relation to a portfolio than to a single strategy. The two ideas are related in that Kelly converges to a single point on the efficient frontier, but Kelly is perhaps easier to calculate / implement. Kelly is interesting in that it is a bet sizing algorithm that also implies “add to winners” and “cut your losses short” in some gradual sense. Kelly can be thought of as being in the class of % of equity methods, but with Kelly the leverage multiple used can change depending on the strategy’s statistics over time, so it is adaptive.
Recently I’m using Half Kelly – since my trades are usually don’t suffer from large DD.
G.
March 31, 2015 at 5:52 pm #6094Academic research suggest that Kelly is slightly more profitable while “Fixed Ratio” is better in handling DD.
Can you provide links to such research results? Would be interested in some background info before coding.
I have to deeply dig… but I’ll find it.
G.
April 1, 2015 at 2:07 am #6101Academic research suggest that Kelly is slightly more profitable while “Fixed Ratio” is better in handling DD.
Can you provide links to such research results? Would be interested in some background info before coding.
You might try out a simple program posted on FF a while back called, “Mr Kelly” on FF as a means of doing some simple simulations to get a feel for how it places its bets according to account size and payout. I believe this simulation uses discrete Kelly.
April 1, 2015 at 3:10 am #6105Recently I’m using Half Kelly – since my trades are usually don’t suffer from large DD.
Hi gg53,
Half Kelly is prudent as you reduce your variance of returns by 1/2 but your expected long-term growth rate is reduced by only by 1/4, so a good trade-off. Half Kelly is also prudent because by underestimating the maximum size that should be traded you protect yourself against an overly optimistic estimate of future system returns that are built into your initial backtesting by way of overfitting. And because estimating future returns is risky business.
It seemed like you missed the point of my question regarding continuous vs discrete Kelly, so let me explain in more detail. Basically there are at least 2 different classes of equations for Kelly: discrete and continuous, and they have different uses. The discrete version was developed for gambling and consists of an outcome where the profit and loss are fixed. The discrete version of Kelly is only really applicable to cases where a trader has a system with an entry and always sets the same take profit and stop loss each time and never exits otherwise – in other words there are only 2 discrete outcomes. For instance if you always set a 100 pip stop loss and a 200 pip take profit, and never exit a position unless one or the other is hit, then discrete Kelly would apply. In most cases this is what is used by traders, but most traders’ systems don’t work this way. If you look at the Wikipedia page, it covers the discrete formula and later on goes into a long-only version of the continuous formula which is also not applicable for trading forex where strategies go both long and short, and the formula in Wikipedia also happens to be more complex. On Investopedia you only get the discrete formula.
On FF the only threads and posts that I’ve seen concerning continuous Kelly have been made by me. In other words, the use of discrete Kelly by retail traders is ubiquitous even though it is mis-applied in nearly every case.
The continuous formula for Kelly is applicable to trading applications where the outcomes (profit/loss) are variable, as most trading systems are. The formula for the optimal amount to bet with continuous Kelly is fairly straightforward:
f* = (m-r)/(s^2) where:
f* is the optimal leverage to use aka the multiple of your equity to bet. In simple terms, if your account is worth $1000, and f* is 25, you should trade sizes of 25,000 at full Kelly or 12500 at half Kelly.
m is Greek mu or the average return
r is the risk free rate of return
s is Greek sigma squared or the variance of returns.
If you assume a zero risk free rate of return, then the formula comes out simply as: f* = m/(s^2)
Betting anything more than f* is crazy as it leads to a reduction in overall long-term growth rate with increased variance and at some point negative growth rate.
As I’m one of the few voices promoting continuous Kelly among retail traders, some might question whether I’m correct. Here are some other reputable sources (Ernie Chan has several interesting articles on Kelly on his blog in addition to the one listed below):
http://epchan.blogspot.com/2006/10/how-much-leverage-should-you-use.html (you can also read the original Thorp paper, citation at the bottom of this blog post, the continuous Kelly formula listed above in Thorp’s paper is on page 23, line 26)
Paul Wilmott on Quantitative Finance Vol 1-3 2nd Edition, Chapter 17, “Investment lessons from blackjack and gambling” [This is a really enlightening chapter]
“Betting with the Kelly Criterion” by Jane Hung (attached) [see the formula just before section 4 on page 5. This article is a must-read if you are interested in practical applications of Kelly to an actual single investment]
One thing to note is that if you use full Kelly, you have a 50% chance of a 50% drawdown and a 1% chance of a 99% drawdown.
Attachments:
You must be logged in to view attached files.April 1, 2015 at 10:32 am #6111That’s why I mentioned logging trade results and using Kelly based on your trade log.
So logging would be done in order to calculate the win probability and R : R in the trade history?
-
This reply was modified 11 years, 4 months ago by
simplex. Reason: R:R added
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
April 1, 2015 at 10:45 am #6112You might try out a simple program posted on FF a while back called, “Mr Kelly”
Nice link and nice little program! Definitely Kelly should be considered an interesting approach for MM.

A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
April 1, 2015 at 12:09 pm #6115Academic research suggest that Kelly is slightly more profitable while “Fixed Ratio” is better in handling DD.
Can you provide links to such research results? Would be interested in some background info before coding.
You might try out a simple program posted on FF a while back called, “Mr Kelly” on FF as a means of doing some simple simulations to get a feel for how it places its bets according to account size and payout. I believe this simulation uses discrete Kelly. http://www.ff.com/showthread.php?t=185228
I’m familiar with that thread, but I’m using Half Kelly with trding log right now. I’m happy with the results compared to fixed lot sizing and %balance/equity sizing.
G.
April 1, 2015 at 12:18 pm #6116you can also read the original Thorp paper, citation at the bottom of this blog post, the continuous Kelly formula listed above in Thorp’s paper is on page 23, line 26
The link to Thorp’s paper as provided on the referenced page appears to be dead, but this one should do:
http://www.eecs.harvard.edu/cs286r/courses/fall12/papers/Thorpe_KellyCriterion2007.pdf
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
April 1, 2015 at 12:23 pm #6117That’s why I mentioned logging trade results and using Kelly based on your trade log.
So logging would be done in order to calculate the win probability in the trade history?
Yep.
FXEZ: Profit & Loss are not fixed in my trading style.
I start with SL and no fixed TP, and try to minimize risk by trailing Stop (and hopefully BE). Profit is trailed after BE in dynamic decreasing steps – change in conditions will trigger immediate TP.
G.
April 1, 2015 at 12:43 pm #6118Ok. So let me post some conceptual thoughts as a coder.
Which input parameters do we need when coding a Kelly algorithm?
- minimum count of trades required to ensure statistical validity of our trade history
- maximum count of trades used
- kelly output coefficient (for half Kelly etc.)
- setting which lot size calculation to use while minimum count is not fulfilled
So R:R, win expectation, and Kelly lot size are calculated based on the latest trades that fulfil above constraints.
Some global EA settings might overrule Kelly output (minimum or maximum lot size).
Assuming we’re trading multiple pairs, do we calculate separate Kelly outputs per pair or one for all pairs?
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
April 1, 2015 at 12:47 pm #6119Recently I’m using Half Kelly – since my trades are usually don’t suffer from large DD.
Hi gg53, Half Kelly is prudent as you reduce your variance of returns by 1/2 but your expected long-term growth rate is reduced by only by 1/4, so a good trade-off. Half Kelly is also prudent because by underestimating the maximum size that should be traded you protect yourself against an overly optimistic estimate of future system returns that are built into your initial backtesting by way of overfitting. And because estimating future returns is risky business. It seemed like you missed the point of my question regarding continuous vs discrete Kelly, so let me explain in more detail. Basically there are at least 2 different classes of equations for Kelly: discrete and continuous, and they have different uses. The discrete version was developed for gambling and consists of an outcome where the profit and loss are fixed. The discrete version of Kelly is only really applicable to cases where a trader has a system with an entry and always sets the same take profit and stop loss each time and never exits otherwise – in other words there are only 2 discrete outcomes. For instance if you always set a 100 pip stop loss and a 200 pip take profit, and never exit a position unless one or the other is hit, then discrete Kelly would apply. In most cases this is what is used by traders, but most traders’ systems don’t work this way. If you look at the Wikipedia page, it covers the discrete formula and later on goes into a long-only version of the continuous formula which is also not applicable for trading forex where strategies go both long and short, and the formula in Wikipedia also happens to be more complex. On Investopedia you only get the discrete formula. On FF the only threads and posts that I’ve seen concerning continuous Kelly have been made by me. In other words, the use of discrete Kelly by retail traders is ubiquitous even though it is mis-applied in nearly every case. The continuous formula for Kelly is applicable to trading applications where the outcomes (profit/loss) are variable, as most trading systems are. The formula for the optimal amount to bet with continuous Kelly is fairly straightforward: f* = (m-r)/(s^2) where: f* is the optimal leverage to use aka the multiple of your equity to bet. In simple terms, if your account is worth $1000, and f* is 25, you should trade sizes of 25,000 at full Kelly or 12500 at half Kelly. m is Greek mu or the average return r is the risk free rate of return s is Greek sigma squared or the variance of returns. If you assume a zero risk free rate of return, then the formula comes out simply as: f* = m/(s^2) Betting anything more than f* is crazy as it leads to a reduction in overall long-term growth rate with increased variance and at some point negative growth rate. As I’m one of the few voices promoting continuous Kelly among retail traders, some might question whether I’m correct. Here are some other reputable sources (Ernie Chan has several interesting articles on Kelly on his blog in addition to the one listed below): http://epchan.blogspot.com/2006/10/how-much-leverage-should-you-use.html (you can also read the original Thorp paper, citation at the bottom of this blog post, the continuous Kelly formula listed above in Thorp’s paper is on page 23, line 26) Paul Wilmott on Quantitative Finance Vol 1-3 2nd Edition, Chapter 17, “Investment lessons from blackjack and gambling” [This is a really enlightening chapter] “Betting with the Kelly Criterion” by Jane Hung (attached) [see the formula just before section 4 on page 5. This article is a must-read if you are interested in practical applications of Kelly to an actual single investment] One thing to note is that if you use full Kelly, you have a 50% chance of a 50% drawdown and a 1% chance of a 99% drawdown.
The simplified formula version I’m using is:
Kelly % = W – [(1 – W) / R](I’m using Half Kelly)
W = % of winning trades
R = ratio of avg gain of winning trades relative to the avg loss of losing trades.That’s why logging of each trade result is required – and recalculate the Half Kelly% for each new open trade.
Initial and first log entry results are coming from backtest.
G.April 1, 2015 at 1:11 pm #6120The simplified formula version I’m using is: Kelly % = W – [(1 – W) / R] (I’m using Half Kelly) W = % of winning trades R = ratio of avg gain of winning trades relative to the avg loss of losing trades. That’s why logging of each trade result is required – and recalculate the Half Kelly% for each new open trade. Initial and first log entry results are coming from backtest.
Yes that’s the simplified version of the discrete Kelly formula. It assumes you have only two discrete outcomes. See the Thorp paper for more details on this. Try comparing the resulting f* in the formula above to the f* calculation for continuous Kelly.
April 1, 2015 at 1:15 pm #6121Which input parameters do we need when coding a Kelly algorithm?
Hi simplex,
For the discrete formula, see the variables provided by gg53 two posts up.
For the continuous formula, you need an equity curve. Convert it to returns by taking the difference between each period. Compute the average return. Compute the variance of the returns. Apply the formula f* = average(returns)/variance(returns). To get half kelly, divide f* by 2.
April 1, 2015 at 2:07 pm #6123For the continuous formula, you need an equity curve.
Yes, I see. Can’t dig in deeper now, going to be offline for several hours. Came across the following post, which might be helpful. Just taking a quick note here:
https://www.mql5.com/en/code/8454
CU, guys!
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
-
This reply was modified 11 years, 4 months ago by
- AuthorPosts
- You must be logged in to reply to this topic.

