Dukascopy
 
 
Wiki JStore Search Login

Write in Excel (DDE)
 Post subject: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 07:32 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi

I have read the wiki instructions and followed them religiously

I have run the strategy as a local run

Nothing happens ?

Am I missing something ?

Java 6, excel opened pre platform opening


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 07:59 
User avatar

User rating: 11
Joined: Tue 05 Feb, 2013, 10:39
Posts: 104
Location: Romania, Iasi
If you want to use the strategy for the contest you need to upload it to their server.
Register for the contest, go to My strategies and select New strategy, and upload your java file with the strategy.
After that select the strategy and run it.
Make sure you check your strategy is working fine in the JForex platform before uploading.

Cheers

PS: Dunno what that excel is about, and if you run it in the platform and doesn't work there might be a problem with the logic in it. Feel free to post the strategy so we (the community) can check it and provide you with a solution if necessary.


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 08:03 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
No, I am not wishing to use this in the contest................

I am wishing to capture real time tick data over a period of hours - analyse the captured data and trade accordingly

But at the moment my opened excel file is receiving no data ?

Bob M


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 08:05 
User avatar

User rating: 11
Joined: Tue 05 Feb, 2013, 10:39
Posts: 104
Location: Romania, Iasi
I understand... you can post the strategy here and see if there's something wrong with it.


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 08:13 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
The java file I am running is exactly the one you find in the wiki Write in Excel (DDE)

I am trying to capture any real-time data but to no avail

Bob M


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 08:57 
User avatar

User rating: 11
Joined: Tue 05 Feb, 2013, 10:39
Posts: 104
Location: Romania, Iasi
Please provide a link or the actual file.

TY


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 09:06 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
package jforex;

import com.dukascopy.api.*;
import com.dukascopy.api.Configurable;
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.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
import com.pretty_tools.dde.client.DDEClientConversation;
import com.pretty_tools.dde.client.DDEClientException;

@Library("pretty-tools-JDDE-1.0.2.jar")



@RequiresFullAccess
public class UpdateExcel implements IStrategy {


@Configurable("CCY")
public Instrument insturment = Instrument.EURUSD;

@Configurable("Period")
public Period period = Period.TEN_SECS;

@Configurable("Select the starting row")
public int row = 1;
@Configurable("Select the starting column")
public int column = 1;
@Configurable("Type sheet name")
public String sheetName = "Sheet1";


private DDEClientConversation conversation;
private IConsole console;
private int counter;


@Override
public void onStart(IContext context) throws JFException {

conversation = new DDEClientConversation();
console = context.getConsole();
counter = 0;

try {
conversation.connect("Excel", sheetName);

} catch (DDEClientException e) {
print(e.toString());
}



}

public synchronized void onBar(Instrument instrument, Period period, IBar askBar,
IBar bidBar) throws JFException {

if (instrument == this.insturment && period == this.period) {

try {
conversation.poke(getCell(0),String.valueOf(bidBar.getOpen()));
conversation.poke(getCell(1),String.valueOf(bidBar.getHigh()));
conversation.poke(getCell(2),String.valueOf(bidBar.getLow()));
conversation.poke(getCell(3),String.valueOf(bidBar.getClose()));
conversation.poke(getCell(4),String.valueOf(bidBar.getVolume()));
conversation.poke(getCell(5),String.valueOf(bidBar.getTime()));

} catch (DDEClientException e) {

print(e.toString());
}

counter++;

}


}

@Override
public void onTick(Instrument instrument, ITick tick) throws JFException {



}

@Override
public void onAccount(IAccount account) throws JFException {

}


@Override
public void onMessage(IMessage message) throws JFException {

}


@Override
public void onStop() throws JFException {

}

public void print(String str) {

console.getOut().println(str);

}

public String getCell(int num) {


String str = "R" +(row+counter) + "C" + (column+num);

return str;
}
}


 
 Post subject: Re: Write in Excel (DDE) Post rating: 1   New post Posted: Mon 08 Jul, 2013, 11:01 
User avatar

User rating: 11
Joined: Tue 05 Feb, 2013, 10:39
Posts: 104
Location: Romania, Iasi
Interesting stuff.
Unfortunatelly I haven't worked with this before.
The idea is interesting, but I don't see the usefullness.
I'm not sure the JForex platform allows the data transfer to a .xls file.
Maybe Support can help you better.
Sorry.


 
 Post subject: Re: Write in Excel (DDE) Post rating: 0   New post Posted: Mon 08 Jul, 2013, 23:51 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hello Support:

Please can you suggest why I can not get any output from the program you have in wiki (I am using Java 6 and I have excel opened before I run the program)

Also can you advise modifications to :-

Output tick data (rather than bar data) e.g. TimeStamp (GMT), Price (bid), Price (ask), Volume (bid), Volume (ask)

Many thanks

Bob M


 

Jump to:  

  © 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