Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

drawing indicator twice on one chart problem
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=56942
Page 1 of 1

Author:  ltklos [ Mon 25 Feb, 2019, 12:19 ]
Post subject:  drawing indicator twice on one chart problem

I've tried add to one chart two the same indicators drawing object (examples from https://www.dukascopy.com/wiki/en/development/indicator-api/examples/indicator-draws-chart-objects) on chart with diferent optional inpus. Unfortunatelly only one has been drawn correctly (with period 20), the second one (period 10) is not visible.
Image

There is something what sholud bee added to code to fix it?

Thank you so much in advance,
Lukas

Author:  Platform Support [ Wed 08 May, 2019, 09:35 ]
Post subject:  Re: drawing indicator twice on one chart problem

Please provide the code sample.

Author:  HarrisonFX [ Sat 15 Feb, 2020, 16:21 ]
Post subject:  Re: drawing indicator twice on one chart problem

I have a similar, if not the same problem. My indicator does not draw on the chart, but I call it twice from the strategy using different optional inputs. As you can see from the code sample below, I have different IIndicator objects (track2s and track2b) for a custom indicator Track2. Track2 accepts 1 optional input. In code below either 3.5 or 6.5. Despite all this, when I display the first output index from strategy, the values are the same! BUT, if I print from inside the custom indicator, each indicator value is different (correct) because OptionalInputs are different.

This problem is sooooo annoying!

           Object[] rngResult = indicators.calculateIndicator(
                this.rangeDescriptor,
                new OfferSide[] { OfferSide.BID },
                track2s.getIndicatorInfo().getName(),
                new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE},
                new Object[]{ 3.5 },
                0
            );
            loadArrays( rngResult, 0);
           
            Object[] rngResult2 = indicators.calculateIndicator(
                this.rangeDescriptor,
                new OfferSide[] { OfferSide.BID },
                track2b.getIndicatorInfo().getName(),
                new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE},
                new Object[]{ 6.5 },
                0
            );
            loadArrays( rngResult2, 1);

Author:  vadim_berezhnoj [ Wed 19 Feb, 2020, 11:18 ]
Post subject:  Re: drawing indicator twice on one chart problem

Hello.

To reproduce the issue please send source code of custom indicator and strategy to [email protected].

Kind regards, Support Team.

  Page 1 of 1