Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3766 Renko api is not working at all
 Post subject: JFOREX-3766 Renko api is not working at all Post rating: 0   New post Posted: Thu 03 May, 2012, 11:35 
User avatar

User rating: 1
Joined: Wed 18 May, 2011, 16:43
Posts: 10
Location: Czech Republic, Brno
Hello Dukascopy,

I would like to report the bug in implementation of renko bars.
I am able to report some specific bug because the renko bars are completely wrong - nothing is working as it should.

Please see following simple example:
package renkotest;

import com.dukascopy.api.*;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.IIndicators.MaType;
import com.dukascopy.api.feed.*;


public class RenkoTest implements IStrategy, IRenkoBarFeedListener {
       
   
    @Configurable("Instrument") public Instrument selectedInstrument = Instrument.EURUSD;
    @Configurable("OfferSide") public OfferSide selectedOfferSide = OfferSide.BID;
    @Configurable("Renko bar size (in pips)") public int selectedRenkoBarSizeInPips = 5;
    @Configurable("MA TimePeriod") public int selectedMATimePeriod = 14;
    @Configurable("MA Type") public MaType selectedMAType = MaType.EMA;
    @Configurable("MA Filter") public Filter selectedFilter = Filter.WEEKENDS;
   
    private IContext context;
    private IIndicators indicators;
    private IConsole console;
    private PriceRange selectedPriceRange;
    private IFeedDescriptor feedDescriptor;
   
   
    @Override
    public void onStart(IContext context) throws JFException {
        try {           
            if (context.getChart(selectedInstrument)==null) {
                throw new Exception("At first please open the "+selectedInstrument+" price chart in your JForex");
            }
            if (context.getChart(selectedInstrument).getPriceRange()==null) {
                throw new Exception("The "+selectedInstrument+" price chart has to be in RENKO BARS");
            }
            if (context.getChart(selectedInstrument).getPriceRange().getPipCount()!=selectedRenkoBarSizeInPips) {
                throw new Exception("The "+selectedInstrument+" RENKO bars has to have "+selectedRenkoBarSizeInPips+" pips size.");
            }
            this.context = context;
            this.indicators = context.getIndicators();
            this.console = context.getConsole();
            this.selectedPriceRange = PriceRange.valueOf(selectedRenkoBarSizeInPips);
            this.context.subscribeToRenkoBarFeed(selectedInstrument, selectedOfferSide, selectedPriceRange, this);
            this.feedDescriptor = new FeedDescriptor();
            feedDescriptor.setDataType(DataType.RENKO);
            feedDescriptor.setFilter(selectedFilter);
            feedDescriptor.setInstrument(selectedInstrument);
            feedDescriptor.setOfferSide(selectedOfferSide);
            feedDescriptor.setPriceRange(selectedPriceRange);
        } catch (Exception ex) {
            throw new JFException(ex.getMessage(), ex.getCause());
        }
    }

    @Override
    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }
    @Override
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
    @Override
    public void onMessage(IMessage message) throws JFException {
    }
    @Override
    public void onAccount(IAccount account) throws JFException {
    }
    @Override
    public void onStop() throws JFException {
    }

   
   
   
    @Override
    public void onBar(Instrument instrument, OfferSide offerSide, PriceRange brickSize, IRenkoBar bar) {
        try {
            if (instrument.equals(selectedInstrument) && offerSide.equals(selectedOfferSide) && brickSize.getPipCount()==selectedRenkoBarSizeInPips) {
                long time = bar.getTime();               
                double ma0 = (Double)indicators.calculateIndicator(feedDescriptor, new OfferSide[] {selectedOfferSide}, selectedMAType.name(), new AppliedPrice[] {AppliedPrice.CLOSE}, new Object[] {selectedMATimePeriod}, 0)[0];
                double[] array = (double[]) indicators.calculateIndicator(feedDescriptor, new OfferSide[] {selectedOfferSide}, selectedMAType.name(), new AppliedPrice[] {AppliedPrice.CLOSE}, new Object[] {selectedMATimePeriod}, 1, time, 0)[0];
                double ma1 = array[0];
                console.getOut().println("OPEN="+bar.getOpen()+" CLOSE="+bar.getClose()+" HIGH="+bar.getHigh()+" LOW="+bar.getLow()+"    ma0="+ma0+"    ma1="+ma1);
            }
        } catch (Exception ex) {
            console.getErr().println(ex.getMessage());
        }
    }
   
   
   
   
}


Try to use this example, try to run backtest with DEMO or LIVE platform, try tu live run the strategy in JForex and you will see - everything is wrong :)
Sometimes is not even possible to get the indicator values, sometimes (most of the time) the indicator values are not corresponding with the values on the price chart...

Can you please raise a ticket for your JForex platform developers to fix the bug in JForex? Because now it is completely useless.

Thank you
Have a nice day


 
 Post subject: Re: JFOREX-3766 Renko api is not working at all Post rating: 0   New post Posted: Thu 03 May, 2012, 16:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
In API 2.6.67


 

Jump to:  

  © 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