Equity Curve - looks like my 1st trade is way after the start of my Date Range
Author: robert-9876
Creation Date: 10/15/2010 10:36 AM
profile picture

robert-9876

#1
Hi. On my Equity Curve, it looks like trades are starting later than I'd like.

So it seems like my Performance data will not include the full Date Range that I'm looking for, because the early dates will not include any trades.

Is there something I can do to fix this?

I'm using a simple Fast MA crosses Slow MA to enter and exit a Long-Only strategy.

I realize that the Moving Averages need time to fill (or stabilize for EMA). I use GetTradingLoopStartBar(x), where I've tried x = 1 up to x = 190. I have plenty of data before my Date Range of Interest.

But it seems like the Equity Curve, doesn't move, and there is still a "dead period" at the beginning of my Equit Curve. I can provide pictures if you would like. Any advice would be appreciated.

Best regards,
Robert
profile picture

Eugene

#2
This is not a problem, it's by design.

Scroll down to How to start Buy&Hold from a specific bar? and follow the path in the Wealth-Lab User Guide.
profile picture

robert-9876

#3
Eugene,
Thank you for the link. That explains it. (still looking through the Users Guide).

Do you have any idea what Wycan did?

where he states in his 2/5/2009 post,

" I've added my own datarange component which I include in all my scripts that keep the testing within the stated timeframe. "

profile picture

Cone

#4
Not sure, but a customer's suggestion about adding an option to start the Buy & Hold equity on the date of the first trade is in the works for 6.1 next year. It's not exactly "Lead Bars", but it's close without all complexity associated with it.
profile picture

robert-9876

#5
Hi, I've been away for a while, but getting back into WLP.

I'm wondering if this:
QUOTE:
... customer's suggestion about adding an option to start the Buy & Hold equity on the date of the first trade is in the works for 6.1 next year

was ever implemented.

I'm using 200 day SMAs & EMAs, and since there no trades taken in the first 200 days (during the MA seed time), it throws-off all of the performance metrics reported for the backtest.

Any advice or work arounds would be helpful, which would start the performance measurement (and the equity curve) after the 200 day seed time.

Best regards,
profile picture

Eugene

#6
Unfortunately, it was not implemented in 6.3.
profile picture

Cone

#7
Right, the plans on implementing that option changed - it's a good example for us not to talk about enhancements that we "think" will be implemented in the next build.

Work around:
It didn't occur to me until just now, but we could create a special Performance Visualizer for Portfolio Simulations that:
1. Started Buy & Hold metrics from the first trade date, and,
2. Calculated Portfolio metrics starting from that same date.

I would prefer to an option for this in the standard Performance visualizer, but if that's not going to happen, there's a potential solution.
profile picture

Eugene

#8
Good idea Robert. In the visualizer it basically takes changing the bar 0 to bar X, where X = the first trade's inception bar. Sounds like it has a chance to work out.
profile picture

robert-9876

#9
That would be excellent.

Do you think you guys (or some enterprising Community Visualizer person) will do this? Or should I (yikes!) start looking at API documentation, in hopes of writing this (these) myself?

Thanks for the good answers.
profile picture

robert-9876

#10
One more thought.

If you guys are going to do this work, then I think it would be best to allow a user defined "Time Offset" to start Performance Calculations, rather than using the first trade date to start. Since, if I use a 200 day SMA, I just need the offset to be 200 days, but I might not get an Alert (buy/short signal) on Day 200, but I'd still like the Performance Calculations to begin on day 200, not necessarily on the first trade date, which might be way later than 200 days.

Best regards
profile picture

Eugene

#11
It would be optimal (and no impact on other code) if the standard Performance tab included that option to start B&H from the first trade date. Robert, are you considering to file a formal request first?
profile picture

Cone

#12
It's already out there, but 6.4 will be primarily another maintenance release anyway (unless we get some "other" project integration added). I think it's "safe" for you to take this bull by the horns :)
profile picture

Eugene

#13
Another maintenance release sounds good... if only that would allow Fidelity to materialize one of the most demanded items -- switching to .NET 4.0.
profile picture

Eugene

#14
The more I think of it, the more complex the task seems. And of course it's not nearly the matter of only "changing the bar 0 to bar X, where X = the first trade's inception bar". Various other concerns aside, at the very least it would take some rebuilding the SystemPerformance with associated SystemResults objects passed to the visualizer by Wealth-Lab. Simply put, we need the visualizer to calculate a brand new Buy&Hold Equity/CashCurve and other metrics.
profile picture

robert-9876

