ADX signal question

How do you know when a trend has started? Ended? This forum is for discussions about trend indicators and signals.
Post Reply
gjbkdunn
Contributor
Contributor
Posts: 3
Joined: Fri Jul 17, 2009 1:17 pm
Location: South Eastern CT

ADX signal question

Post by gjbkdunn »

I am a newbie to programming. I have backtested the ADX system that is supplied. However the system takes a long trade when the ADX is above a certain level and the DMI+ is above the DMI-.
However many of the largest loosers are when the ADX is above the desired level because the issue was in a long downtrend. Then a quick reaction up with prices makes the DMI + go over the DMI- triggering a long trade.
What I'd like to program is a filter of sorts that checks for the ADX now vs say a week ago. Is it rising??? Was the DMI+ above the DMI- a week ago.
These filters should hopefully only allow the original ADX signal to be triggered long in an uptrend.
Newbie....I am less than one day old with the builder edition.
So thoughts on how to do this?? With a regression slope??
Seems to me like I'd use a lookback??
But I'm still trying to wrap my brain around Parameters/Indicators etc etc.
I usually look over other signal code and learn/copy/adapt as much as I can
but I can't really find anything that is already programed that is similar.
Thanks
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

Although you don't say so, it sounds like (A) you wish to backtest against stocks, not forex or futures; (B) you wish to take long trades but not short trades.

It also sounds like you wish to add one or more "Trade Confirmation Filters" to the ADX system. It sounds like you want the filter(s) to affect entries but not exits. It sounds like you want these filters to examine each and every entry signal produced by the ADX system; in those cases where the ADX system produces an entry signal and the traded instrument is in a downtrend, you want the filter(s) to prevent Blox from taking the entry signal. The filter(s) say: "Don't Enter A Long Trade Right Now!"

Supposing that all of the conjectures above happen to be correct, then one way to skin the cat is to add some more AND clauses in your entry signal.

The virgin original ADX Entry Exit block says (in Pseudo English, not computer code)

If these three things are all true:
  • 1. We don't have a Long position today in this particular instrument; AND
    2. The ADX value is above a user-defined threshold; AND
    3. DMI+ is greater than DMI-
THEN, and only then, go long on tomorrow's open.

You can modify this by adding a new clause number 4. Tell Blox to only go long if those three things (above) are true, AND also
  • 4. My Trade Confirmation Filter says this instrument is not in a downtrend
There are quite a few ways to decide whether or not an instrument is in a downtrend. You mentioned regression slope; there is also momentum, moving averages, distance to highest-high versus distance to lowest-low, and many others. Many authors have written many books, claiming to have the best way to determine the trend. Try a half dozen of them and see if you like one better than the others.

Clearly you can install more than one trend confirmation filter if you wish; for example you can have one filter that checks "the intermediate term trend" (however you wish to define that), and another filter that checks "the long term trend" (according to your own definition). Then you would simply insert two new AND clauses; one for filter#1 and the other for filter#2. Now you'll only take ADX entries when the intermediate term trend is not downwards, AND also the long term trend is not downwards.

However it may be a good idea to explore all eleven of the Blox presupplied systems, as-delivered, before diving in and modifying the one that appears first on the alphabetical list. Maybe you'll learn a whole lot from examining how each of these systems works, and how they perform similarly or perform differently. Maybe you will discover that you like some of them far more than you like others. Maybe you will find that you want to focus on systems (X and Y) initially. Maybe the ADX system is not among them. Who knows?
gjbkdunn
Contributor
Contributor
Posts: 3
Joined: Fri Jul 17, 2009 1:17 pm
Location: South Eastern CT

Post by gjbkdunn »

Basically your suppositions at the beginning of the reply are correct.
With the exception of the long only. For discussion yes long only but
once I understand the logic and code required it can easily be converted to short also.

However what I'd like to do to determine the trend is to test the ADX.
Is it today (or the day of the entry signal) above where it was lets say a week before. Is the DMI+ above the DMI- today and was it + above - a week before.

Your suppositions in the last paragraph are not correct however.
I am a newbie to TradingBlox and programming it.
Years ago I used to program trading systems for myself in old now long outdated software. (At the time i had even gone so far as to buy an add in to excel that did monte carlo testing ... I had R values of backtest results from the old software exported in to excel and crunched monte carlo numbers). It has been a while and I don't choose to spend my time now redoing all that. Hence Trading Blox is a good platform for me right now. I understand the reward/risk/drawdown/expectancy/monte carlo/over optimization factors in backtesting and systems.

I am very comfortable with ADX and examined/programed/backtested with it in the past. The method I speak of testing ADX now vs previously is something I had programed years ago. Thus I did not select it because it was alphabetically first on the list. I actually selected it because of my familiarity with it.

I have had the Pro version of Trading Blox for a couple of weeks and have backtested several systems and combinations of systems. Using different Portfolio managers, exits etc. In evaluating backtesting results specifically with the ADX Long system I have noticed that the worst losers were when the stocks were in a downtrend creating a threshold ADX and a spike up forces the DMI's to cross creating a signal. In the past my way around this was to compare today's ADX values with some from the past. As I recall days were defined as T with today being T=0. So todays ADX value was ADX(0) and a value for a week ago was ADX(-5)....something like that.
I don't understand how tradingblox does this stuff.

