Dukascopy
 
 
Wiki JStore Search Login

Heikin-Ashi separate window indicator is not shown since last update
 Post subject: Heikin-Ashi separate window indicator is not shown since last update Post rating: 0   New post Posted: Mon 30 Sep, 2013, 14:28 
User avatar

User rating: 1
Joined: Mon 15 Aug, 2011, 18:28
Posts: 6
Location: SwitzerlandSwitzerland
Hi

Need help from support or anybody who can help me. Since the last update I don't see my indicator anymore: "HeikenAshiSW" (in the JForex 1M Chart). I need this indicator. Why doesn't it show anymore or work anymore?

Thanks for any help on this matter.

Best regards
GaBe

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.GeneralPath;
import java.util.List;
import java.util.Map;

import com.dukascopy.api.IBar;
import com.dukascopy.api.ITick;
import com.dukascopy.api.OfferSide;
import com.dukascopy.api.indicators.IDrawingIndicator;
import com.dukascopy.api.indicators.IIndicator;
import com.dukascopy.api.indicators.IIndicatorContext;
import com.dukascopy.api.indicators.IIndicatorDrawingSupport;
import com.dukascopy.api.indicators.IMinMax;
import com.dukascopy.api.indicators.IndicatorInfo;
import com.dukascopy.api.indicators.IndicatorResult;
import com.dukascopy.api.indicators.InputParameterInfo;
import com.dukascopy.api.indicators.OptInputParameterInfo;
import com.dukascopy.api.indicators.OutputParameterInfo;

public class HeikenAshiSW implements IIndicator, IMinMax
{
    private static final int OPEN = 0;
    private static final int CLOSE = 1;
    private static final int HIGH = 2;
    private static final int LOW = 3;
    //private static final int VOLUME = 4;
   
    private IndicatorInfo indicatorInfo;
    private InputParameterInfo[] inputParameterInfos;
    private OutputParameterInfo[] outputParameterInfos;
    private OptInputParameterInfo[] optInputParameterInfos;
   
    private static final Color DIM_BLUE = new Color(51, 153, 255);
    private static final Color DIM_RED = new Color(222, 57, 57);
   
    private double[][][] inputs = new double[1][][];
    private double[][] outputs = new double[2][];
    private IIndicatorContext ctx;
   
    public void onStart(IIndicatorContext context)
    {
        ctx = context;
   
        indicatorInfo = new IndicatorInfo("HeikenAshiSW", "Heiken Ashi SW", "Custom", false, false, false, 1, 0, 2);
       
        inputParameterInfos = new InputParameterInfo[] {
                new InputParameterInfo("Price", InputParameterInfo.Type.PRICE)
        };
       
        outputParameterInfos = new OutputParameterInfo[] {
            new OutputParameterInfo("HA Bull", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.HISTOGRAM)
                {{
                     setColor(DIM_BLUE);
                     setShowValueOnChart(false);
                }},
            new OutputParameterInfo("HA Bear", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.HISTOGRAM)
                {{
                    setColor(DIM_RED);
                    setShowValueOnChart(false);
                }},
        };
    }

    public IndicatorResult calculate(int startIndex, int endIndex)
    {
        //calculating startIndex taking into account lookback value         
        if (startIndex - getLookback() < 0)
        {
            startIndex -= startIndex - getLookback();
        }
       
        if (startIndex > endIndex)
        {
            print(String.format("StartIndex[%d] > EndIndexx[%d]", startIndex, endIndex));
            return new IndicatorResult(0, 0);
        }

        int resIndex = 0;
        double haOpen, haClose /*, haHigh, haLow */;
        for(int i = startIndex; i <= endIndex; i++, resIndex++)
        {

            haOpen  = (inputs[0][OPEN][i - 1] + inputs[0][CLOSE][i - 1]) / 2;
            haClose =(inputs[0][OPEN][i] + inputs[0][HIGH][i] + inputs[0][LOW][i] + inputs[0][CLOSE][i]) / 4;
//            haHigh  = Math.max(inputs[0][HIGH][i], Math.max(haOpen, haClose));
//            haLow   = Math.min(inputs[0][LOW][i], Math.min(haOpen, haClose));
           
            if (haOpen < haClose)
            {
                outputs[0][resIndex] = 0.8;
                outputs[1][resIndex] = 0.0;
            }
            else
            {
                outputs[0][resIndex] = 0.0;
                outputs[1][resIndex] = 0.8;
            }                         
        }
       
        return new IndicatorResult(startIndex, resIndex);
    }


    public IndicatorInfo getIndicatorInfo() {
        return indicatorInfo;
    }

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

    public int getLookback() {
        return 1;
    }

    public int getLookforward() {
        return 0;
    }
   
    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 OptInputParameterInfo getOptInputParameterInfo(int index) {
        if (index <= optInputParameterInfos.length) {
            return optInputParameterInfos[index];
        }
        return null;
    }

    public void setOptInputParameter(int index, Object value) {

    }

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


   
    private void print(String txt)
    {
        ctx.getConsole().getOut().println(txt);
    }
   
   
    @Override
    public double[] getMinMax(int outputIdx, Object values,
            int firstVisibleValueIndex, int lastVisibleValueIndex)
    {
        // TODO Auto-generated method stub
        return new double[] { 1.0, 1.0 };
    }
}


Attachments:
HeikenAshiSW.java [5.3 KiB]
Downloaded 154 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: Heikin-Ashi separate window indicator is not shown since last update Post rating: 1   New post Posted: Tue 01 Oct, 2013, 11:56 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Just thoughts out of the blue...
- Have you recompiled since the update? (maybe there was a change regarding compiled indicators...)
- Are you able to recompile at all?
- If yes, are you able to load it as Custom Indicator to another chart with different timeperiod?


 
 Post subject: Re: Heikin-Ashi separate window indicator is not shown since last update Post rating: 0   New post Posted: Tue 01 Oct, 2013, 18:59 
User avatar

User rating: 1
Joined: Mon 15 Aug, 2011, 18:28
Posts: 6
Location: SwitzerlandSwitzerland
Hi

Many thanks for your thoughts. I tried to recompile but it didn´t work. It also didn´t work with other timeperiods. In the meantime I found another indicator (Heikin-Ashi) and it worked.

See attached.

Best regards
GaBe


Attachments:
Heiken Ashi_SWAlert.mq4 [4.79 KiB]
Downloaded 162 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.
 

Jump to:  

cron
  © 1998-2025 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