#15
Hi Eugene,
Yes, it looks like you have a good grasp of the "problem" (or feature :-). It's not just the equity curve, it's also all of the SystemPerformance results. That's why it would be a pain if I had to re-calculate all of the SystemPerformance results by hand, to remove the unwanted indicator_stabilization_time. This would be a tedious (error prone) job, best left to a computer.

Thanks very much for giving this more thought.
Best regards, Robert
profile picture

Cone

#16
The devil is always in the details and Eugene is the expert (that's not to say that Eugene is a devil - quite the opposite!) but only a few of the metrics have to be recalculated for the Portfolio performance: Exposure, Annualized Gain %, and Sharpe Ratio. None of the others in the main performance visualizer are affected by the starting date.
profile picture

Eugene

#17
Hi Robert,

The idea is that Wealth-Lab passes a SystemPerformance object to a performance visualizer, this collection includes four SystemResults objects containing the performance of L+S, Long, Short, and B&H. Wealth-Lab builds those result sets, our visualizers "massage" this data according to the various formulas like Sharpe Ratio. It's not a problem to recalculate any performance metric - there's an "engine" delivering them to visualizers and scorecards, but you must pass a SystemPerformance object. The key (and robert-9876 just confirmed) is that we need to rebuild that object, and I'm not exactly sure in detail what has to be done.
profile picture

Eugene

#18
Deferred. :(
profile picture

robert-9876

#19
Hi Eugene, Thanks for letting me know. I will investigate my plan B. (ie writing my own custom visualizer (yikes)). I'll also stay-tuned, in case something unexpected presents itself. Best regards.
profile picture

Eugene

#20
Looks like that in a future version (not 2012.07) of MS123 Visualizers, I'm going to eliminate the "flat line" (or at least make that optional) i.e. the equity curve will start from the date of the first trade rather than the first bar.

Note: the aforementioned does not apply to the built-in visualizers; only to our MS123 Visualizers library.
profile picture

Eugene

#21
QUOTE:
Looks like that in a future version (not 2012.07) of MS123 Visualizers, I'm going to eliminate the "flat line" (or at least make that optional) i.e. the equity curve will start from the date of the first trade rather than the first bar.


The flat line has been eliminated:

NEW MS123 Performance Visualizers and MS123 Scorecard
profile picture

robert-9876

#22
Hi Eugene, I've been distracted with other things lately, but this is great news (for me any way). I'll chck it out. Thank you very much for this.
profile picture

hankt

#23
The results in the post run analytics windows are just wrong minded.

One is interested primarily in strategy performance, secondarily in performance to a benchmark. Thus the "By Period" results are wrong on every strategy analysis that requires a lookback.

For instance, a highly profitable strategy that has a moving average period of 100 days will show at least that many consecutive days of profitability if someone has coded their GetTradingLoopStartBar.

I am certain that this error in logic extends to ratio calculations as well. None of the ratios under the performance (or performance+) tab are correct although all of them are described as being defined correctly.

This logic fault must have been created on a Monday when everyone was too hungover to think clearly.
profile picture

Eugene

#24
There is no error and nothing is wrong. Everyone can have their point of view. The design decision was to eliminate the source of various bugs associated with the legacy Lead Bars option, and, provide a more realistic - or even pessimistic - outlook by including the seed bars into the equity curve. What's important, however, is that discussing it is akin to beating a dead horse: nothing will change.
profile picture

hankt

#25
OUCH..

My statement was hardly an opinion; it is a plain fact that if one was doing backtesting, return analysis and benchmarking by hand none of us would chose to include out of trade sampled benchmark data in the results.

Why not just require the bars statement and drive everything from there!?

Failure to change and/or admit where things need to be corrected (not YOU Eugene) sound like a plan for failure.
profile picture

Eugene

#26
Hank,

As Cone said in post 16, it affects a handful of standard performance metrics like Exposure, Annualized Gain (pct), and Sharpe Ratio and probably the by-period figures.

Since the design is not to change, motivated users are welcome to develop a solution. There's no laid plan, but for hints on what effort it may take you can look in my post 14 (and related posts above). I admit it's nowhere near a simple task, but a theoretical possibility is still there.
profile picture

jjkottke

#27
Has there been any progress in adjusting the start date for the BUY & HOLD equity curve?
I have the same concern and it is now AUG 1 2015.

Also, when using a dual moving average strategy, is it possible to initiate a trade if the fast MA is above the Slow MA for the first trade only? The balance of the trades are, of course, controlled by cross-over's.

Thanks Jim K
profile picture

Eugene

#28
As stated before, the design is not to change. However, newer GetAllDataForSymbol method in Community Components is the solution. Using this technique, you can create indicators that are valid from bar 0, and therefore can start the trading loop at bar 1.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).