![]() |
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 | |
|
Member
Join Date: Jun 2008
Location: Chicago
Posts: 32
Thanks: 0
Thanked 0 times in 0 posts
|
Please help me understand why this is happening.
simple strategy is added to a 33 tick chart. i have an added time frame of 1 tick and a counter for each tick within BarsInProgress == 1. looks like this: Code:
protected override void Initialize()
{
Add(PeriodType.Tick, 1);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{tickctr++;}
if (BarsInProgress == 0)
{
Print ("Tickctr: "+tickctr);
Print ("date: "+ToDay(Time[0])+" time: "+ToTime(Time[0]));
Print ("---------------------");
tickctr = 0;
}
}
Quote:
thanks |
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,410
Thanks: 252
Thanked 976 times in 959 posts
|
With your shown code you would only see prints when the primary series (BIP0) updates.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 | ||
|
Member
Join Date: Jun 2008
Location: Chicago
Posts: 32
Thanks: 0
Thanked 0 times in 0 posts
|
the following code works in real time but not in strategy analyzer:
Code:
protected override void Initialize()
{
Add(PeriodType.Tick, 1);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
tickctr++;
Print ("Tickctr: "+tickctr+" Time: "+ToTime(Time[0]));
}
else if (BarsInProgress == 0)
{
Print ("---------------------");
Print ("Tickctr: "+tickctr);
Print ("date: "+ToDay(Time[0])+" time: "+ToTime(Time[0]));
Print ("---------------------");
tickctr = 0;
}
}
Quote:
Quote:
|
||
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello Jcash,
Is it possible here the sequence of ticks is not matching up? Meaning when you start evaluating your 1 tick series-- it's not necessarily the 1st tick in your 33 tick series. It could be the 2nd, third, 33rd etc.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2008
Location: Chicago
Posts: 32
Thanks: 0
Thanked 0 times in 0 posts
|
Ryan,
that could be the problem, but doesn't explain the results of 0 and 97 (2.9x 33 ticks) in my 1st post. how would you ensure synchronization of the 1 tick addition on the 33 tick chart in strategy analyzer? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Maybe you could create a data series from this and sync according to this reference sample:
http://www.ninjatrader.com/support/f...ead.php?t=3572 It creates the series on the first OnBarUpdate and then value is set during BIP = 1.
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strategy that includes multiple display panels and multiple time frame data | burrmann | Strategy Development | 1 | 08-03-2010 04:53 AM |
| Multiple time frame issue | _db8r_ | Strategy Development | 3 | 03-17-2010 08:12 AM |
| Multi-Time Frame code issue. | strategy1 | General Programming | 32 | 01-14-2009 12:17 PM |
| Multi Time Frame Stop Loss Issue | yimbot | Strategy Development | 15 | 01-03-2009 05:23 PM |
| Multiple Time Frame access | stepwise | General Programming | 1 | 03-31-2007 03:33 AM |