![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Junior Member
Join Date: Mar 2010
Location: United States
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
My first post -- great product and a great forum.
I'm testing some strats in Strategy Analyzer and liking these tools -- very nice. I am testing a daily/weekly strat. I would like to know if there is a way to get the value of the higher timeframe indicator as though it were calculated through the current bar of the lower time frame. For example, I'm handling a Thursday daily bar, but the Stoch weekly value is four days out of date. Might there be some way to get a value for the weekly Stoch as though its last data point were the current daily bar? (And all previous values were the normal weekly values). I realize that I could code this myself, but that can get to be a bit of work to do for many indicators. Stoch is not the only indicator I use. I realize that CalculateOnBarClose is always true for backtesting. Any ideas or suggestions would be appreciated. Lew |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello Palance,
Welcome to the NinjaTrader forums! When using version 6.5, the secondary series should be smaller than the primary series. You would run the strategy against a weekly series and then add a daily series. You define the context you're working from with BarsInProgress. Example: if (BarsInProgress == 1) //Refers to OnBarUpdate calls to the daily series myDouble = Closes[0][0]; //Captures the value of the primary series into a variable. This reference sample helps demonstrate the sequence of OnBarUpdate() calls in a multi-series strategy.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2010
Location: United States
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Ryan, thanks much for the welcome and for the quick reply.
Interesting rule re making the highest time frame be the primary series -- I'll follow that. (And yes, I'm using 6.5). But my entry conditions are mostly on the lower time frame object. So it can easily occur that several lower time frame bars beyond the higher time frame point have elapsed and thus that the higher time frame indicator value is that much out of date, at least until a new higher time frame bar completes. So the weekly Stoch, for example, is completely current over the weekend, one day out of date after Monday, two days out of date after Tuesday, etc. And if my entry condition occurs on Thursday, I would like to have a "current" weekly Stoch that includes the current partial week. Just wondering if there's a way to get this without coding it myself. Lew |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
Lew, when running the strategy real-time, you can set CalculateOnBarClose = false and then whenever you retrieve the weekly value, it would be current up to the most recent tick. The reference sample Ryan posted also goes over how to backtest with an intrabar granularity, and you could tweak it to your liking.
It would also be possible to construct a "fake" weekly series through DataSeries objects and then run whatever calculations you'd like on that series, although the specifics of such an implementation would be up to you. Here are the applicable links: Using a DataSeries object to store calculations Synchronizing a DataSeries object to a secondary time frame
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Mar 2010
Location: United States
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
OK. Thank you both very much. The Data Series objects may be a good way to go, at least for backtesting. I appreciate the help.
Lew |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi-timeframe strategy skips lower timeframe bars at one point | adamus | Version 7 Beta General Questions & Bug Reports | 13 | 07-03-2010 01:36 AM |
| Multi timeframe strategy calling indicators with drawn objects | Shansen | Strategy Development | 4 | 05-31-2010 12:55 PM |
| Multi-timeframe indicators | sbgtrading | Version 7 Beta General Questions & Bug Reports | 1 | 10-09-2009 07:40 AM |
| Multi-timeframe Moving Average indicators | sbgtrading | Indicator Development | 1 | 02-11-2009 12:42 PM |
| master list of do-not-use indicators in multi-timeframe strategies | sysimp | Strategy Development | 1 | 07-07-2008 12:52 AM |