I'm developing an indicator that needs an aditional Data Series, so, the code would be like:
.....
else if (State == State.Configure)
{
AddDataSeries(string instrumentName, Data.BarsPeriodType.Tick, 1597);
}
......
The question is.... what should I write in the code for "string instrumentName"?
I just want to add the data series for the same instrument where the indicator will be working.
For example, one time will be "ES 09-22", but later on, it will be "ES 12-22".
Or, could also be "NQ 09-22".
I thought about setting a variable which the user can change in the indicator properties, but another issue comes...
This indicator have to read historical data, which means that not only is necessary the data for the contract 09-22, but also 12-22, or even more (06-..., 03-..., etc.)
In other words, the indicator have to have available all data that is loaded in the chart, which could be two years.
Should I in that case add more than one data series like this?
...
else if (State == State.Configure)
{
AddDataSeries("ES 09-22", Data.BarsPeriodType.Tick, 1597);
AddDataSeries("ES 12-22", Data.BarsPeriodType.Tick, 1597);
.....
}
...
Or is there another way to do so?
The best result was setting blank the Data Series instrumentName, but in this case, the indicator throws an error on calling "Update" method at the bar where the contracts 09-22 and 12-22 overlaps.
If the data loaded in the chart owns just to one contract, for example 09-22, everything works fine.
...
else if (State == State.Configure)
{
AddDataSeries("", Data.BarsPeriodType.Tick, 1597);
}
...
Thanks in advance for your support.
Comment