I have a problem returning correct values from a Data Series variable in a multi-series environment.
I have 4 charts in my workspace: 1, 3, 9 minute charts and a 144 tick chart. I created a custom indicator that determines the trend with CalculateOnBarClose(COBC) = true. In this indicator I created a public Data Series variable that contains the trend status; up or down. I applied this indicator to the minute charts.
I created another custom indicator that determines the trend agreement among the minute charts also with COBC = true. I added 3 objects to this indicator: 1, 3, and 9 minute charts creating a multi-series environment. This indicator accesses the public Data Series trend status variable from the trend indicator to build a trend agreement condition in order to plot a bar graph for the trend agreement among the 1, 3, and 9 minute charts. I apply this indicator to the tick chart. The trend agreement plot correctly plots the trend agreement as confirmed by visually comparing the trend status on the 1, 3, and 9 minute charts against the trend agreement plot.
So far so good, but a problem arises in my third custom indicator. I created another custom indicator to detect trade setup conditions to provide a setup alert. This indicator has COBC = false because my alerts need to detect intra-bar any valid setup conditions to be timely enough to respond and place an order. I apply this indicator to the tick chart. One of the conditions for this setup alert is the trend agreement status. But, this is where the problem occurs. The values returned from the same public Data Series trend status variable from the trend indicator are incorrect. If I set COBC = true then the values returned are correct. However, with COBC = true, the setup alerts will be too late since they will occur when the bar closes.
To troubleshoot this problem, I added Print statements to print out the values of the public Data Series trend status variable in both custom indicators, one with COBC = true and one with COBC = false. The public Data Series trend status variable comes from an indicator with COBC = true. The values printed with the same time stamp are different. The values printed from the indicator with COBC = true were correct. The values from the indicator with COBC = false were incorrect. But, once again, if I change COBC = true in the second indicator, then the values printed now are also correct.
Is it possible to access a public Data Series variable in a custom indicator with COBC = true from another custom indicator with COBC = false and get correct values returned? If so, what must I do to get correct values returned?
Thanks in advance for any assistance with this issue.
Steve
Comment