Calculating weekly indicators

Questions and discussion of Trading Blox and other platforms for non Trading Blox customers. Trading Blox customers should use the Trading Blox Support forum.
Post Reply
mlvn23
Full Member
Full Member
Posts: 19
Joined: Mon Jan 25, 2010 1:19 am
Location: Fremont, CA

Calculating weekly indicators

Post by mlvn23 » Wed May 12, 2010 4:02 pm

Hi,

I'm test driving TradingBlox by implementing one of the systems that I follow. I mainly trade in weekly time frame, but it seems like some indicators are not implemented as functions (ADX and ATR), so if I want a weekly version of it, then I need to implement my own? Or maybe load weekly prices instead of daily (that would be inconvenient)?

Thanks,

mlvn23

Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 1946
Joined: Wed Oct 06, 2004 10:52 am
Location: San Jose, CA

Post by Roger Rines » Wed May 12, 2010 4:49 pm

When using Weekly data Trading Blox's built-in indicators will provide the ATR and ADX without much more than addition of the length variable and an indicator name.

Weekly data is an approach used often when the entry and exit decisions are only made on the first and or last bar of each week. If you are using weekly data as the basis of your system control calculations, but are using daily data to enter and exit the market as the data appears each trade day, then you'll need to use daily data, and then apply your system control calculations to the weekly data Trading Blox creates when that preference option is enabled.

To work with weekly data when loading daily data, the built-in indicators won't be helpful if you need them to only use weekly data. In this later case, you'll need to use code that only works with weekly data. To understand how that might be done, consider this module in the Blox Marketplace: Weekly Bar Average True Range Calculation

Creating the ADX won't be much of an effort if you use the above module as a skeleton process that you mold into handling the DX+ & DX- calculations, and then the combining and averaging the ADX requires.

Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 1946
Joined: Wed Oct 06, 2004 10:52 am
Location: San Jose, CA

Post by Roger Rines » Wed May 12, 2010 4:58 pm

I didn't notice the forum you posted when I provided the link.

The above link won't work unless you are a TB customer. With that in mind, maybe getting a peek at the image that is shown in the posting might be helpful to give you confidence the effort isn't hard:
Image
Image above shows the Weekly ATR values of the daily 10-Year Notes for the period displayed.

mlvn23
Full Member
Full Member
Posts: 19
Joined: Mon Jan 25, 2010 1:19 am
Location: Fremont, CA

Post by mlvn23 » Thu May 13, 2010 4:04 pm

Thanks for the tip, Roger. I went with the weekly data route and I got it to work last night.

Trentham
Full Member
Full Member
Posts: 16
Joined: Sun Jan 18, 2009 1:56 am

Post by Trentham » Tue Jun 01, 2010 7:31 am

Hi Roger,

Many thanks for this generous contribution. Given my stock data vendor does not provide weekly data it will allow me to test and investigate weekly strategies that I otherwise would not be able to do.

I am however having a small problem in implementing the block in that I get the following error message. I can confirm that I have Process Weekly Bars checked but my problem seems to be at least somewhat related to the Years of Priming Data value located in Preferences. Regardless of the input value (in this case 5 years) I get the message that the week index for weekHigh is one greater than the maximum allowed (again, in this case it is 262 vs 261).

I understand that instrument priming requires the maximum bars required for indicators plus one, plus the maximum lookback parameter plus one so is there something I'm missing in relation to how this weekly ATR indicator is being primed? To give you some idea I have approx. 16 yrs of data available before this test's start date of 1 January 2008.

Please let me know if you need any further information and any assistance you can provide is much appreciated.

EDIT - made image narrower - Moderator
Attachments
narrower.gif
narrower.gif (25.3 KiB) Viewed 4084 times
Weekly ATR_2_20100601.gif
Weekly ATR_2_20100601.gif (4.46 KiB) Viewed 4092 times

Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 1946
Joined: Wed Oct 06, 2004 10:52 am
Location: San Jose, CA

Post by Roger Rines » Tue Jun 01, 2010 11:53 am

Hello Trentham,

Thanks for the nice words, and I'm sorry I didn't remember to update the blox when I made the change to my local version of the _Weekly_AvgTrueRange indicator.

CHANGE NEEDED:
Line # 57 needs to have 2 instead of a 1 to prevent the out-of-bounds array error that is happening with the recent versions of Trading Blox.

That change is now described in the original blox posting, and a new version of the blox was upload and is now available here: TB_Weekly_ATR_Edits_20100601.gif

Trentham
Full Member
Full Member
Posts: 16
Joined: Sun Jan 18, 2009 1:56 am

Post by Trentham » Thu Jun 03, 2010 2:59 am

Roger, your change has got it working. Thanks again.

Post Reply