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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
67 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
36 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
59 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment