PDA

View Full Version : Intrabar granularity


eswap0
06-05-2008, 04:44 PM
I was trying to run intrabar granularity for backtesting, and downloaded the script from http://www.ninjatrader-support.com/vb/showthread.php?t=6652
I think I understood everything pretty well, but while trying the script, I just get trades if I choose one minute in the strategy backtest box, but this makes the script work as with a single bar series.
If I choose 5 minutes in the strategy backtest box, no trades are done at all.
Any idea about what am I doing wrong?
Thanks a lot! :)

PS: By the way, why does the backtest chart draw two SMA lines (5 and 50) while figures are suposed to be calculated with EMA's??:confused:

NinjaTrader_Josh
06-06-2008, 01:45 AM
Hi eswap0,

In the example you want to set the time to be 5min for your primary bar series. Trades should occur under this scenario if you have the data. If you are experiencing otherwise it would be great if you could check your Control Center logs and let us know of any fishy errors.

The chart is suppose to draw EMA of 10 and 25 by default. Are you sure you are testing the right strategy? Please try it again with default settings.

eswap0
06-06-2008, 11:41 AM
There's a smily missing: the ashamed one.
Sorry: I shouldn't test scripts that late. The script runs perfectly.
Sorry for my stupid mistake: I choosed a diferent strategy..
Thanks so much,

PS: it might be usefull to somebody that trades run ok, at the right minute, althougt the chart is plotting them in the wrong bar.

NinjaTrader_Josh
06-06-2008, 11:25 PM
The charting happens on the 5min bar, but your trades are in the 1mins. Since there are less 5min bars then there are 1min bars they get squished when plotting.

eswap0
06-08-2008, 11:53 AM
Last question (I hope).
I realize I can use different minute periods, and everything works, but as soon as I choose "1 day" in the strategy backtest box (instead of n minutes) the script for intrabar granularity shows no trades.
Is there any way to mix days and minutes?
Thanks a lot!

NinjaTrader_Josh
06-08-2008, 01:48 PM
That is the nature of using daily bars. From a daily bar there is no way you can determine intrabar price action so there is no way you can trade intrabar. The only way you can do this is through a multi-time frame strategy. Please see the Help Guide on Multi-Time Frame for more information.

eswap0
06-08-2008, 02:42 PM
Sorry but, isn't the script from http://www.ninjatrader-support.com/vb/showthread.php?t=6652 aldready based in Multi-time frame?
I checked the script and instructions and saw that fit the Help Guide on Multi-Time Frame (like Add(PeriodType.Minute, n) and if (BarsInProgress == n))
Again in that Guide minutes are not mixed with days...
Thanks again!

NinjaTrader_Josh
06-08-2008, 03:10 PM
The best way for you to understand how it works is just to try it for yourself. Please keep in mind the instructions (outlined in the reference sample) on which series needs to be the primary and which needs to be the secondary. Daily and intraday time frames will mix.