Dukascopy
 
 
Wiki JStore Search Login

My strategy is running for only one minute and stops on Ducakcopy server. Please fix the problem.
 Post subject: My strategy is running for only one minute and stops on Ducakcopy server. Please fix the problem. Post rating: 0   New post Posted: Tue 04 Jun, 2013, 15:14 
User avatar

User rating: 0
Joined: Sat 21 Apr, 2012, 20:28
Posts: 12
Location: Ireland, Dublin
Reason: Error in communication with the strategy
JForex v.2.25.1 DEMOSC06BPZuT 04.06.2013 08:53:52 04.06.2013 08:53:52 message Unable to connect. One minute timeout.
JForex v.2.25.1 DEMOSC06BPZuT 04.06.2013 06:54:16 04.06.2013 06:54:16 message Strategy "Tune_into.java" is stopped at 2013-06-04 06:54:15.136 GMT on the remote server with no parameters. Reason: Error in communication with the strategy
JForex v.2.25.1 DEMOSC06BPZuT 04.06.2013 06:43:08 04.06.2013 06:43:08 message Connected to d-ja-gva-91-191

Why I cannot start my strategy? It works perfectly in Stategy tester. I'm trying to start it since yesterday. I was never able to start it.
Is that compilation error or server error?
How I can investigate? It stays in running status for about minute and stops.

It works perfectly in historical tester.
I cannot try to correct it anymore as it was my 2nd change.

In the Activity Log I see this:
Strategy "Tune_into.java" is stopped at 2013-06-04 06:54:15.136 GMT on the remote server with no parameters. Reason: Error in communication with the strategy.


 
 Post subject: Re: My strategy is running for only one minute and stops on Ducakcopy server. Please fix the problem. Post rating: 0   New post Posted: Wed 05 Jun, 2013, 14:53 
User avatar

User rating: 2
Joined: Thu 19 May, 2011, 09:37
Posts: 86
Location: India, Chennai
bit funny and odd. First it missed the SL/TP settings. So I am down with negative points instead of plus. Secondly, the strategy is generating orders and submitting but nothing is shown in the system. It is working fine in local run. Anybody else have similar problems??


 
 Post subject: Re: My strategy is running for only one minute and stops on Ducakcopy server. Please fix the problem. Post rating: 0   New post Posted: Mon 10 Jun, 2013, 10:21 
User avatar

User rating: 2
Joined: Thu 19 May, 2011, 09:37
Posts: 86
Location: India, Chennai
Hello support,
My strategy seems running and identifying the trades but nothing happens..
I was only hoping that the week end would reset everything and strategy can be restarted.
Thanks in Advance

Image


Attachments:
strategy.png [120.69 KiB]
Downloaded 890 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: My strategy is running for only one minute and stops on Ducakcopy server. Please fix the problem. Post rating: 0   New post Posted: Tue 11 Jun, 2013, 06:50 
User avatar

User rating: 2
Joined: Mon 02 Jan, 2012, 06:15
Posts: 22
Location: Argentina, CORDOBA
while (this.order.getState() == IOrder.State.CREATED || this.order.getState() == IOrder.State.OPENED){
            order.waitForUpdate(2, TimeUnit.SECONDS, IOrder.State.FILLED );
}


If for some reason the order remains in state CREATED or OPENED, the above code is an infinite loop. You have to avoid potentially infinite loops.

if (this.order != null && order.isLong()){
                closeOrder();
                print("Long position closed as SELL opportunity identified");
}


Once every half hour when onBar is executed, the above code detects and attempts to close open order, but:

private void closeOrder() throws JFException{
        if (this.order.getState() == IOrder.State.FILLED){
            this.order.close();
            order.waitForUpdate(2, TimeUnit.SECONDS, IOrder.State.CLOSED);
        }
        if (order.getState() == IOrder.State.CLOSED){                                                           
            this.order = null;
        }
}


The closeOrder method code, close only filled trades, if not filled, the trade remains open. So you will be continuously repeated every half hour: "Long position closed as SELL opportunity identified"

This method should be:

private void closeOrder() throws JFException{
        if (order.getState() == IOrder.State.CLOSED){                                                           
            this.order = null;
        } else {
            this.order.close();
            order.waitForUpdate(2, TimeUnit.SECONDS, IOrder.State.CLOSED);
            this.order = null;
        }
}


Furthermore, the method isLong(), used in this way:

if (order.isLong()) ordps=1;
                    else ordps=-1;


It is not safe, and may cause errors when setting the TP and SL, should be implemented as follows:

if (order.getOrderCommand() == IEngine.OrderCommand.BUY) {
     ordps=1;
 } else if (order.getOrderCommand() == IEngine.OrderCommand.SELL) {
     ordps=-1;
 } else {
     break; //if not BUY or SELL you not want that the FOR loop continues.
}


Best Regards.


 
 Post subject: Re: My strategy is running for only one minute and stops on Ducakcopy server. Please fix the problem. Post rating: 0   New post Posted: Wed 12 Jun, 2013, 07:12 
User avatar

User rating: 2
Joined: Thu 19 May, 2011, 09:37
Posts: 86
Location: India, Chennai
thanks Sircris. It's always a learning curve.I appreciate your efforts and thanks once again.
rgds
ps: the same code is running in demo (remote) perfectly without any problem.


 

Jump to:  

cron
  © 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