Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Update() method
Collapse
X
-
Update() method
Do you guys have any examples of how to use the Update() method? I'm not sure I fully understand how it works from the description in the online help. Can it be only called from a property getter? Is the property getter in the indicator or startegy? Does it cause OnBarUpdate to cycle through all the BarsInProgress instances?Tags: None
-
Is it only supposed to be used in a strategy? I would like to call OnBarUpdate() on a timer in an indicator, to periodically perform some tasks, when the market is very slow, and few updates are occurring on the bar. If I use Update() in an indicator not associated with a strategy, OnBarUpdate() is never called.
Originally posted by NinjaTrader_Dierk View Post- you can call it from anywhere not only from property getter
- it will trigger OnBarUpdate
- you only should use at as you experience that an indicator in your NS does not update
- sorry, no further samples available
Comment
-
Ok, In a NT Indicator, I have a timer routine that wakes up on the 59th second of every minute to do some special processing. That processing involves reading Close[0], Volume[0] etc. I would like to call OnBarUpdate() within the timer wakeup routine, in order to get Close[0] etc. So, I have the following code inside my timer wakeup routine:
dummy = forceBarUpdate; //### force a call to OnBarUpdate()
Where forceBarUpdate is defined in a property as follows:
public int ForceBarUpdate
{
get {
Update();
return forceBarUpdate;
}
set { forceBarUpdate = value; }
}
The result is that OnBarUpdate() never gets called when the timer wakeup routine runs. Do you follow what I am trying to do? Simply, I want to call OnBarUpdate() on the 59th second of every minute. Can I do that with Update()? Am I using Update() wrong? Is it possible to do this in NT?
Originally posted by NinjaTrader_Dierk View PostI suggest coding Update() on the property getter of the affected indicator as suggested by the code sample in the docs.
Comment
-
Cool, I will try the custom even handler. But regarding Update(), I previously also tried the Update() statement directly within the timer wakeup routine, and it did not call OnbarUpdate() either.
Originally posted by NinjaTrader_Ray View PostPlease make sure you are doing something like this -
You can call Update() in this case without using it in a property however, please be careful in its use in that you don't want your code to call it unncessarily.
Comment
-
Jumping in here late so haven't read the whole thread, but this may or may not be of use for you monpere: http://www.ninjatrader-support.com/v...ead.php?t=5965Josh P.NinjaTrader Customer Service
Comment
-
The syntax in the example in the help documentation is incorrect, there is a missing parenthesis.
Is TriggerCustomEvent() meant only to be used in an Indicator? When I convert the sample Indicator to a strategy, I get the error 'No overload for method TriggerCustomEvent takes 2 arguments'
Originally posted by NinjaTrader_Ray View PostPlease make sure you are doing something like this -
You can call Update() in this case without using it in a property however, please be careful in its use in that you don't want your code to call it unncessarily.
Comment
-
Ok, looks like as a strategy, TriggerCustomEvent() requires the overload with the barsInprogress as the 2nd parameter.
Originally posted by Josh View Postmonpere thanks for pointing out the typo in the docs.
In regards to your code, please post up the code snippet you are using. If you followed the reference sample there should be no issues.Last edited by monpere; 05-21-2008, 04:36 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
657 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
373 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment