Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to determine if a CCI value is above a line value not just the CrossAbove test?
Collapse
X
-
How to determine if a CCI value is above a line value not just the CrossAbove test?
I am attempting to determine if the CCI value on a bar close is above or below a certain value. I know you can test if it CrossAbove, but can you determine if the value is > than 30 or < than -30 on each bar close and then take some action?Tags: None
-
Calculate = Calculate.OnBarClose; // set this within OnStateChange(), if (State == State.SetDefaults)
if(CCI(14)[0] > 30)
{
//do something
}
if(CCI(14)[0] < -30)
{
//do something
}
Or you can combine if you need to.
if(CCI(14)[0] > 30 || CCI(14)[0] < -30)
{
//do something
}
14 is CCI period.
-
Hello gjbeaudin,
Thanks for your post.
Forum member Leeroy_Jenkins has provided the correct advice assuming you are creating the strategy in Ninjascript.
If you are using the Strategy Builder then in a sets conditions you would take the approach of:
Left side: Indicators>CCI
Center: Less or Greater
Right side: Misc>Numeric Value 30 or -30
The Calculate setting specifies how the code is to be run, using Calculate.OnBarClose means your strategy code is run once per bar at the end of the bar. This is the default setting in the strategy builder and can be changed in the "default properties" window of the strategy builder
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
88 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
135 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
119 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
69 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment