![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
|
Is it possible to have a timer that triggers every new clock minute on an instrument that is set up for Range or Tick Periods
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi Turtle Trader,
Sure, maybe try something like: DrawTextFixed("myText", (60 - DateTime.Now.Second).ToString(), TextPosition.BottomRight);
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
|
Would that be dependent on CalculateOnBarClose = False??
In other words, the trigger of the timer would be dependent on the data feed in order to be triggered? If yes, then is there another way that is not dependent on the data feed? |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Yes, timer object would be one aspect of it. And if you need to draw on chart at a different frequency than bar updates, will also have to override the Plot() method. We do not provide support for this but there is a sample available in all installations. Tools > Edit NinjaScript > Indicator > CustomPlotSample.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Ryan,
OK, the pieces are coming together...now the last part... I would like to start the timer exactly on a minute boundary, not on a bar event... so that it triggers exactly one minute later, and so on... (remember that these are tick or range bars...it would be easy if it were a 1 minute chart..) any suggestions? Thanks |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
My first reply offered this. Did you get a chance to apply it to a chart? It doesn't override plot so apply it to a liquid market and run with CalculateOnBarClose = false. DateTime.Now is your computer clock so not connected to bar updates.
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 10-05-2011 at 01:51 PM.
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: May 2009
Posts: 343
Thanks: 0
Thanked 0 times in 0 posts
|
OK, yes I tried that....however, it only updates when there is a tick....after hours and even during the day some slow moving instruments may not have a tick in a minute.
I just tested this on CL (oil) around 7pm New York and it actually has dropped below a tick a minute at some times and the time didn't update when the clock turned over a minute. DrawTextFixed("myText", (DateTime.Now.Minute).ToString(), TextPosition.BottomRight); It might be OK to use it like this..." close enough", but I was hoping to set up the timer exactly on a minute boundary then just let it fire. |
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
It's not the value DateTime.Now.Second that needs to be changed here. It's that all the plotting and drawing logic is tied to OnBarUpdate. If you need to draw on chart at a different frequency than bar updates, you have to override plot method.
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 10-06-2011 at 10:48 AM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Range chart bar timer | jtradr | Indicator Development | 2 | 12-02-2010 03:41 PM |
| Minute Bars not updating w/ bar timer | rangerdoc | Version 7 Beta General Questions & Bug Reports | 3 | 07-06-2010 10:41 AM |
| Range Bar Timer | marker | NinjaScript File Sharing Discussion | 7 | 01-04-2010 06:23 AM |
| Timer for Constant Range Bars | laocoon | General Programming | 6 | 11-02-2007 01:13 PM |
| Catch the end of a minute bar on a tick by tick OnBarUpdate event | Fabrice | Automated Trading | 5 | 07-06-2007 12:28 PM |