Dukascopy Support Board http://www.dukascopy.com/swiss/english/forex/jforex/forum/ |
|
Code works in Historical Tester while back testing but not in DEMO forward testing. http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=56064 |
Page 1 of 1 |
Author: | Chrysos [ Thu 11 Jan, 2018, 14:23 ] |
Post subject: | Code works in Historical Tester while back testing but not in DEMO forward testing. |
Hi, I have a strategy which works in Historical Tester while backtesting and when I run the strategy in DEMO Remote Server it exits. I believe the line in red is the problem as it runs properly when I remove it and hard code a value for pipAmount. The blue line is from the log of the backtest, showing that it works as expected by returning a value of 0.00009. API Version is 3.0.18. acc=USD ins=GBP/JPY getEquity=48935 getBalance=48935 slPips=0.24000 riskAmount=979 pipAmount=0.00009 pipValue=0.01000 slPips10=24.00000 riskPips=207.98489 lots=0.47000 riskPips2=200.49435 lots2=0.98000 position=0.66000 Here is the method and the erroneous line is below in red, basically the first line of code. Now is this a bug? It would seem so if it works in one environment and not another. double pipAmount = myJFUtils.convertPipToCurrency(tradeIns, myAccount.getAccountCurrency()); Thanks, Chrysos. private double calculatePosition(int posType, Instrument tradeIns, double getEquity, double entry, double slPips, double atrPips, double pipValue) throws JFException { |
Author: | API Support [ Fri 12 Jan, 2018, 17:37 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
Cannot reproduce. Please, provide strategy example. |
Author: | Chrysos [ Sun 14 Jan, 2018, 15:53 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
API Support wrote: Cannot reproduce. Please, provide strategy example. Hi and thanks for the response, I'd like to do that but I'd like to run the strategy with the latest API, but now that has given me trouble. Here's the errors I get. Description Resource Path Location Type It says line 8 of the POM file is in error. Line 8 is the 2nd line below. <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" |
Author: | API Support [ Mon 15 Jan, 2018, 09:31 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
For some reason Maven doesn't see JForex API jar file. 1)Check location('C:\Users\CHRYSOS\.m2\repository\com\dukascopy\api\JForex-API\2.13.46\JForex-API-2.13.46.jar') for the presence of jar file. 2)Open cmd from JForex SDK folder and do 'mvn clean install' |
Author: | Chrysos [ Mon 15 Jan, 2018, 11:45 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
Hi, I tried what you suggested - go to CMD in the JForex-3-SDK directory and it said command 'mvn' and 'mvn clean install' not a recognized internal, external or batch command. Here is what is in directory of C:\Users\CHRYSOS\.m2\repository\com\dukascopy\api\JForex-API\2.13.46 It seems the JForex-API-2.13.46.jar file has a Type of LASTUPDATED as well as .lastUpdated extension and the dates are 26/12/2017. Directory of C:\Users\CHRYSOS\.m2\repository\com\dukascopy\api\JForex-API\2.13.46 Can I back out of this and install the SDK as I did the very first time? I have the code saved elsewhere and I can just copy it. That means I would have to delete the .m2 directory and what else? Thanks, Chrysos. |
Author: | API Support [ Mon 15 Jan, 2018, 14:10 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
Seems like you have some problem with dependency references in pom.xml. Have you also updated JClient version? You can copy and post here all code inside <dependecies></dependecies> tags And i advise you to install Maven: https://maven.apache.org/install.html |
Author: | Chrysos [ Mon 15 Jan, 2018, 15:20 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
API Support wrote: Seems like you have some problem with dependency references in pom.xml. Have you also updated JClient version? You can copy and post here all code inside <dependecies></dependecies> tags And i advise you to install Maven: https://maven.apache.org/install.html I haven't updated the JClient but I did install Maven and run the command 'mvn clean install'. I now have 3 errors but importantly, my Java strategy is error free and compiles. However, it behaves worse than before. It only runs for a couple of minutes and stops even though I have commented the line I think is the problem. Now this line causes a problem. IBar prevBar = myHistory.getBar(instrument, period, OfferSide.BID, 1); - Description Resource Path Location Type 07:40:00 Strategy tester: com.dukascopy.api.JFException: Could not load bar for instrument [EUR/GBP], period [5 Mins], side [Bid], start time [2017.12.11 07:35:00 000], current bar start time [2017.12.11 07:40:00 000] @ cgm.EMA_MACD.onBar(EMA_MACD.java:296) Errors from build. Description Resource Path Location Type Please tell me how to completely uninstall everything so I can install it all again so I can start as new. I delete the workspace, then what about directory C:\Users\CHRYSOS\.m2, C:\Users\CHRYSOS\.jmc ? |
Author: | Chrysos [ Wed 17 Jan, 2018, 00:06 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
Alright, I've fixed the problems with the API, but the original strategy problem still stands. It runs in backtest, but not in real time DEMO. How can I look at the log of it running on real time DEMO? The logs in C:\Users\UserName\JForex\logs do not seem to show where the error occurs. Here is the error. I then comment some code out and get the second error - overload. What is wrong? How can I look at the logs to fix this? There appear to not be too be useful logs for Remote Server strategies. The strategy subscribes to 15 instruments. It would seem this might cause a problem, but why? 22:50:18 Strategy "EMA_MACD" is stopped at 2018-01-16 22:50:18.927 GMT on the remote server with parameters "MACD Multiplier:"=[0], "Period to use:"=[5 Mins], "Large MA Value:"=[89], "MACD MA Type:"=[SMA], "Medium MA Value:"=[21], "Use Large MA Filter:"=[false], "MACD signalPeriod:"=[8], "Slow MA Value:"=[55], "Log 2 Enabled:"=[false], "MA Type:"=[EMA], "RSI +/- 50:"=[0], "TP Multiplier:"=[1.5], "Take Profit:"=[0], "Fast MA Value:"=[13], "Log 3 Enabled:"=[true], "Begin Trade hour:"=[4], "Stop Loss:"=[0], "Trade weekends:"=[false], "MACD slowPeriod:"=[21], "SL Management:"=[2], "Instrument to use:"=[EUR/USD], "N Bars Forward:"=[5], "Control time:"=[false], "SL Type:"=[2], "SS +/- 80/20:"=[0.0], "SStoch fast K Period:"=[5], "Large MA Value:"=[SMA], "Log 1 Enabled:"=[false], "ATR Multiplier:"=[2.0], "End trade hour"=[21], "MACD fastPeriod:"=[8], "Positioning Type:"=[1], "Profit Percent:"=[0.7], "RSI Period:"=[15], "Increase Deposit:"=[40.0], "Risk % (100/risk):"=[2.0], "Max spread allowed:"=[4.0]. Reason: Strategy <EMA_MACD> is going to be stopped - due to caught exception from strategy. 23:12:40 Strategy "EMA_MACD" is stopped at 2018-01-16 23:12:40.816 GMT on the remote server with parameters "MACD Multiplier:"=[0], "Period to use:"=[5 Mins], "Large MA Value:"=[89], "MACD MA Type:"=[SMA], "Medium MA Value:"=[21], "Use Large MA Filter:"=[false], "MACD signalPeriod:"=[8], "Slow MA Value:"=[55], "Log 2 Enabled:"=[false], "MA Type:"=[EMA], "RSI +/- 50:"=[0], "TP Multiplier:"=[1.5], "Take Profit:"=[0], "Fast MA Value:"=[13], "Begin Trade hour:"=[4], "Stop Loss:"=[0], "Trade weekends:"=[false], "MACD slowPeriod:"=[21], "SL Management:"=[2], "Instrument to use:"=[EUR/USD], "N Bars Forward:"=[5], "Control time:"=[false], "SL Type:"=[2], "SS +/- 80/20:"=[0.0], "SStoch fast K Period:"=[5], "Large MA Value:"=[SMA], "Log 1 Enabled:"=[false], "ATR Multiplier:"=[2.0], "End trade hour"=[21], "MACD fastPeriod:"=[8], "Positioning Type:"=[1], "Profit Percent:"=[0.7], "RSI Period:"=[15], "Increase Deposit:"=[40.0], "Log 3 Enabled:"=[false], "Risk % (100/risk):"=[2.0], "Max spread allowed:"=[4.0]. Reason: Strategy <EMA_MACD> is going to be stopped - Max overload period exceeded : 60 seconds |
Author: | API Support [ Wed 17 Jan, 2018, 10:07 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
By this information isn't possible to identify problem. Write on [email protected]. Attach your strategy |
Author: | Chrysos [ Fri 19 Jan, 2018, 11:26 ] |
Post subject: | Re: Code works in Historical Tester while back testing but not in DEMO forward testing. |
Thanks, I am going to try to add some asynchronous coding for subscribing to instruments and getting historical data and then send the strategy to support. Regards, Chrysos. |
Page 1 of 1 |