+1 888 340 6572
MultiCharts Project Management
previous_open_issue.png
Go to the previous open issue
previous_issue.png
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
bug_report_small.png
Closed Bug report MC-2206

Bug with indicators called by Signal using additional BarsOfData

action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
next_issue.png
Go to the next issue (open or closed)
next_open_issue.png
Go to the next open issue
icon_info.png This issue has been closed with status "Released" and resolution "Not determined".
Description

Hi,
I've written and attached an example of a bug regarding the situation when an indicator refers to past data of itself, and it is called from a strategy using an alternate timeframe.
Example:
Indicator measure the slope of a moving average, by calculating Value[0] - Value[barsAgo]
This indicator works fine by itself, on any chart panel.
It works fine when called by a Signal on the primary bars.
It does not work properly when an additional bars series is the basis for the indicator. The lookback seems to be wrong; counting chart bars instead of the bars it is supposed to be calculating on.

File attached containing the indicator "MovAvg_Slope" and the signal "TEST_CalledIndicator".

This is for MultiCharts.NET, v 10.0 build 13630

Steps to reproduce this issue

Put two sets of data on a chart, e.g. primary bars EURUSD 60 minute, and a 2nd set of bars EURUSD 240 minute.

Put the indicator on twice, one for each set of data, for your eyeballs.

Put the signal on the primary bars and examine the text printed to the Output window of the code editor. You will see that the values for the 2nd Panel slope that the Signal gets are incorrect.

Comments (6)
#1
user-offline.png  MultiCharts Support (MultiCharts)
Mar 29, 2017 - 16:14
The reason of that behavior is that you do not have the same starting calculation point for the studies. Please set up identical MaxBarsBack for the indicators and the calculation results will be the same.
#2
user-offline.png  saltminer (saltminerbugreporter)
Mar 29, 2017 - 19:34

Thanks, but your answer doesn't make sense nor changes any result.
I set the MaxBarsBack of the Signal and the two chart indicators to 50, and got identical incorrect results.
Perhaps you have not actually looked at my coded example.

It is simple.

protected override void Create()
{
// create variable objects, function objects, order objects etc.
slopeIndicatorChart = (Indicator.Mov_Avg_Slope)AddIndicator(typeof(Indicator.Mov_Avg_Slope),1);
slopeIndicator2 = (Indicator.Mov_Avg_Slope)AddIndicator(typeof(Indicator.Mov_Avg_Slope),2);
}
protected override void StartCalc()
{
// assign inputs
slopeIndicatorChart.length = length;
slopeIndicatorChart.displace = displace;
slopeIndicatorChart.lookback = lookback;

        slopeIndicator2.length = length;
        slopeIndicator2.displace = displace;
        slopeIndicator2.lookback = lookback;

    }
    protected override void CalcBar()
    {
        Output.WriteLine(Bars.TimeValue+" Chart Slope "+slopeIndicatorChart.Plots[0].Values[0]+", 2nd Panel "+BarsOfData(2).TimeValue+" Slope "+slopeIndicator2.Plots[0].Values[0]);
    }

With this output I can check the values on the chart indicators visually against the values the Signal
receives from identically configured indicators it is accessing.
The indicator calculating on BarsOfData(2) is incorrect.

PLEASE REVISIT THIS ISSUE.

#3
user-offline.png  MultiCharts Support (MultiCharts)
Mar 30, 2017 - 13:08
We have tested it on our end and it is working fine. Please set the identical starting calculation point, so that the first calculation bar for studies matched. It can be achieved by modifying MaxBarsBack of the studies.
#4
user-offline.png  saltminer (saltminerbugreporter)
icon_reply.pngMar 31, 00:22, in reply to comment #3
Hi Alex, I'm afraid that for me, setting both bars series to 999 bars back, and with MaxBarsBack of the Signal and both indicators set to 50, I still get incorrect results. This 'solution' makes no sense to me anyway, mucking about with start times, because the calculation in question is a simple piece of arithmetic comparing a value now with a value 12 bars ago, of a simple moving average. The start time of this hundreds of bars ago is irrelevant. Please give me an email address so I can send you a screencap of what I'm talking about. By the way, I am a professional trading software developer so I'm not a complete dummy. Thanks, saltminer

Alex MultiCharts wrote:
We have tested it on our end and it is working fine. Please set the
identical starting calculation point, so that the first calculation bar for
studies matched. It can be achieved by modifying MaxBarsBack of the
studies.


#5
user-offline.png  MultiCharts Support (MultiCharts)
Mar 31, 2017 - 13:17
What you did is not exactly what I mentioned in the above comment. It is not saying that you need to set the identical MaxBarsBack, it says that you need to set identical starting calculation point, and that is a different thing from my first comment.
#6
user-offline.png  saltminer (saltminerbugreporter)
icon_reply.pngApr 01, 00:43, in reply to comment #5
Hi Alex, Yes, I have tried setting both of the bars series to the same start date and time. I have tried setting them both to BarsBack = 999. It makes no difference, and nor should it, since neither the start time nor MaxBarsBack has anything to do at all with this problem. An indicator with a MaxBarsBack of 50 should be easily able to reference a value only 12 bars ago. And, a simple moving average is not affected by its start time, and since we are using Minute bars, there is no variability of what the bars could be from a start time such as there could be on Tick or Volume or Range charts. So I am just not seeing any relevance of these instructions. The problem, as I experience it, is that an indicator hosted by a strategy on an additional timeframe cannot correctlyreference back x bars. It looks like it does "Chart Bars of x" not "its own bars of x". I have sent an email attention to you at the support email, with a screenshot clearly showing the problem.

Alex MultiCharts wrote:
What you did is not exactly what I mentioned in the above comment. It is
not saying that you need to set the identical MaxBarsBack, it says that you
need to set identical starting calculation point, and that is a different
thing from my first comment.


History
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    MultiCharts 10.0 (RELEASED)
  • Status
    Released
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Reproducability
    Not determined
Attachments (1)
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates