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.

exchanging information between 2 strategies
 Post subject: exchanging information between 2 strategies Post rating: 0   New post Posted: Mon 13 Sep, 2010, 17:24 

User rating: 0
Joined: Mon 19 Apr, 2010, 13:51
Posts: 6
I need to exchange some information (integer or array of doubles) between 2 independently running strategies (on the same JForex platform).
What is the best (recommended) approach?

Thanks a lot in advance.
J.


 
 Post subject: Re: exchanging information between 2 strategies Post rating: 0   New post Posted: Tue 14 Sep, 2010, 08:51 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
there is no such one the BEST approach. It depends form situation and given task.
We have samples which stores data in a data base and in the file.
Please consider these links:


 
 Post subject: Re: exchanging information between 2 strategies Post rating: 0   New post Posted: Mon 20 Sep, 2010, 22:20 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
JKubalek,

You'd need to have some means of 'discovering' the existence of a running instance of some other strategy. The JForex API makes a function available for doing this:

Map<Long,IStrategy>  IClient::getStartedStrategies()
    Returns map with ids mapped to associated strategies


You could, in theory, iterate over that map and check to see if the IStrategy instance you get is the instance you're currently executing code from or not. If it is an instance of the strategy class you want to communicate with, have an interface in place for submitting information to the target strategy instance.

I have a strong suspicion this will only work during live testing and will not work correctly during a back test. I'd consider finding a better way to pull this off that allows all running strategies to work independently.

-Brian


 
 Post subject: Re: exchanging information between 2 strategies Post rating: 0   New post Posted: Mon 20 Jun, 2011, 17:53 

User rating: -
Support wrote:


I tried to use the code with Postgre instead of MySQL and took "Main.java" that comes with the JForex jars, to call the strategy "TestPosgreAcces.java".

It didn't work, returning an error when calling main method about log4j initialization.

Could you show me the way?

Thanks a lot.

Eduardo.


 

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