Final release on 'beta' for multi-country support and weekday functions

Dear All,

First of all, thank you for your patience. The release for multi-country support was not smooth. Some decisions had to be undone and new ones made. We apologize for this. Please refer to this previous post for some of the decisions

In short

The new release is on the https://beta.portfolio123.com website
[list=a]
[]It has new “Week Day” functions. For example Close_D, SMA_D, RSI_D, etc
[
]It has new weekly functions. For example SMA_W(10) is the average of the past 10 weekly prices (for close is the Friday close price).
[*]Existing TA functions operate on bars. (with few exceptions, see below)
[/list=a]
For users that want functions to operate on ‘bars’ (trading days)

You don’t need to do anything (almost). This is for users that want to design strategies in single country universes where all stocks in the universe stop trading on the same days. All technical functions operate on bars by default. So for example Close(10) is the close 10 trading days ago (typically 2 week span unless there was a holiday)

There’s only one case where you need to intervene: if you use sector and industry series. We chose to create industry and sector time series for the entire North America which meant that the time series had to be based on weekdays and include holidays.

This can cause problems in your strategy if, for example, you like looking for stocks that have outperformed the industry. For that filter to work the period has to be in the same units. You will need to rewrite your formulas using weekday functions. For example if you are looking for stocks that have outperformed the industry like this:

