Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IIndicatorChartPanel's Vertical Autoscale
 Post subject: IIndicatorChartPanel's Vertical Autoscale Post rating: 0   New post Posted: Tue 27 Jan, 2015, 14:51 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
Vertical Autoscale system of IIndicatorChartPanel is something weird at one pattern value.

e.g.
When the indicator value has 2 pattern values(50 & 100), that value shows up on indicator panel.
Image


But, when the indicator value has only 1 pattern values(All 50), that value didn't shows up on indicator panel.
Image

Sample IIndicator is as below,
package jforex;

import com.dukascopy.api.indicators.*;

public class SampleIIndi implements IIndicator {
    private IndicatorInfo indicatorInfo;
    private InputParameterInfo[] inputParameterInfos;
    private OptInputParameterInfo[] optInputParameterInfos;
    private OutputParameterInfo[] outputParameterInfos;
    private double[][][] inputs = new double[1][][];
    private int p = 1;
    private double[][] outputs = new double[1][];
   
    public void onStart(IIndicatorContext context) {
        indicatorInfo = new IndicatorInfo("Sample", "Sample IIndicators", "My indicators",
                false, false, false, 1, 1, 1);
        inputParameterInfos = new InputParameterInfo[] {new InputParameterInfo("Input data", InputParameterInfo.Type.PRICE)};
        final int ONE_PATTERN = 0, TWO_PATTERN = 1;
        optInputParameterInfos = new OptInputParameterInfo[] {
            new OptInputParameterInfo("Pattern", OptInputParameterInfo.Type.OTHER, new IntegerListDescription(TWO_PATTERN , new int[]{TWO_PATTERN,  ONE_PATTERN}, new String[]{"50 & 100", "All 50"})),
            };
        outputParameterInfos = new OutputParameterInfo[] {new OutputParameterInfo("out", OutputParameterInfo.Type.DOUBLE,
                OutputParameterInfo.DrawingStyle.LINE)};
    }

    public IndicatorResult calculate(int startIndex, int endIndex) {
        //calculating startIndex taking into account lookback value
        if (startIndex - getLookback() < 0) {
            startIndex -= startIndex - getLookback();
        }
        int i, j;
        final double[] VALUES = {50,100};
        for (i = startIndex, j = 0; i <= endIndex; i++, j++) {
            outputs[0][j] = VALUES[(i & p)];
        }
        return new IndicatorResult(startIndex, j);
    }

    public IndicatorInfo getIndicatorInfo() {
        return indicatorInfo;
    }

    public InputParameterInfo getInputParameterInfo(int index) {
        if (index <= inputParameterInfos.length) {
            return inputParameterInfos[index];
        }
        return null;
    }

    public int getLookback() {
        return 0;
    }

    public int getLookforward() {
        return 0;
    }

    public OptInputParameterInfo getOptInputParameterInfo(int index) {
        if (index < optInputParameterInfos.length) {
            return optInputParameterInfos[index];
        }
        return null;
    }

    public OutputParameterInfo getOutputParameterInfo(int index) {
        if (index < outputParameterInfos.length) {
            return outputParameterInfos[index];
        }
        return null;
    }

    public void setInputParameter(int index, Object array) {
        inputs[index] = (double[][]) array;
    }

    public void setOptInputParameter(int index, Object value) {
        p = (Integer) value;
    }

    public void setOutputParameter(int index, Object array) {
        outputs[index] = (double[]) array;
    }
}


best regards


Attachments:
50and100.png [21.04 KiB]
Downloaded 173 times
50.png [19.3 KiB]
Downloaded 287 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: IIndicatorChartPanel's Vertical Autoscale Post rating: 0   New post Posted: Wed 28 Jan, 2015, 08:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We will investigate.


 
 Post subject: Re: IIndicatorChartPanel's Vertical Autoscale Post rating: 0   New post Posted: Thu 29 Jan, 2015, 12:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
If indicator maximal and minimal output values are equal output is not displayed. Please make sure that there are at least two different vales in the output.


 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com