PDA

View Full Version : Strategy Update Processing


tquinn
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.
[line]
CalculateOnBarClose = false;

if(Bars.Complete==1)
{
// Entry orders
}

// Exit Orders

NinjaTrader_Ray
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
Ray

tquinn
01-29-2007, 06:38 AM
Thanks,

My hat is off to you Ray and the Ninja Team, for having thought through so many of these situations.

KBJ
03-24-2007, 06:15 AM
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"?

Thanks.

KBJ

NinjaTrader_Ray
03-24-2007, 06:35 AM
Provides a tick based interval at a user defined compression level. IE 50 tick bar, 100 tick bar.

KBJ
03-24-2007, 07:15 AM
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?

Thanks.

KBJ

NinjaTrader_Ray
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.

2. No.

3. No.

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.

Ray