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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
66 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
149 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
99 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
286 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment