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.

print message when using remote run...
 Post subject: print message when using remote run... Post rating: 0   New post Posted: Wed 17 Jul, 2013, 13:07 

User rating: 0
Joined: Thu 30 Jun, 2011, 20:11
Posts: 41
Location: Spain,
Hi, I began today to remote run my strategy. I used to get my own strategy messages on my strategy tab. Now this tab doesnt appear. I would prefer anyway to get the messages on the messages tab. I use this method to print the messages:

public void print(String string)
{
this.console.getOut().println(string);
}

What should I do to get the messages on the Message Tab?

Thanks and sorry for the newbie question.


 
 Post subject: Re: print message when using remote run... Post rating: 0   New post Posted: Wed 17 Jul, 2013, 13:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
carlosfx wrote:
What should I do to get the messages on the Message Tab?
Go to Portfolio -> Strategy Log.


 
 Post subject: Re: print message when using remote run... Post rating: 0   New post Posted: Wed 17 Jul, 2013, 13:27 

User rating: 0
Joined: Thu 30 Jun, 2011, 20:11
Posts: 41
Location: Spain,
Thanks,

That's more that I had, but I'm supposed to react to a new message. Till now, the strategy tab changed its name to bold format and so I knew that there was a new message arising from the strategy. Is there any posibility to get those messages printed on the message tab, so I can realize that there are new messages as soon as they arise? Moreover, if they are printed on a tab opened on the computer from where I launch the strategy, I'm not able to see the messages from other computer. However, printing them on messages tab I could read them from every computer.

Thanks again


 
 Post subject: Re: print message when using remote run... Post rating: 0   New post Posted: Wed 17 Jul, 2013, 13:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
carlosfx wrote:
Is there any posibility to get those messages printed on the message tab, so I can realize that there are new messages as soon as they arise?
No, because the strategy does not get run on your local machine, but on the remote server.


 
 Post subject: Re: print message when using remote run... Post rating: 0   New post Posted: Sat 20 Jul, 2013, 13:51 

User rating: 1
Joined: Sun 22 Jul, 2012, 13:35
Posts: 40
carlosfx wrote:
Is there any posibility to get those messages printed on the message tab, so I can realize that there are new messages as soon as they arise?


Yes, it is possible! You can use broadcast messages in your strategy. Simple receiver will be running locally and will catch messages broadcast by strategy. You can filter messages from strategy by the topic. This way you can also set strategy parameters (variables) running remotely from local computer without stop strategy.

Note: Broadcast message can not be sent more than once in a second. This can be solved by using separate thread and the schedule at fixed rate with time period more than 1 second.


 
 Post subject: Re: print message when using remote run... Post rating: 0   New post Posted: Sun 21 Jul, 2013, 20:15 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
Ivan35 wrote:
Yes, it is possible! You can use broadcast messages in your strategy.
Perhaps you can clarify that by 'You can use broadcast messages' you really mean via something like sockets, email, HTTP, etc as if carlosfx's strategy is running remotely then the strategy container resides on a remote server while his messages tab is on and within the local JForex platform instance and therefore within a separate local strategy container.

According to the Wiki, broadcast messages (void broadcast(String topic, String message) throws JFException) only occur within the same strategy container (IEngine instance running within the same process).

Kindly confirm your previous post for the benefit of all.


 
 Post subject: broadcast message Post rating: 0   New post Posted: Mon 22 Jul, 2013, 18:58 

User rating: 1
Joined: Sun 22 Jul, 2012, 13:35
Posts: 40
Hi all,

Broadcast messages is usable within one account. If you broadcast message via IEngine.broadcast(...), the method onMessage(IMessage message) throws JFException is calling in all instances of running strategies.
So you can catch and manages this messages follows:

public void onMessage(IMessage message) throws JFException {
     if (message instanceof IStrategyBroadcastMessage) {
         IStrategeBroadcastMessage bMsg = (IStrategyBroadcastMessage) message;
         String topic = bMsg.getTopic();
         String content = bMsg.getContent();
         if (topic.contains("MY_EXTREME_PROFIT_STRATEGY") {    // for example
              if (topic.contains("ERR")) {
                  console.getErr(content);
              } else {
                  console.getOut(content);
              }
         }
       
     }
 }


You can use unique topic for every strategy to write strategy log into separate table.

Analogy, it is possible to send messages from local computer to other strategies runnings locally or remotely to set a variable or method call.
I hope all understand.


 
 Post subject: Re: print message when using remote run... Post rating: 0   New post Posted: Mon 23 Sep, 2013, 04:50 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
I have requested in a separate post, a description of the Remote Run environment,
and the various techniques or "best practices" which users should develop.

viewtopic.php?f=65&t=50076

I hope that Dukascopy will define the services which we can expect with a Remote Run
Strategy, so that we can better understand what we'll need to provide.

One example is communication outside of the Remote Server environment.

As posted in this thread, the IEngine.broadcast(...) is one fundamental method
of communicating among instances of strategies WITHIN A SINGLE ACCOUNT.
As for other forms, such as socket, common file folders, etc., they are mostly
impossible since the code is "sandboxed".

However, once again, if Dukascopy would document this very clearly then
users would understand what features we'll need to develop, and what features
are available in the Remote environment.

I'm currently developing around the IEngine.broadcast mechanism, for inter-Strategy
communication but that involves writing application specific communication
mechanisms, as has been noted earlier in this thread.

Strictly temporary files can be written by a Strategy instance, but these files
will be lost if there is any restart of the Strategy. These limitations need to be
clearly understood by developers, and "best practices" described.

HyperScalper


 

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