In this thread I will discuss and design a way to radically improve repetitive back-testing while developing a strategy.
The Problem
A strategy based on Renko-type bars can only be correctly back-tested when using market replay and running the complete period tick per tick through the strategy. This is a burden and especially when developing and refining rules that do not change the indicators, but rules that decide on how to read the indicators and decide to buy/sell.
Having worked on a strategy for which i had chosen waterfall design pattern, that has shown to be too time consuming. This thread is not about that strategy specifics. This thread is about the general problem and a general solution for this kind of problem.
The answer
The solution I had in mind, is to use my NT with the indicators and a strategy to capture one-time the data per bar over the testing period. Price, high, low, and the values of all the relevant indicators at every bar are captured.
The captured data can then be used outside NT as input into a module that will read that data, similar to the code invoked in the OnBarUpdate function in a strategy.
My goal is to create a class/object that handles the data and outputs the trade signals.
I will build a component (object) that can be called in a stand-alone console application.
The component will hold the various logic to decide on a trade signal.
This will allow to define, develop, change the rules and (re)run the test data through the component at extremely fast speed as nothing needs to be calculate, the indicators are all pre-recorded in the pre-captured data and ready line by line while bars developed during the recording session.
The time saved
- no need to go through the tick data for every test run
- no need to have NT chew all the tick to produce the indicators bar per bar
- faster solution than the current X500 replay in NT
- this should allow for a much fine-faster tuning of the trade signal based on static indicators
- module allows to do programmatic optimization
Technical implementation
Once the component is able to create profitable trades over a longer period of time, I want to reuse this component in my strategy. Only then the strategy will feed data that is calculated based on replay or live market data. This will remove the risk of discrepancy between testing and forward due to coding errors.
Anybody who has experience/visibility on this type of testing system external to NT or who has experience in component development for strategy development is invited to comment and/or advice.
Has anybody experience with building a DLL and calling that DLL from within the strategy, compared to have all logic in the strategy .cs file ? My experience is that a strategy with all logic in line tends to become quickly messy.
The DLL would then be shared between the stand alone test module and the NT strategy.
I want to create an object with a few public methods, that is the trade decision part.