Tuesday, April 17, 2007

Test it

Arrows on your chart. They look so good!

And in hindsight you see all these great trades that were marked on the chart but somehow discount the losing trades.

But why do I have that warning voice in me asking me before I take a trade: Is that really a valid signal? Yes, there is that arrow, but .... You know not all of these signals work. Do you really think you're smarter than all these other geniuses out there designing tradesystems for big firms for 6 to 7-figure salaries.

So another signal is not taken.

Enough!

Before I take one more trade I will have a very very long look at my charts and confirm the validity of all these signals I now place on my charts by cold hard facts. I need numbers, I need statistics about the arrows on my charts. And I can't do these by hand as I would never again make a trade, if I need to rely on handwritten statistics for say 10 symbols in 6 different timeframes for the last 3 months alone.

I need tradesystem analysis. Yes I know the Tradestation guys are laughing as that's one area that program is excelling in. But

  • I don't have Tradestation
  • I don't intend to switch and learn it only to come back to Ensign after my statistic is finished
  • I'm used to Ensign Software for 6 or more years and
  • I'm convinced I can do everything TS can in Ensign as well.  

Fortunately Howard, the developer of the Ensign Chartprogram is really great guy and always willing to help, if you have a question. Even making adjustments and additions to Ensign, when you have a reasonable suggestion, which fits into his development plan.

First I wrote an eMail to Howard asking about tradesystem analysis in Ensign and Howard answered me with 3 good resource links, which got me started.

Hi,
You would use ESPL logic to implement your ideas and when you have a trade signal to either enter or exit a trade you
would use the ESPL commands for the trade system.   A ledger of your trades is made and some statistics provided by that ledger.
See these examples.
http://www.ensignsoftware.com/tips/tradingtips42.htm
http://www.ensignsoftware.com/espl/espl119.htm
http://www.ensignsoftware.com/tips/tradingtips21.htm

Then I ran into some design problems and he added a new statement to the ESPL programing language making the task I set for myself a lot easier. Thank's a lot Howard!

What did I do?

Designing Chart-Templates which paint an arrow once certain conditions are met is simple in Ensign. The power of the Do-it-yourself study is really unmatched when it comes to designing your own charts with bells and whistles. But the tradeanalysis needs to be done in ESPL. So I adjusted Howard's ESPL code, found in the resources he sent me, to link with my chart template, added some trademanagement I normally do in my own trading and here is the result:


(doubleclick to enlarge)

The Tradesystem is a simple trendfollowing system, which goes long or short on a retracement with the trend. Nothing sophisticated and actually an example how trade management can turn a profitable tradesystem into a losing one and vice versa.

I have designed the ESPL code in a way, that you can enter the Tradetarget, the Stop and a trailing Stop in ticks, which makes this code applicable to a wide array of symbols.

The Charttemplate itself needs to have 3 DYO Studies:

  • One named "Buysignal" which goes True in Line J when a Buy is triggered
  • One named "Sellsignal" which goes True in Line J When a Sell is triggered
  • and one named Variables where you can transfer Numbers from the chart to the ESPL program. Currently it needs to tell the ESPL program only the minimumticksize of the symbol to be analyzed, which is available in the $Q variable in Ensign.

Here is an example of the BuySignal DYO

The Tradesystem analysis is done in ESPL.

First you need to place the code in your ESPL directory [\Ensign\ESPL], then you need to load it in the ESPL script editor and adjust the variables according to your needs:

(You need to enter the chartname, if you have more than one chart open when testing. I have made myself a Tradesystem Workspace with one chart only, so I don't need to change the code, when switching symbols) 

Clicking the Number 1 Button will clear the output window and will clear your chart from any markers left from previous tradesystem runs (if any).

Click Button 2 and the Tradesystem analysis is running

If you have Ensign and are interested in testing your own system, here are the links to the

Chart-Template and the ESPL code (right click the links and select Save Target.. to download directly in the correct subfolders)

I wish you a profitable tradesystem analysis