Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

Always profitable strategy (or ... incorrect overnight swaps in historic tester)
 Post subject: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Wed 26 Sep, 2018, 20:14 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
This bug is actually mentioned by SMARTFX here: https://www.dukascopy.com/swiss/english ... 728#p94070
Since I did not notice it as already reported here - I'll do it my self.
It looks like that problem is introduced in some of later versions of JForex.

Steps to reproduce

1. Open two positions with the same amount in opposite directions:
    @Configurable("Instrument")
    public Instrument instrument = Instrument.EURUSD;
       
    public void onStart(IContext context) throws JFException {
        this.engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;
        this.indicators = context.getIndicators();
        this.userInterface = context.getUserInterface();
       
        ITick lastTick = history.getLastTick(instrument);
        engine.submitOrder("BUY", instrument, OrderCommand.BUY, 1, lastTick.getAsk(), 0, 0, 0, 0, "");
        engine.submitOrder("SELL", instrument, OrderCommand.SELL, 1, lastTick.getBid(), 0, 0, 0, 0, "");
    }

2. Run it in historic tester and see how profit is going to you ..
Expected result - in real life this use-case actually should slowly eat your money each night because loss on negative swaps is always higher than profit on positive swaps.

Image


Attachments:
allways-profitable-strategy.png [29.73 KiB]
Downloaded 489 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: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Thu 27 Sep, 2018, 08:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Thanks for report. Yes, we know about this bug and now working on it.


 
 Post subject: Re: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Thu 25 Oct, 2018, 17:58 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 110
Location: Canada, Mission
The problem is not fixed after the last platform update today.



Order_BS_STAT_X2 strategy report for EUR/USD instrument(s) from 2018-08-31 21:00:00 to 2018-09-30 20:59:59
Account Currency USD
Initial deposit 50000
Finish deposit 53659.23
Turnover 2320510
Comission 41.77
Parameters

instrument EUR/USD
slippage 2.0
amount 1.0
takeProfitPips 0
slPips 0
startBuing true
startSelling true
ordNR 1

Instrument EUR/USD

First tick time 2018-08-31 21:00:00
First tick bid value 1.15997
First tick ask value 1.16054
Last tick time 2018-09-28 20:59:56
Last tick bid value 1.16019
Last tick ask value 1.16053
Positions total 2
Closed positions 0
Orders total 2
Bought 1.00
Sold 1.00
Turnover 2320510
Comission 41.77

Opened orders:

Label Amount Direction Open price Profit/Loss at the end Profit/Loss at the end in pips Open date Comment
EURUSD01540484275476 1.000 SELL 1.162174 1644 16.4 2018-08-31 21:00:10 SELL@Market0
EURUSD11540484275478 1.000 BUY 1.158133 2057 20.6 2018-08-31 21:00:10 BUY@Market1

Closed orders:

Label Amount Direction Open price Close price Profit/Loss Profit/Loss in pips Open date Close date Comment

Processing statistic:

Function Time Calls Percent
Ticks/Bars internal processing 18s 877.25ms 1983673 39.73%
Account information calculations 16s 279.94ms 2340098 34.26%
Ticks/Bars/Account Info data writing for charts 11s 607.97ms 2045082 24.43%
Conditional orders processing 427.66ms 1983674 0.9%
onTick method calls 181.42ms 1724474 0.38%
Margin call/cut checks 84.99ms 1899073 0.18%
onBar method calls 34.24ms 320608 0.07%
onAccount method calls 18.16ms 356402 0.04%
onMessage method calls 5.82ms 46 0.01%
onStart method calls 1.54ms 1 0%
Order changes processing "on server side" 1 0%
onStop method calls 1 0%
Ticks/Bars data reads 0 0%
Historical data calls (including indicators data calls) 0 0%
Indicator calculations 0 0%
User tasks (IContext.executeTask) processing 0 0%
Other operations 0 0%
Event log:

