Is there a way to do that? Thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
CalculateOnBarClose question
Collapse
X
-
CalculateOnBarClose question
hi, is there a way that i can set CalculateOnBarClose = false, so i can monitor real time tick data (say, last traded price > entered price then i take profit) while for the indicators, it only fires when CalculateOnBarClose = true ? i mean, say, i want the RSI(14) calculated once every 5 minutes (5-min-bar)
Is there a way to do that? ThanksTags: None
-
Bertrand,
That trade strategy example really doesn't address the problem very well for two reasons.
- Trade logic for the entry ( EnterLong() ) trigger is FirstTickOfBar, while exit ( ExitLong() ) trigger is every tick.
- The trade strategy uses Add() to add two indicators to the chart which update with each tick, so unnecessary CPU resources would be taking place to update the chart with each tick even though the trade logic does not require this.
An alternate to using 'CalculateOnBarClose = true' option, would be to use a look back or the BarsAgo parameter [1]. That way, the calculation result would be the same as a calculation immediately on bar close or with the final tick of the bar.
Do you have any other examples that would work to conserve CPU resourses for multi-timeframe computations that use added timeframes with CalculateOnBarClose = false, but still allow some intrabar computations for some portion of the entry and exit trade logic? If not, how might one approach this in C# or Ninjascript?
Comment
-
Originally posted by NinjaTrader_Brett View PostHello,
You do not have to have the Add() call. That is just for show to display the indicator in the chart.
You could remove the Add() and then manually add the indicator to the chart with COBC = true.
Furthermore, with just 2 or more indicators cobc = false usually is no problem.
-Brett
Regardless of how one adds the indicator to the chart, the indicator will update intrabar with each tick, thus wasting CPU processing ability.
This is not generally a problem with simple strategies, however with fully developed strategies, it is a serious problem. If it wasn't a problem, COBC=true option would never have been added to the Ninjascript reference library, because as I pointed out in my earlier post, one could just use the barsAgo parameter [1].
Do you have any other examples that would work to conserve CPU resourses for multi-timeframe computations that use added timeframes with CalculateOnBarClose = false, but still allow some intrabar computations for some portion of the entry and exit trade logic? If not, how might one approach this in C# or Ninjascript?Last edited by borland; 05-02-2012, 03:36 PM.
Comment
-
borland, we would unfortunately have no other optimizing examples available - if you need an intrabar updated indicator then you would need to run this portion of code COBC = false or introduce a timer for example that could help reduce OBU cycles. Yet another approach could be to filter out OBU's triggered by the same price being seen, this would be a good solution for price driven strategies / indicators.BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
27 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
||
Started by wzgy0920, 02-22-2024, 01:11 AM
|
5 responses
32 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:33 PM
|
||
Started by wzgy0920, 04-23-2024, 09:53 PM
|
2 responses
49 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:29 PM
|
||
Started by Kensonprib, 04-28-2021, 10:11 AM
|
5 responses
193 views
0 likes
|
Last Post
by Hasadafa
Yesterday, 10:19 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,235 views
0 likes
|
Last Post Yesterday, 08:07 PM |
Comment