![]() |
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
|
|||||||
| Miscellaneous Support Miscellaneous support issues. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2008
Location: UK
Posts: 637
Thanks: 0
Thanked 1 time in 1 post
|
Hi,
I'm sure there'll be something about this in the forums already, but I didn't find it (searching on end, day, bar etc is difficult) I have a one minute strategy, calculating on bar close only. I have an instrument (Z) with end of day at 9pm, UK time. The problem is that the strategy runs constantly, but I need somehow, within a reasonable amount of time, to detect the last tick of the day and do something in the strategy. Currently, the strategy will not call onbarupdate until the first tick of the next bar, which is 8am the following day. Does anyone have any workarounds or solutions for this issue? One thing that occured to me was to add another bar series for daily timeframe. At least then I could get the strategy to execute some code. Related to this, could I have some info about how calling update() works? Can you set the barsinprogress for the call? If so, could I call update from the daily onbarsupdate and set barsinprogress to the minute bars series? Lastly, I want to try and come up with a solution that doesn't require setting calculateonbarclose to false! thanks for any ideas Dave |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Dave, the Update() would only be used to ensure certain internal indicator calculations are updated prior to the OnBarUpdate() call.
In your situation I would suggest using a time filter to do your end of day calculations, would that work for you? http://www.ninjatrader-support2.com/...ead.php?t=3226
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2008
Location: UK
Posts: 637
Thanks: 0
Thanked 1 time in 1 post
|
Thanks for the reply. So Update() doesn't really call OnBarUpdate() ?
By time filter, do mean take all ticks in and reject all those not with a particular time? If so, that doesn't really work for me, as I really want to avoid having OnBarUpdate() fire for every tick of the day. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
You would force an OnBarUpdate() call of the indicator with this, but you can't force a new bar to be started, this is event based, so the tick of the new bar has to come in to close the old one.
With time filter I just meant to process your 'last tick of the day logic' very close to the expected closing of the Z market (for example at 20:59:30).
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2008
Location: UK
Posts: 637
Thanks: 0
Thanked 1 time in 1 post
|
I don't really see how that works, since there will be no code executed at 20:59:30 since there will be no onbarupdate until 8am. Unless you mean take in all ticks, but I've already covered that.
thanks Dave |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
You could add a finer granularity to achieve this, for example a 30 second chart.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Nov 2008
Location: UK
Posts: 637
Thanks: 0
Thanked 1 time in 1 post
|
But I'd still miss the last 30 secs worth of ticks, meaning closing price and volume would be incorrect. And I'd get twice as many updates, and I don't want more than 1min ones.
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
This depends on in which context you run your main code, the added 30 sec chart would just give you access to lower then 1min timestamps.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Detecting live or non live mode (replay/back testing) | BillCh | General Programming | 2 | 06-18-2009 07:43 AM |
| Detecting a Posting Exit | netjms | Strategy Development | 1 | 05-07-2009 08:12 AM |
| Detecting double entry... | ninjaq | Strategy Development | 1 | 04-06-2009 04:33 PM |
| detecting backtest or real time simulation | dave1992 | Strategy Analyzer | 9 | 11-22-2008 06:09 AM |
| How to call an ATM when detecting signals ? | jed77 | Strategy Development | 2 | 03-28-2008 01:23 AM |