Because of my bias from the past I'd like to know if I can minimize the losers with a concept that "used to work for me" or if adding this filter also eliminates some of the winners. Which often times happens.
What are the RAR/R cubed/MaxDD etc etc between these two approaches??
Is another trend "filter" as you suggested better?
What is a strength filter? I have to understand the logic to use it and I don't at this time. I understand ADX.

I can also just go into the tested trades and eliminate the ones that visually don't fit my criteria. But then I have no RAR/R cubed etc etc to use to compare systems.
Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 2038
Joined: Wed Oct 06, 2004 10:52 am
Location: San Marcos, CA

Re: ADX signal question

Post by Roger Rines »

gjbkdunn wrote:What I'd like to program is a filter of sorts that checks for the ADX now vs say a week ago. Is it rising??? Was the DMI+ above the DMI- a week ago.
These filters should hopefully only allow the original ADX signal to be triggered long in an uptrend.
There is nothing mentioned above that would be difficult to perform.
gjbkdunn wrote:So thoughts on how to do this?? With a regression slope??
Seems to me like I'd use a lookback??
But I'm still trying to wrap my brain around Parameters/Indicators etc etc.
I usually look over other signal code and learn/copy/adapt as much as I can
but I can't really find anything that is already programed that is similar.
Thanks
There is a lot of stuff available in the Trading Blox Support and in Blox Marketplace forum sections, including details on how to implement a regression slope.

Take some time and read what has been asked previously, and experiment with the offerings in the Blox Marketplace. With previous programming experience, some learning from both TB Help files, and study of previous Support forum postings you shouldn't have any trouble getting answers and methods for accomplishing what you are mentioning above. However, with your early position on the Trading Blox learning curve, you'll learn better by modifying stuff to see how it operates than any new attempt to set sail on your own until you've got a better map of how TB provides access to objects and test timing stages. You'll also need to learn the syntax and unique references of how things work in TB. None of this is hard, but it does take time to absorb once discovered and tested.

Another point to consider is to ask your questions in the Trading Blox Support section of the forum. That section is best place to get detailed answers, and it is also looked at more often and in a more timely fashion that where you've posted this message. If by chance you don't see the above mentioned forum sections appear when you log into this community support area, send an email to Tim letting him know to add your user information to the registered user's listing.

Take your time, and be patient with yourself. TB is unusually powerful in answering complex trading and performance questions, so you shouldn't have any trouble achieving your testing goals as your Trading Blox capabilities grow.
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

In the first post of this thread, gjbkdunn wrote:I am a newbie to programming.
In the third post, gjbkdunn wrote:I have had the Pro version of Trading Blox for a couple of weeks and have backtested several systems and combinations of systems.
I wonder whether you realize that the Pro edition of Trading Blox does not support "programming". Here's an explanation from a post (link) in the "Trading Blox Support" area of the forum:

Since you don't have the programmable version of Blox software (the "Builder" edition), you aren't able to write or edit trading systems components, called "blox". So that possibility is eliminated.

If you've got the "Pro" edition, you are able to assemble new systems out of the components (blox) that were provided when you purchased the software. The Pro edition also let you assemble systems using custom blox, i.e. other blox besides the ones that were shipped with the software. A large number of custom blox have been donated by other customers, who created them using the Builder edition. These custom blox are stored here on the Trader's Roundtable forum, in a section named the Blox Marketplace. Surf around in the Marketplace to see whether it contains something that meets your needs. If so, downlad it and give it a whirl.

Handy product guide:
  • Turtle Edition has no System Editor, has no Blox Editor. Cannot assemble new systems, cannot create or edit new blox.
  • Pro Edition has the System Editor but no Blox Editor. Can assemble new systems, cannot create or edit new blox.
  • Builder Edition has both the System Editor and the Blox Editor. Can assemble new systems, can create or edit new blox.
The excellent counseling and advice given by Roger Rines, applies mainly to the Builder Edition of Blox software -- the version of Blox which supports programming.
gjbkdunn
Contributor
Contributor
Posts: 3
Joined: Fri Jul 17, 2009 1:17 pm
Location: South Eastern CT

Post by gjbkdunn »

Yep I realize all that.
Had Pro for a couple of weeks, backtested several systems I'm already familiar with. Customized some. Downloaded a few BLOX from the marketplace, combined a few etc.
As I stated previously I found that the existing ADX system wasn't filtering trades as I wanted it to and that I was used to. Thus a matter of a couple of days ago I upgraded to Builder so I could add a few things.

Roger Rines comments put me on a track that somehow I stumbled upon part of a solution and an understanding of how Blox deals with time.

So what I did was put in an AND statement that asks in english
ADX>ADX[5] indicating that the ADX should be rising from 5 days ago.
I did the same thing for the DMI indicators.
Tested it out and it appears to have eliminated all the losing trades that were caused by entering a long position in a downtrend. That is precisely what I was looking for. Although it appears the overall system performs about as well as what I stared with..... not surprising with backtesting.

Now what I'd like to discover is how to make that 5 day look back a parameter that I can step thru and backtest.

I could not figure out a way to copy and paste the edited block for show and tell.
Thanks for the help.
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF »

Create an integer parameter with a name of your choosing, check the "use as lookback" box, replace the [5] in your code with [newParam] and wha-la!
Post Reply