Dukascopy
 
 
Wiki JStore Search Login

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

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

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

getImage() undifined in Ichart
 Post subject: getImage() undifined in Ichart Post rating: 0   New post Posted: Thu 29 Dec, 2011, 17:03 

User rating: 0
Joined: Wed 21 Dec, 2011, 08:05
Posts: 2
Location: DE
Hi,

I wanted to creat a .png of my Char tusing the getImage() function. I always get the error: "The method getimage() is undefined for the type IChart"

my Code is just suppose to take a snapshot wen the API is launched:
package jforex;

import java.io.File;
import java.net.URL;
import java.util.Set;
import java.net.URLClassLoader;
import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IConsole;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.IChart;
import com.dukascopy.api.IChart.Type;
import com.dukascopy.api.*;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Library;
import com.dukascopy.api.Period;
import com.dukascopy.api.RequiresFullAccess;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.SwingConstants;
import com.dukascopy.api.*;
import com.dukascopy.api.IEngine.OrderCommand;
import com.dukascopy.api.drawings.IRectangleChartObject;

public class Image implements IStrategy {
   private IEngine engine;
   private IConsole console;
   private IHistory history;
   private IContext context;
   private IIndicators indicators;
   private IUserInterface userInterface;
    private IChart chart;
      @Configurable("Instrument")
   public Instrument instrument = Instrument.EURUSD;
   @Configurable("Period")
   public Period selectedPeriod = Period.FIVE_MINS;
   
   public void onStart(IContext context) throws JFException {
      this.console = context.getConsole();
      this.indicators = context.getIndicators();
      this.engine = context.getEngine();           
     this.history = context.getHistory();   
      this.chart = context.getChart(instrument);
     
        try {

   BufferedImage image = chart.getImage();
   ImageIO.write(image, "png", new File("pic.png"));
} catch (IOException e) {
     print("Fail");
}
       
   }

   public void onAccount(IAccount account) throws JFException {
   }

   public void onMessage(IMessage message) throws JFException {
   }

   public void onStop() throws JFException {
   }

   public void onTick(Instrument instrument, ITick tick) throws JFException {
   }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
    private void print(String str) {
        console.getOut().println(str);
    }
}


What did i forget? Thanks!!


 
 Post subject: Re: getImage() undifined in Ichart Post rating: 0   New post Posted: Fri 30 Dec, 2011, 08:37 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The method is currently available only in Standalone API (JForex API 2.6.50), it will be available in JForex Client with the next release.


 

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