![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Scenario:
I have a strategy that uses multi time frames. For example it also reads: 1 minute and 3 minute The 1 minute is ok because all charts are always the same. However the 3 minute is not the same. The 3 minute can begin in any of 3 continuous minutes. Like a tick chart it can begin with any tick. Is there any way to synchronize a chart with a timeframe used in a strategy? What I am looking at on a chart is not the same as the strategy uses. I understand why but it drives me crazy when I look at my signals and try to figure out what happened. I look at one chart but the strategy uses a totally different chart in essence. I tried using the same days back on all timeframe charts but it didn't help. It would be nice if you could see an actual charts that are sync for a strategy. Regards Cliff |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Are you referring to how the bars are being built as outlined here? http://www.ninjatrader-support.com/H...struments.html
You could try making the 3min bars your primary bars so you can see those for your signals?
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Josh
I see you got the late shift again. Understood on the 3 minute primary but I also use a very small volume chart and it is the one that needs to be the primary so I am looking at the smallest chart I am getting signals from. So there is no way to sync a chart of an added timeframe to a strategy? I understand they all swing on a different clock I just didn't know if I can see what the strategy sees. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
I forget how the exact behavior goes. Let me run some tests on my end and let you know.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Hi ct,
I believe things should be in sync for you as is. Please take a look at my attached test strategy. You will find the bar data is printed accurately and in sync with the multiple time frames. I suspect if you are using a custom indicator you may need to use Update() to keep the values in sync. http://www.ninjatrader-support.com/H...V6/Update.html
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Josh
No custom indicators used. That may be some of the issue. I had a signal where the strategy said the macd on the 5 minute timeframe was up. I went 5 bars+ either side of the signal time and it was always down but I still got an up signal. Below is the code that is checked. I know I can use rising or falling but it doesn't work well for multi time frames so I never use it. Been burned bad. Wounds are healed but left bad scars. _required.Add(delegate() { return (s.MACD(19,38,9)[0] > s.MACD(19,38,9)[1] && s.MACD(s.BarsArray[s.InstrumentPosition["1-Minute"]],19,38,9)[0] > s.MACD(s.BarsArray[s.InstrumentPosition["1-Minute"]],19,38,9)[1] && s.MACD(s.BarsArray[s.InstrumentPosition["5-Minute"]],19,38,9)[0] > s.MACD(s.BarsArray[s.InstrumentPosition["5-Minute"]],19,38,9)[1] ) ; }); Will see if your mod helps.... |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Josh
I sent you some screen shots via support ticket system.Ticket number is 56159. If I am not using a custom indicator can I still have multi timeframe data issues? |
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Hi ct,
I currently do not have direct access to the ticket system. If you don't mind could you send me the screenshots directly? josh [at] ninjatrader [dot] com. Thanks. I believe the issue is not data per se. It is just that under certain situations a custom indicator may not be kept up to date with the current bar being processed.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Josh
Ticket email forwarded. If I have 3 timeframes all using the same instrument and I am using CalculateOnBarClose = false; should I only perform my calcs on BarsInProgress == 3? Since it is 3rd will it always be called last (after 1 and 2 are updated) if using the same instrument? Could be part of my problem but not all of it. |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Josh
Forgot to mention I am on 6.5.0.4. Cliff |
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
It would be easier on your coding to run your calculations on only the last bar series, but you do not need to necessarily restrict yourself in that manner. If you have a need to run calculations in other bars you can.
I'm reviewing your screenshots right now along with the code snippet you provided. The only thing I can think of is for you to check if s.InstrumentPosition["5-Minute"] is actually giving you the correct bar object.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
Is should be the correct bar object:
Add(PeriodType.Minute, 1); InstrumentPosition.Add("1-Minute", 1); Add(PeriodType.Minute, 1); InstrumentPosition.Add("5-Minute", 2); Add(PeriodType.Volume, 500); InstrumentPosition.Add("500-Volume", 3); |
|
|
|
|
|
#13 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Give me a moment. I accidentally destroyed my NT6.5 environment and need to rebuild it before I can test some stuff for you.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
When I reference another timeframe I always do it explicitly and specify the bars array. It makes it easier for me to keep track of. Otherwise you are saving values from each onbarupdate to compare once you have them all collected.
|
|
|
|
|
|
#15 |
|
Senior Member
Join Date: Dec 2006
Location: Nelson, New Zealand
Posts: 358
Thanks: 1
Thanked 2 times in 2 posts
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CurrentBar and Multi Time Frame | maxpi | Strategy Development | 7 | 07-31-2009 01:07 PM |
| Multi-time frame | scjohn | Strategy Development | 1 | 06-06-2007 07:20 PM |
| Accessing High value in a multi time frame strategy | PrTester | Strategy Development | 4 | 05-02-2007 01:13 AM |
| Strategy Analyzer Chart Displays Too Much When Time Frame is Changed | KBJ | Strategy Analyzer | 1 | 04-23-2007 07:30 AM |
| Plotting values on multi-time frame and instruments chart | SuzyG | Strategy Development | 1 | 01-19-2007 12:32 AM |