View Full Version : Strategy Update Processing
01-29-2007, 03:51 AM
How would I structure a Strategy that would issue Entry orders on a Bar close basis, and Issue Exits on Every Tick. The Strategy should still be usable for BackTesting. I tried the code below but it does not work for backtest.
CalculateOnBarClose = false;
// Entry orders
// Exit Orders
01-29-2007, 04:45 AM
See the FirstTickOfBar property in the Help Guide. There is a catch -
Backtestresolution is only by bar not by tick so you will not be able to truly backtest this strategy
Since FirstTickOfBar is true on the first tick of a bar, you need to access the values from the prior bar to analyze the close of the prior bar to generate your signal, in backtest, this will throw things off since backtest only evaluates on bar close
01-29-2007, 06:38 AM
My hat is off to you Ray and the Ninja Team, for having thought through so many of these situations.
Backtest resolution is only by bar not by tick so you will not be able to truly backtest this strategy
Has this changed?
When I use the Strategy Analyzer to backtest, under "Data series" it allows me to select Type of Year, Month, Week, Day Hour, Minute, Second, Volume, and Tick.
So, if "Type" were selected as "Tick", would this provide a tick-by-tick backtest scenario?
If not, what does it do when I select "Tick"?
03-24-2007, 06:35 AM
Provides a tick based interval at a user defined compression level. IE 50 tick bar, 100 tick bar.
I'm not sure what to think about a "user defined compression level". This doesn't answer my first two questions, and leaves me wanting to ask more questions to clarify what is meant "user defined compression level".
So, here's my list of current confusions on this topic:
1. Does "user defined compression level" mean that's how the bar widths are defined when charts are displayed?
2. Does this also affect how often OnBarUpdate() is called on a backtest?
3. Has the feature changed, so that tick-level backtest resolution is now available?
4. If I set the backtest "Data series" type to "Tick" and value to 1, will this create NO "user defined compression"?
5. And if so, will this then provide a tick-by-tick backtest scnario?
03-24-2007, 07:35 AM
We are talking apples to oranges here.
Tick by tick level backtesting is not possible. Backtesting is based on a bar which has OHLC information. Tick by tick level backtesting means that you can backtest on a 1 min bar but each historical tick that makes up that 1 min bar is used in the backtest vs the bar by itself.
1. No. Minute, Tick, Second, Day etc... is an interval. Compression is the period value. So a 5-minute bar is has a compression value of 5. a 100 tick bar has a compression value of 100.
4. You get a 1 tick bar to backtest on.
5. You get a bar based backtest resolution however, since a 1 tick bar is the lowest common denominator for any bar, you in fact get a tick by tick backtest.