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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment