Creating a custom Breadth indicator and equity curve trading

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
droskill
Full Member
Full Member
Posts: 20
Joined: Wed Jun 07, 2006 4:54 pm
Location: Massachusetts

Creating a custom Breadth indicator and equity curve trading

Post by droskill »

Hey all,

Two new questions on Blox:

1. Was wondering if Trading Blox can support the creation of an instrument based on other instruments. So, say I want to create % of stocks above or below a 200d moving average. Can I create an instrument such as this?

2. Equity curve trading: simple question - can I program Blox systems to trade based on the equity curve of the system that is running? What if I have two systems running?

Thanks!
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

I would recommend creating a Block Permanent Variable of type "Series" to hold the % of instruments above the moving average. You can use it during the test to make trading decisions if you like. Then when the test is complete, you can write it to a file for use later, perhaps in subsequent runs. If you want to call this file "an instrument", I won't try to stop you. By the way, during debugging, look for days when some instruments are trading but others are not. Make sure your code gets the right answer on those days - it might take a few tries before you get your code to calculate properly on such days.

Using the equity curve to make trading decisions ("trading the equity curve") is similarly easy in Blox. Look in the Blox Builders Guide and read about the objects called test.totalEquity and system.totalEquity. They give you access to the data you need, in order to make trading decisions (position sizing decisions?) based on the equity curve, either of the ensemble of simultaneously systems taken as a whole (the "Suite"), or on the individual systems themselves.

Beware that in real life, you cannot use Tuesday's after-the-close, marked-to-market, total equity to make trading decisions during the day on Tuesday. And you can't do this in Blox either.
droskill
Full Member
Full Member
Posts: 20
Joined: Wed Jun 07, 2006 4:54 pm
Location: Massachusetts

Post by droskill »

Thanks for the quick reply - one follow-up question. In your reply, in saying "which instruments are trading" - are you implying that I would create a system that, say, buys when an instrument is above the 200d MA? My way of thinking about this is that it is a scan - you look at, say, the S&P500 and say, how many are above the 200d and how many are not. Then, count the number of instruments so that you can get to a percentage.

Is this what you mean?
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

I was referring to the fact that there are dates when instrument A trades (and has historical data), while on the same date instrument B does not trade (and has no historical data for that date). "Percent of all instruments meeting criterion X" on that date, is easy to get wrong.
droskill
Full Member
Full Member
Posts: 20
Joined: Wed Jun 07, 2006 4:54 pm
Location: Massachusetts

Post by droskill »

Ah got you - yeah I understand. This is a super common problem that I'm surprised that software developers don't create a solution - having a portfolio defined over time where the constituents change. Take the S&P 500 - the stocks in the index have changed over time, but no software allows you to have, say, Enron up till the point it exited the index (I don't know if it was in the index, but you get the point).
Post Reply