CalculateOnBarClose = true;
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
CalculateOnBarClose Question
Collapse
X
-
CalculateOnBarClose Question
Suppose I have the following in my code:
but let's say the user changes this to False in the Properties window. Which setting takes precedence? The code or the user property?Code:Tags: None
-
Is it possible to have my strategy disable the setting in the user interface to prevent the user from changing this?
Comment
-
There's no way to disable the setting, but you can read the property value in your code. You can basically disable any processing if it's not set as the script design requires.
Code:if(CalculateOnBarClose) DrawTextFixed("errorHandling", "This indicator is designed only for CalculateOnBarClose = false", TextPosition.TopRight); else { RemoveDrawObject("errorHandling"); //do the rest of your strategy logic here }Ryan M.NinjaTrader Customer Service
Comment
-
You cannot disable it in the user interface, but COBC is a property of the indicator/strategy, so you can override it.Originally posted by scottreynolds View PostIs it possible to have my strategy disable the setting in the user interface to prevent the user from changing this?
I usually do it on OnStartUp(), as that is more efficient; it is done once at the start. It can also be done in OnBarUpdate(), but then of course, you pay the (admittedly piddling) penalty of running that instruction on every tick. A small penalty to be sure, but I prefer to incur no penalties, unless I cannot help it. Just my coding style.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, Yesterday, 10:06 AM
|
0 responses
22 views
0 likes
|
Last Post
by argusthome
Yesterday, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
19 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
14 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
10 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
41 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment