Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
CCI Negatove number issue
Collapse
X
-
Hello tkaboris,
Thanks for your note.
To understand why the script is behaving as it is, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.
Add prints outside of each condition that uses CCI() that prints out each value being used for the Period parameter of CCI() to see how each value is evaluating. Prints will appear in a New > NinjaScript Output window.
Once you determine which CCI() method is using a negative value for the Period parameter, you could modify the method to use a positive value of 1 or greater.
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
Please let me know if I may assist further.
-
Thanks for response. IN my logic long i have
&& (CCI(Close,CCIPeriodUsed)[0] > -CCIButtomLine) but I still get the error when trying to enable strategy.
I dont understand i specify for Period a positive number though
CCI has a top line and bottom line, +100 and -100. I need to use those levels
region CCI Indicator settings
CCITopLine = 100;
CCIButtomLine = -80;
CCIPeriodUsed = 7;
#endregionLast edited by tkaboris; 02-05-2023, 09:12 PM.
Leave a comment:
-
Hello tkaboris,
Thanks for your post.
This error indicates that you are using a Period value for your CCI() method that is outside of the acceptable range.
The CCI() method is only able to use a Period parameter of 1 or greater. Negative values cannot be used for the CCI() method's Period parameter.
For example, the CCI() method might look something like this where we use a value of 20 for the Period parameter.
CCI(Close, 20)[0]
The line of code to compare if the current CCI value is greater than -80 would look something like this.
if (CCI(Close, 20)[0] > -80)
{
//do something here
}
See this help guide page for more information: https://ninjatrader.com/support/help..._index_cci.htm
Let me know if I may assist further.
Leave a comment:
-
CCI Negatove number issue
HI I am writing a strategy and when i specified negative numbers in properties, it still doesnt allow me to get enabled, its complaining that Period is not valid number 1-999999. I am making a logic if close [0] and price is above CCIButtomLine -> long
private CCI CCITop;
private CCI CCIButtom;
private CCI CCIPeriod;
region CCI Indicator settings
CCITopLine = 100;
CCIButtomLine = -80;
CCIPeriodUsed = 7;
#endregion
CCITop = CCI(Close,(CCITopLine));
CCIButtom = CCI(Close,(CCIButtomLine));
CCIPeriod = CCI(Close,(CCIPeriodUsed));
region Properties
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name="CCI100TopLine", Order=1, GroupName="Parameters")]
public int CCITopLine
{ get; set; }
[NinjaScriptProperty]
[Range(-100, double.MaxValue)]
[Display(Name="CCI100ButtomLine", Order=2, GroupName="Parameters")]
public int CCIButtomLine
{ get; set; }
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name="CCIPeriod", Order=3, GroupName="Parameters")]
public int CCIPeriodUsed
{ get; set; }
[NinjaScriptProperty]
[Display(Name="Use CCI", Order=0, GroupName="Parameters")]
public bool UseCCI
{ get; set; }
#endregionLast edited by tkaboris; 02-05-2023, 10:56 AM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by aligator, 07-14-2025, 05:09 PM
|
0 responses
19 views
1 like
|
Last Post
![]()
by aligator
07-14-2025, 05:09 PM
|
||
Started by NTEducationTeam, 07-14-2025, 01:49 PM
|
0 responses
54 views
0 likes
|
Last Post
![]() |
||
Started by NTEducationTeam, 07-14-2025, 01:24 PM
|
0 responses
37 views
0 likes
|
Last Post
![]() |
||
Started by saltminer, 07-07-2025, 01:43 PM
|
1 response
141 views
0 likes
|
Last Post
|
||
Started by idude, 07-08-2025, 05:06 AM
|
0 responses
63 views
0 likes
|
Last Post
![]()
by idude
07-08-2025, 05:06 AM
|
Leave a comment: