Search
× Search
Sunday, December 22, 2024

Archived Discussions

Recent member discussions

The Algorithmic Traders' Association prides itself on providing a forum for the publication and dissemination of its members' white papers, research, reflections, works in progress, and other contributions. Please Note that archive searches and some of our members' publications are reserved for members only, so please log in or sign up to gain the most from our members' contributions.

Back Tester

photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Wednesday, May 20, 2015

I have written a Back Tester that allows for the simultaneously testing of: a) 1 or more Financial Instruments b) 1 or more accounts for a specific instrument. A multitude of strategies may be executed concomitantly (1 per account). An output table lists all trades that would have been made for a specific period of time according to a specific strategy. Each row contains statistics (Time of Trade, Profit per account, Profit per Instrument, Total Profit, Drawdown, Trade Price,...) showing how the Portfolio would have been evolving at each trade. It would be great if could have a look at www.arosario.com and make some comments. Playing with Example 1 and 2 gives a good understanding of how the Tester works.


Print

15 comments on article "Back Tester"

photo

 Dawid Makowski, ITH FX

 Thursday, May 21, 2015



Hello Antonio,

good idea, but quite hard to done. We have backtester with features mension above. Therefore I know not IT work, but imagine how way system will work is difficoult.

best regards

DM


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Thursday, May 21, 2015



I think that my Back Tester is very simple to use. The user only has to specify the Pair used and for each pair the number of accounts. For example

v EURUSD 8

v AUDUSD 5

Now click example 2 button and see results. It would be nice if you could give your opinion on what you see.

www.arosario.com


photo

 Brian Ochsner, Direct-Response Financial Copywriter; Editor, The Ochsner Report

 Thursday, May 21, 2015



Are you selling this algorithm or trading system to retail investors?


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Thursday, May 21, 2015



Brian,

The system is not ready to be marketable. At this point I am only interested in having some feedback that could improve the program. I am not sure what are you referring as "algorithm". The algorithm I presented is for illustration purposes only. I would not advise anyone to use it (Geometric Progression) because would eventually be a losing strategy. What is important is the Trading Platform in the server that processes any "algorithm" passed to it. I am calling it a "Trading Platform" because it allows for the trading of multiple instruments and many accounts can be opened.

I have no intention of selling any "algorithm" i.e. any strategy. The ultimate purpose of my program is for potential users to write their own strategy and pass it to the Back Tester for testing.


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Thursday, May 21, 2015



Brian,

The system is not ready to be marketable. At this point I am only interested in having some feedback that could improve the program. I am not sure what are you referring to as "algorithm". The algorithm I presented is for illustration purposes only. I would not advise anyone to use it (Geometric Progression) because would eventually be a losing strategy. What is important is the Trading Platform in the server that processes any "algorithm" passed on to it. I am calling it a "Trading Platform" because it allows for the trading of multiple instruments and many accounts can be opened.

I have no intention of selling any "algorithm" i.e. any strategy. The ultimate purpose of my program is for potential users to write their own strategy and pass it on to the Back Tester for testing.


photo

 Joaquin Monfort, Currency Analyst at Forex4you

 Friday, May 22, 2015



Hi Antonio,

The most important thing is the user interface. I am afraid I do not know Java so I wouldn't be able to use this software. The challenge for you is to create an easy to use interface which allows users to 'write' their own strategies to be back-tested, without the need for knowing complex programming languages. I would also include more tools for analyzing equity curves. I would sell this as an online app which people pay a subscription to access - not a one off fee as these are always too high. A modest 10-20 buck sub would be the best way to go once you had finished it. I'd like to work with you on this but I would need a cut of company if that's the case. I have many novel ideas which would make your product different to what it already out there. Let me know if you are interested.


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Saturday, May 23, 2015



Joaquin, You making a good point. Indeed, as it is only people with a good understanding of Object Oriented Programming could develop strategies. However, catering for other people and still be able to give them the flexibility to create their own strategies presents some challenges. I would be very pleased to listen to your ideas. Perhaps we could meet and discuss the matter over a glass of wine.

My email address:

arosario@blueyonder.co.uk


photo

 Dan Dunn, VP of Product and Community at Quantopian

 Monday, May 25, 2015



Building a backtester is fun. But, it's one of those things that has been done many, many times before. Whether it's good or not, the devil is in the details - what is the slippage? the market impact? the commission? How does it handle holidays, or market stoppages, or slow to fill orders? I suggest you check out http://zipline.io. It's an open-source backtester that has thousands of hours spent considering questions like these.


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Tuesday, May 26, 2015