[font=courier new]Close(0)/Close(10) > Close(0,#industry)/Close(20,#industry)[/font]

You should rewrite it using weekday functions since the industry series includes holidays:

[font=courier new]Close_D(0)/Close_D(10) > Close_D(0,#industry)/Close_D(20,#industry)[/font]

New weekday and weekly functions

On the beta website you will have access to several new weekday functions (plus a bonus: weekly functions). You should use these functions if your universe is multi-country so everything lines up, and if you are using industry and sector series.

We have only implemented a subset of the functions at the moment. More are coming so let us know your priorities. For example here are the old and new Simple Moving Average functions:

SMA(bars [,offset,series]) : Simple moving average of a time series. Period is in ‘bars’ or ‘trading days ago’ (can vary depending on the series you choose).
SMA_D(days [,offset,series]) : Simple moving average of a time series. Period is in ‘days’ which include holidays.
SMA_W(weeks [,offset,series]) : Simple moving average of the weekly time series.

We plan to make this beta release in production sometime next week so we can move on to adding European data.

Let us know any questions

Thank You

List of new functions (more to come)
Close_D (days [,series])
Close_W (weeks [,series])
EMA_D (days [,offset,series])
EMA_W (weeks [,offset,series])
Hi_D (days [,series])
Hi_W (weeks [,series])
Low_D (days [,series])
Low_W (weeks [,series])
Open_D (days [,series])
Open_W (weeks [,series])
RSI_D (days [,offset,series])
SMA_D (days [,offset,series])
SMA_W (weeks [,offset,series])
WMA_D (days [,offset,series])

Thank you, Marco. Appreciate the detail.

Just to be clear… Sometime next week the existing production website will be replaced by the Beta website and the existing production website will no longer be available?

If that is so and a user wants to run single country USA including sector and industry series, could you comment please on which of the following generalized factors would be affected following the change and how these can be customized to perform as they previously did until it’s possible to get more experience with the new default sector and industry series?

FRank(“XXXXXX”,#sector)
FRank(“$MYFORMULA”,#sector)
FRank(“XXXXXXInd”)
XXXXXXXXXTTMInd

Thank you.

Hugh

"There’s only one case where you need to intervene: if you use sector and industry series. We chose to create industry and sector time series for the entire North America which meant that the time series had to be based on weekdays and include holidays.

This can cause problems in your strategy if, for example, you like looking for stocks that have outperformed the industry. For that filter to work the period has to be in the same units. You will need to rewrite your formulas using weekday functions"

Question on rewriting Industry Performance:

I am using Pr4W%ChgInd for example.
Do I have to rewrite it and if yes, how. Please give an example.

I can not test my strats yet “Server not loading” is the response.

Please consider to give 3 Weeks depending on what we see on the beta server, thank you!

Thank you!

You do not need to rewrite this. The Ind factors use the Aggregate function which use the stock’s Factor. For Pr4W%ChgInd it’s based on Pr4W%Chg which is based on bars . It does not use the time series for the industry.

PS. Unfortunately we’re stuck with the naming of existing factors. Pr4W%Chg uses 20 bars so with a holiday it’s a little longer than 4 weeks.

Thank you!

I’ve been testing the new functions and my old models, and so far everything looks fine. Do you have any estimate for when the European data will be available?

These should not be affected. Please see the original post. I added a specific example that illustrates where there could be issues.

This is great news, Marco! On the surface, it looks like an excellent solution to the holiday problem inherent to investing across countries.

For my own needs as a longer-term, ETF-based investor/advisor, weekly closing-price series with weekly measures is something I have wanted for the last 14-15 years. The Daily Close is the most accurate price each day, and Weekly Closing prices filter out the substantial noise that proliferates in daily price points—often driven by amateur investors reacting in a panic to their emotions. It’s for this reason many academics believed for decades that prices are “random.” They are not at all… if you use Weekly Closing Prices.

For the same reason, investors should never use intraday prices in stop-loss orders.

At the end of each week, a majority of professional investors close out positions to avoid headline risk over the weekend, and the Friday closing price is usually the most accurate reflection of a “fair value” you’ll see all week. Making weekly series available is a welcome addition to one of the most fully-featured investment sites today!

Thank you, Marco, for your answer to my query above. And thank you and the p123 team as well for your efforts minimize the transition-related consequences.

Hugh

Thanks for the update. I’m using the volume weighted moving average (the VMA function), could you also prioritize it for the new daily and weekly functions?

I’ve found a small problem: Using the spread function in a sim or the screener gives an “GetParName index out of bounds” error. (And the beta servers are down).

Yeah, looks like we had a crash. Thanks for reporting it.

Fixed the bug with Spread. Beta servers are back up. Thank You

I have two questions: In the original post, you mentioned that the Close_W(), Close_D(), etc. functions will be available in production next week. So far, I don’t see them there. Do you have an estimate for when they might be available? Secondly, once these functions are accessible in production, will they be available through the API, say in the addtionalData fields? Thanks!

We’re planning to release what’s on the beta site this week.

Yes, all functions are automatically available to the API. The API is just a wrapper that forwards the requests to the engine.

Thanks

Thank you, Marco!

Hi Marco

Great news, sounds like this is a very good solution!

  1. Are we getting notified if certain models or components are not working anymore (for example due to the #industry function)?
  2. Can we run a screen or can you produce lists of models/components that are affected?
  3. And if so, would you be able to overwrite the formulas in bulk?
  4. Ideally we would be able to do a side-by-side comparison (old vs new performance) for the affected strategies

@Marco or team

Can you please respond to my questions?

Nothing really breaks with the new release. The main difference that was introduced is that industry and sector time series are by region (North America at the moment) and include holidays.

So are your questions all related to that change?

There’s a potential for inconsistencies as mentioned in the post. Unfortunately it’s not simple for us to identify these inconsistencies automatically. A long time ago we made the unfortunate decision to use the same keyword for Scope parameter and Time Series Id for taxonomies, like #industry. This makes it very hard to find inconsistent uses of the time series.

As far as the side by side comparison… unfortunately that is no longer available now. We could put up the previous production engine for comparisons if there’s demand.

Thanks

Hi Marco,

Thank you - and thanks very much to Yuval too for his earlier reply on a different related thread.

Please correct me if I am wrong but don’t close(x) functions need to be changed to close_D(x) functions to continue working with bars instead of calendar days?

For example, if you want to buy stocks that are 10% lower than they were 10 bars ago, isn’t the new rule close_D(0)<.9close_D(10) whereas close(0)<.9close(10) would now count holidays?

If that is so, can you think of any other functions/factors that might also need to be revised apart from the ind and sector series issues already discussed?

Thanks.

Hugh

Hugh,

In your examples it’s backwards.

You don’t need to change anything to continue using bars. The only exception is if you are using the industry/sector time series. Please see the example in the first post when some changes are recommended. Most users should not need to do anything for single country systems.

“_D” is specifically for weekdays, so 5 price points every week
“_W” is specifically weekly, so 1 data point per calendar week

Sorry there was confusion at the beginning. When we first announced this we were going to do something different.

I’ll try to make it clearer in the docs