Time Event type Event text
2018-08-31 21:00:10 Order submitted Order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0 at 0.0] submitted by the strategy
2018-08-31 21:00:10 Order submitted Order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0 at 0.0] submitted by the strategy
2018-08-31 21:00:10 Order filled Order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0 at 1.15997] filled
2018-08-31 21:00:10 Order filled Order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0 at 1.16054] filled
2018-09-03 21:00:00 Commissions Commissions [41.77]
2018-09-03 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-03 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-04 21:00:00 Commissions Commissions [0.0]
2018-09-04 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-04 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-05 21:00:00 Commissions Commissions [0.0]
2018-09-05 21:00:00 Overnights Overnight commission [2.28] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-05 21:00:00 Overnights Overnight commission [-2.49] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-06 21:00:00 Commissions Commissions [0.0]
2018-09-06 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-06 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-07 21:00:00 Commissions Commissions [0.0]
2018-09-07 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-07 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-10 21:00:00 Commissions Commissions [0.0]
2018-09-10 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-10 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-11 21:00:00 Commissions Commissions [0.0]
2018-09-11 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-11 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-12 21:00:00 Commissions Commissions [0.0]
2018-09-12 21:00:00 Overnights Overnight commission [2.28] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-12 21:00:00 Overnights Overnight commission [-2.49] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-13 21:00:00 Commissions Commissions [0.0]
2018-09-13 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-13 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-14 21:00:00 Commissions Commissions [0.0]
2018-09-14 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-14 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-17 21:00:00 Commissions Commissions [0.0]
2018-09-17 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-17 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-18 21:00:00 Commissions Commissions [0.0]
2018-09-18 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-18 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-19 21:00:00 Commissions Commissions [0.0]
2018-09-19 21:00:00 Overnights Overnight commission [2.28] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-19 21:00:00 Overnights Overnight commission [-2.49] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-20 21:00:00 Commissions Commissions [0.0]
2018-09-20 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-20 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-21 21:00:00 Commissions Commissions [0.0]
2018-09-21 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-21 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-24 21:00:00 Commissions Commissions [0.0]
2018-09-24 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-24 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-25 21:00:00 Commissions Commissions [0.0]
2018-09-25 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-25 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-26 21:00:00 Commissions Commissions [0.0]
2018-09-26 21:00:00 Overnights Overnight commission [2.28] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-26 21:00:00 Overnights Overnight commission [-2.49] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-27 21:00:00 Commissions Commissions [0.0]
2018-09-27 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-27 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-09-28 21:00:00 Commissions Commissions [0.0]
2018-09-28 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-09-28 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]
2018-10-01 21:00:00 Commissions Commissions [0.0]
2018-10-01 21:00:00 Overnights Overnight commission [0.76] pips applied to order [EURUSD01540484275476, EUR/USD, SELL, 1000000.0]
2018-10-01 21:00:00 Overnights Overnight commission [-0.83] pips applied to order [EURUSD11540484275478, EUR/USD, BUY, 1000000.0]


Attachments:
Order_BS_STAT_X2.java [4.62 KiB]
Downloaded 243 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: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Fri 26 Oct, 2018, 18:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This bug took a more time than planned, we actively working on it and will try release fixed version ASAP.
We apologize for the inconvenience.


 
 Post subject: Re: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Tue 30 Oct, 2018, 15:01 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 110
Location: Canada, Mission
Thank you !
Today after the last update all my strategies don't work no more and all of them are returning the same error message:

21:00:00 Strategy tester: java.lang.NoClassDefFoundError: com/dukascopy/api/JFXInject @ com.dukascopy.api.impl.ez.a(L:12)


 
 Post subject: Re: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Wed 31 Oct, 2018, 10:22 
JForex Master
User avatar

User rating:
Joined: Wed 16 Sep, 2009, 18:23
Posts: 1048
Location: Geneva, Switzerland
Please update to version 3.4.10


 
 Post subject: Re: Always profitable strategy (or ... incorrect overnight swaps in historic tester) Post rating: 0   New post Posted: Sun 17 Mar, 2024, 22:54 
User avatar

User rating: 13
Joined: Mon 27 Jul, 2015, 16:30
Posts: 110
Location: Canada, Mission
Thank you ;)


 

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