In an indicator: Getting Different Symbol (in Multicurrency) with a different time frame
In an indicator: Getting Different Symbol (in Multicurrency) with a different time frame
26 Oct 2020, 13:50
I am in an indicator for Symbol SMaster with TimeFrame TFMaster (this is the main instrument in the chart), I want to access:
- SMaster with TFSlave
- SSlave with TFSlave
Bars[] _sMasterTFSlaveBars;
Bars[] _sSlaveTFSlaveBars;
protected override void Initialize()
{
_sMasterTFSlaveBars = MarketData.GetBars(TFSlave, "SMaster");
_sSlaveTFSlaveBars = MarketData.GetBars(TFSlave, "SSlave");
}
public override void Calculate(int index)
{
int masterIndex = _sMasterTFSlaveBars.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
int slaveIndex = _sSlaveTFSlaveBars.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
}
My questions:
- Do I need to do this function to get the masterIndex as well as the slaveIndex?
- What is the difference between GetIndexByTime and GetIndexByExactTime, what should I use if I rely on 0 UTC on everything?
Replies
JeanPaul
26 Oct 2020, 15:23
RE:
PanagiotisCharalampous said:
Hi JeanPaul,
Do I need to do this function to get the masterIndex as well as the slaveIndex?
You need to do this for every TimeSeries coming from a different timeframe
What is the difference between GetIndexByTime and GetIndexByExactTime, what should I use if I rely on 0 UTC on everything?
GetIndexByExactTime will return -1 if there is no exact time match. GetIndexByTime will return the closest index.
Best Regards,
Panagiotis
Thank you for the prompt response.
@JeanPaul
PanagiotisCharalampous
26 Oct 2020, 14:16
Hi JeanPaul,
You need to do this for every TimeSeries coming from a different timeframe
GetIndexByExactTime will return -1 if there is no exact time match. GetIndexByTime will return the closest index.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous