Article: Back Testing Signals
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 trade systems for big firms for 6 to 7-figure salaries.
So another signal is not taken.
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 trade system 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've used 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 Windows program is really a great guy and always willing to help, if you have a question. He even makes adjustments and additions to Ensign, when you have a reasonable suggestion, which fits into his development plan.
First I wrote an e-Mail to Howard asking about trade system analysis in Ensign and he answered me with 3 good resource links, which got me started. Howard wrote back:
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:
Then I ran into some design problems and he added a new statement to the ESPL programming language making the task I set for myself a lot easier. Thank you 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 Design Your Own (DYO) study is really unmatched when it comes to designing your own charts with bells and whistles. But the trade analysis 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 trade management I normally do in my own trading and here is the result:
You have the option to add to trades, to reverse trades on a signal received or if the trade is stopped out. For information purposes I also added the option to show individual trade details. These statistics were generated trading a CL M7 2minute chart.
My Tradesystem is a simple trend following 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 trade system 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
Adjust the Slope DYO Line G to adjust the Flat period of the indicator where no trades are taken.
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)
Click the  button on the ESPL editor form to clear the chart and the Output window from any markers left from previous tradesystem runs (if any). Click the  button on the editor form to generate the Trade Statistics.
If you have Ensign and are interested in testing your own system, here are the links to the Chart-Template and the ESPL code. Also see the http://www.globe-trader.de/TS-EMA-Trend.dat template, as the chart picture shows the TrendCCI.dat Template while the Slope DYO is part of the new template which trades bounces of the 34ema and determines trend by looking at the slope of the 34ema. Both templates have a positive edge, so both might be interesting for playing with. (Right click the links and select Save Target.. to download directly in the correct subfolders).
I wish you a happy trade system analysis.
Article by Christian Czirnich
| contact us
Ensign Software, Inc., 113 Stillwater Drive, Idaho Falls, ID 83404 Support: 801-328-1382 Billing: 208-552-2230
(c) 2011 Ensign Software, Inc. All Rights Reserved
Last modified 8/4/11 3:56 PM