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 SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
36 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
14 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
19 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
22 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment