Home › Forums › Development › Perfect Entry or "Perfect Trader"?
 This topic has 74 replies, 11 voices, and was last updated 6 years, 3 months ago by simplex.

AuthorPosts

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/Using %Balance or %Equity is too simplistic and reduces your earning potential. My favorites are the tradesize 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
Using %Balance or %Equity is too simplistic and reduces your earning potential. My favorites are the tradesize 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.
I’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 fractallike. Let me try with a (admittedly cherry picked) example.
Attachments:
You must be logged in to view attached files.Another 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
…
 This reply was modified 6 years, 3 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
[ BalrogTrader ]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 knowhow. Thanks. I’ll personally implement such a criteria for my trading…
Nothing has ever motivated me more than this...
On 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 tradesize 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 onetime 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.
Academic 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
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
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
Another 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/fxarticlecontest/?HowToCalculatePositionSizing&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.
On 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 tradesize 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 onetime 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.
Academic 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.
Academic 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.
Recently 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 longterm growth rate is reduced by only by 1/4, so a good tradeoff. 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 longonly 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 misapplied 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* = (mr)/(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 longterm 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/howmuchleverageshouldyouuse.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 13 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 mustread 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.That’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 6 years, 3 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
You 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
Academic 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.
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
The link to Thorp’s paper as provided on the referenced page appears to be dead, but this one should do:
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top and bottomfishing to people on an ego trip. (Dr. Alexander Elder)
That’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.
Ok. 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)
Recently 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 longterm growth rate is reduced by only by 1/4, so a good tradeoff. 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 longonly 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 misapplied 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* = (mr)/(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 longterm 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/howmuchleverageshouldyouuse.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 13 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 mustread 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.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.
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.
Which 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.
For 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 bottomfishing to people on an ego trip. (Dr. Alexander Elder)

AuthorPosts
 You must be logged in to reply to this topic.