Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Indicator question
Collapse
X
-
Indicator question
I have this indicator that calculates the ratio between two assets (the spread value). When I use this indicator in a strategy (calling the spread value) I get vastly different results from when I use closes[2][0]/closes[1][0] directly in the strategy. I used print statement to find that they return slightly different values. Why is this?Tags: None
-
Thanks, I see they are string properties.
-=o=-
Does your Strategy have the same calls to AddDataSeries as the Indicator?
Remember, when a Strategy references a Indicator using multiple data series,
the exact same data series must first be loaded by the hosting Strategy in its
own State.Configure.
Are you doing that?
Become an expert on the info here and here.
-=o=-
Btw, I recommend you keep the hardcoded values up to date with the current
contracts. I mean, there is no reason to have 5 year old expired contracts as
the default string values, right?
-=o=-
Also, I'd recommend you change your use of AddDataSeries to simply,
AddDataSeries(FirstInstrument);
AddDataSeries(SecondInstrument);
That assumes your primary chart is already a minute based chart (but I figure
it probably is since you're using BarsPeriod.Value from the primary chart,
and using that chart value doesn't make sense if your primary chart is not minute
based).
Just my 2˘.

Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
57 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
78 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
39 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
101 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
61 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment