Moving forward if people are interested, I'll post the results of this system whilst I'm still trading it. I'll also show, if / when I stop.
Hi all,
For those that were interested in the discussion about short term trading strategies, holding for only a couple of days etc.
I thought I'd just post an update on the (basic) RSI system that I currently trade on MSFT, its the same one I used in the example.
*** The biggest drawdown is always just around the proverbial corner *** but this last month has finally seen new equity highs in the sytem.
Moving forward if people are interested, I'll post the results of this system whilst I'm still trading it. I'll also show, if / when I stop.
Cheers
View attachment 145347
Hi Entropy, just thought I'd pick up on something here that some may not be aware of with Amibroker.Willzy, An excellent effort!
I'm interested in any updates and any further info on your methods.
Trading a single major equity like MSFT with such nice results, for me this is remarkable and motivates a little trading guy like me to keep going.
Clearly you have found an inefficiency in the market to confound the EMH theorists!
You have avg profit per trade of $3612, avg loss -$4509 but the secret of you success seems to be the superb 79% win strike rate you achieve without a scary drawdown.
Sorry forgot to put a thanks at the front of that…Willzy, An excellent effort!
I'm interested in any updates and any further info on your methods.
Trading a single major equity like MSFT with such nice results, for me this is remarkable and motivates a little trading guy like me to keep going.
Clearly you have found an inefficiency in the market to confound the EMH theorists!
You have avg profit per trade of $3612, avg loss -$4509 but the secret of you success seems to be the superb 79% win strike rate you achieve without a scary drawdown.
Absolutely nothing wrong with using compounding for Amibroker backtesting as long as you understand what you are looking at. I've been trying to get this across a few times. @Willzy You obviously don't need to be advised by me however. Excellent post.Hi Entropy, just thought I'd pick up on something here that some may not be aware of with Amibroker.
This particular backtest invests all available funds on every trade, thus we see the compounding effect and in order to get a decent view I've used a logarithmic equity plot.
So when you've noticed the avg profit per trade of 3612, and loss of 4589 these figures are distorted by the compounding.
However the average percentage profit and average percentage loss is not.
Thus this backtest shows an accuracy of 78.99% and an average pct win of 1.71% , avg pct loss 1.87%
Amibroker shows a payoff ratio of 3612 / 4589 ==> 0.79
Correct payoff ratio (if all trades were same value ie $100,000) = 1.71 / 1.87 ==> 0.914
This is a subtle difference and for most applications is not that important, however in some instances such as ranking one system against another it can cause issues.
---- here is an example where it can cause problems ---
One of my favorite system metrics is from one of Kevin Davey's books. Its a derivation of expectancy...
Most would know the basic formula for expectancy E = probabilityWin * avgWin - (probabilityLoss) * avgLoss
Now this returns Expecatancy as ( $$$ ) if avgWin is in ( $$$ ) or (percentage) if avgWin is entered as a percentage so its not a unit-less metric.
But if we divide across both sides by avgLoss the formula becomes:
E / avgLoss = Accuracy * avgWin / avgLoss - (1-Accuracy) or
E / avgLoss = Accuracy * payoffRato + Accuracy - 1
Because we are now dividing avgWin by avgLoss our units of measurement be it dollars or pct are cancelled out and we have a unitless measurement.
Kevin has a name for it I cant remember off hand but lets call it normalized expectancy... "e"
e = Accuracy * payoffRato + Accuracy - 1
now if we use Amibrokers original metric of payoffRatio (0.79) then my metric
e = 0.789*0.79 + 0.789 - 1 == 0.412
but it should be
e = 0.789 *0.914 + 0.789 - 1 == 0.510
now if during an optimization we had two systems say one buys when RSI < 20 and another that buys RSI <10 if we dont remove the bias due to compounding from the backtests then our walkForward may select the wrong one...
--- Sorry that turned into a rather long example, hope its not too confusing, please ask if anyone wants more clarification ---
Hi Entropy, just thought I'd pick up on something here that some may not be aware of with Amibroker.
This particular backtest invests all available funds on every trade, thus we see the compounding effect and in order to get a decent view I've used a logarithmic equity plot.
So when you've noticed the avg profit per trade of 3612, and loss of 4589 these figures are distorted by the compounding.
However the average percentage profit and average percentage loss is not.
Thus this backtest shows an accuracy of 78.99% and an average pct win of 1.71% , avg pct loss 1.87%
Amibroker shows a payoff ratio of 3612 / 4589 ==> 0.79
Correct payoff ratio (if all trades were same value ie $100,000) = 1.71 / 1.87 ==> 0.914
This is a subtle difference and for most applications is not that important, however in some instances such as ranking one system against another it can cause issues.
---- here is an example where it can cause problems ---
One of my favorite system metrics is from one of Kevin Davey's books. Its a derivation of expectancy...
Most would know the basic formula for expectancy E = probabilityWin * avgWin - (probabilityLoss) * avgLoss
Now this returns Expecatancy as ( $$$ ) if avgWin is in ( $$$ ) or (percentage) if avgWin is entered as a percentage so its not a unit-less metric.
But if we divide across both sides by avgLoss the formula becomes:
E / avgLoss = Accuracy * avgWin / avgLoss - (1-Accuracy) or
E / avgLoss = Accuracy * payoffRato + Accuracy - 1
Because we are now dividing avgWin by avgLoss our units of measurement be it dollars or pct are cancelled out and we have a unitless measurement.
Kevin has a name for it I cant remember off hand but lets call it normalized expectancy... "e"
e = Accuracy * payoffRato + Accuracy - 1
now if we use Amibrokers original metric of payoffRatio (0.79) then my metric
e = 0.789*0.79 + 0.789 - 1 == 0.412
but it should be
e = 0.789 *0.914 + 0.789 - 1 == 0.510
now if during an optimization we had two systems say one buys when RSI < 20 and another that buys RSI <10 if we dont remove the bias due to compounding from the backtests then our walkForward may select the wrong one...
--- Sorry that turned into a rather long example, hope its not too confusing, please ask if anyone wants more clarification ---
Hi Marty,Thanks for sharing Willzy, very interesting. I notice no transaction costs - how does that impact the results?
cheers
Hi entropy,Willzy, many thanks for the detailed reply and explanation of your metric.
This gives me plenty to work through.
I have been working through Howard Bandy's book "Quantitative Technical Analysis" and I gather he had quite a lot to do with how Amibroker works under the hood.
My interest is to build a trading method with machine learning algorithms using Python guided by some of Dr Bandy's material.
A few hiccups to overcome due to changes within Python since the book was published in 2015.
There is an errata link at Blue Owl Press but my browser warns the link is unsafe and maybe has been hacked.
You wrote:
"now if during an optimization we had two systems say one buys when RSI < 20 and another that buys RSI <10 if we dont remove the bias due to compounding from the backtests then our walkForward may select the wrong one..."
This bit has me puzzled: do you mean that your method switches from one RSI indicator to a different RSI indicator due to some trigger in the market?
A guide to AddToComposite() with good examples can be found here Introduction to the AmiBroker AddToComposite()
[Links to PDF file size 122 kB]
Hi Skate and system traders
Apologies if this is bit off topic. In system tests using Norgate data has anyone had any success to their systems by adding the stocks' sector strength:
Buy= (my system buy rules) + (and the sector of the stock (GICS classification, real estate, technology etc etc) has ROC(c,10)>x, or above its 200 ema etc etc)
If so, how do you code it?
Thanks
Marty
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?