Dan, I built a back tester because what I found out there were too restrictive or/and lacked simplicity. For example, MT4 has a back tester that would be just fine to test one instrument and only one account trading that instrument. If I want to test a portfolio and trade more than one account per instrument then I would need to search further or write my own tester.

Other testers including the one you referred me to (zipline) are unnecessarily complicated, offer irrelevant or misleading features and mix two different concepts: strategy and trading system(back tester). For example, zipline provides a function to enter an order type. To test a strategy only execution is relevant i.e. the strategy/algorithm should know exactly when to buy or sell a specific quantity.

It is important to understand the difference between past and future and between trading system and strategy. Slippage is irrelevant to back testing. It may have some importance in future 'ticks' if you use a strategy that trades quite often. And you only need a few minutes to understand how to avoid or minimize the problem. Either you place a limit order or develop a strategy that only trades at big price intervals.

Commission is a constant defined by the contract with your broker and, of course, it should be included in the computations made by the trading system. However to get a better commission look for another broker not for a better strategy. To minimize the problem try a strategy that only trades at big price intervals.

Of course, you can offer to potential users different strategies and indicators. But that has nothing to do with the back tester which is there only to make the computations required by the strategy. Since the back tester should be always the same regardless of any strategy I have to agree with Joaquin i.e. the user interface is the most important aspect to be concerned with once trading system (back tester) has been written.


photo

 private private,

 Tuesday, May 26, 2015



Dan's comments are I believe quiet important. Trying to model the fill process is something that needs careful consideration and not straight forward in a backtester. Once an order is placed by a strategy, what is the future bar where the order is filled, how to account for low volume, etc... I don't have all the answers myself but I've found that commissions and slippage are some of the elements that can kill a strategy.


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Tuesday, May 26, 2015



Nigel, I don't understand why should anyone who is able to design and program a strategy place orders to be executed in the future?

For example:

if (condition1) place order O1;

if (laterCondition1)

cancel();

else if (laterCondition2)

execute();

Only laterCondition2 is relevant to the performance of a strategy.

So the code above should be reduced to

if (laterCondition2)

execute();

The rest of the code is not adding any value to the strategy; it is only complicating it.


photo

 private private,

 Tuesday, May 26, 2015



My point is that if a strategy is working from bar data and only after a bar completes can a strategy provide a signal, then the strategy cannot execute an order until the commencement of the next bar. If you are using a limit order this can't really be filled until at least 2+ bars after the bar that provided the strategy an order signal. Even then the price has to trigger your limit price by some margin to provide a fill. It is all about avoiding look ahead bias. I'm happy to be corrected by those with experience.


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Tuesday, May 26, 2015



Nigel, perhaps your point is valid as it seems that you are using a different approach. All the strategies I have developed just read historical data and take decisions based on how the Price evolves. I never use limit prices and avoid strategies where the cost of predictable charges (spread, commission) and unpredictable charges (e.g. slippage) may, in percentage, weigh significantly on performance.


photo

 private private,

 Tuesday, May 26, 2015



It sounds to me that your approach with historical data may involve some look ahead bias. Unless you have a limit price your slippage may well be unmanaged. I suspect you might have optimistic results.

I have found that short term trades are killed by commissions so the net return is negative even though the strategy provides a great gross return. So the back-testing needs to reflect the real trade time frames and processes as best as possible so as not to deceive yourself. If you can compare your live trading with your beck-test and get comparable results then that is the best test.


photo

 Antonio Rosario, Computer Programmer / Researcher / Trader

 Tuesday, May 26, 2015



Nigel, probably I was not very clear when I said I only choose

"strategy that only trades at big price intervals."

Let's say I trade a EURUSD. My broker offers a spread of 0.00008. I have noticed that slippage is usually against me but is on average below 0.00003. If I take into acccount a cost of 0.00015 per unit of currency that is bought and sold then I am being conservative (not optimistic) on my computations.

* Strategy that trades every time price changes 0.00150 imply that trades are being taxed at 10%

* Strategy trades every time price changes 0.00300 imply that trades are being taxed at 5%

* Strategy trades every time price changes 0.00600 imply that trades are being taxed at 2.5%

I wouldn't advise anyone anyone to accept condition 1- or even 2- because they are very taxing. That's why I only consider a strategy that

"strategy that only trades at big price intervals."

of course, the trade off is a smaller number of trades which makes the strategy performance less significant from a statistical view point.

Please login or register to post comments.

TRADING FUTURES AND OPTIONS INVOLVES SUBSTANTIAL RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS
Terms Of UsePrivacy StatementCopyright 2018 Algorithmic Traders Association