V129 Friday Close Not Working jForex (in backtests and forward tests)

Running this one in jforex back tests (and also on live forward test) the Friday close is not always obeyed....it is often triggered (and the order closes) on the Sunday open candle instead.



Backtest over 1 Oct 2020 to 30 Nov 2020 on USDJPY H1 to see examples. One of the Friday Close @  2045 UTC  is successful, the others are not, triggering instead on the the Sunday Candle open.

Attachments
Strategy_3_58_105_USDJPY_Optimization_0_12_563.java
(106.68 KiB)
Strategy 358105 USDJPY.sqx
(373.50 KiB)
FRIDAY CLOSE Strategy_3_58_105_USDJPY_Optimization_0_12_563_JCLOUD copy.jfx
(83.14 KiB)
  • Votes 0
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

N
#1

nathan

30.11.2020 11:31

Task created

Thought this might be a no-data / candle thing with UTC0...but issue is there with Friday close at any time (I tried 1800 and 1000 and Friday close still did not execute consistently)
TT
#2

Tamas

01.12.2020 10:44

Status changed from New to Fixed

Attachment SQ.java added

SQ.java
(61.78 KiB)
Hello Nathan, there was a bug.


Please download the attached file and replace the existing \extend\Code\JForex\SQ.java

N
#3

nathan

04.12.2020 13:17

Attachment Strategy_3_58_105_USDJPY_POST_PATCH.java added

Attachment Strategy_3_58_105_USDJPY_PRE_PATCH.java added

Attachment Strategy 358105 USDJPY.sqx added

Strategy_3_58_105_USDJPY_POST_PATCH.java
(117.79 KiB)
Strategy 358105 USDJPY.sqx
(373.58 KiB)
Strategy_3_58_105_USDJPY_PRE_PATCH.java
(106.62 KiB)
Thanks Tamas.


I tried it, unfortunately it wont compile after patching. The errors below are generated after saving the strategy in v129302 after applying the patch.


12:05:04 ----------

12:05:04 3 problems (3 errors)

12:05:04 ----------

12:05:04 3. ERROR in /Users/xxxxxxxxxxxxxxxxx/Library/Application Support/JForex/xxxxxxxxxx/jfxide/tmp/compile/Strategy_3_58_105_USDJPY_POST_PATCH.java (at line 2149)

12:05:04 boolean value = cond[i];

12:05:04 ________________^^^^

12:05:04 cond cannot be resolved to a variable

12:05:04 ----------

12:05:04 2. ERROR in /Users/xxxxxxxxxxxxxxxxxxxxxxxx/Library/Application Support/JForex/xxxxxxxxxxxxxx/jfxide/tmp/compile/Strategy_3_58_105_USDJPY_POST_PATCH.java (at line 284)

12:05:04 order = sqOpenOrder(SELLSTOP, "Current", sqMMRiskFixedAccountPct("Current",SELLSTOP,(sqLowest("Current", 0, MEDIAN_PRICE, PeriodParam, 2) - (PriceEntryMult * roundValue(sqATR("Current", 0, MTATRPeriod2, 1)))),sqGetSLLevel("Current", SELLSTOP, (sqLowest("Current", 0, MEDIAN_PRICE, PeriodParam, 2) - (PriceEntryMult * roundValue(sqATR("Current", 0, MTATRPeriod2, 1)))), 1, StopLoss),mmRiskPercent,mmDecimals,mmStopLossPips,mmLotsIfNoMM,mmMaxLots), (sqLowest("Current", 0, MEDIAN_PRICE, PeriodParam, 2) - (PriceEntryMult * roundValue(sqATR("Current", 0, MTATRPeriod2, 1)))), MagicNumber, "", 0, true, false, null);

12:05:04 ________^^^^^^^^^^^

12:05:04 The method sqOpenOrder(IEngine.OrderCommand, String, double, double, int, String, long, boolean, boolean, Color, boolean) in the type Strategy_3_58_105_USDJPY_POST_PATCH is not applicable for the arguments (IEngine.OrderCommand, String, double, double, int, String, int, boolean, boolean, null)

12:05:04 ----------

12:05:04 1. ERROR in /Users/xxxxxxxxxxxxxxxxxxxx/Library/Application Support/JForex/xxxxxxxxxxxxxxx/jfxide/tmp/compile/Strategy_3_58_105_USDJPY_POST_PATCH.java (at line 254)

12:05:04 order = sqOpenOrder(BUYSTOP, "Current", sqMMRiskFixedAccountPct("Current",BUYSTOP,(sqHighest("Current", 0, MEDIAN_PRICE, PeriodParam, 2) + (PriceEntryMult * roundValue(sqATR("Current", 0, MTATRPeriod2, 1)))),sqGetSLLevel("Current", BUYSTOP, (sqHighest("Current", 0, MEDIAN_PRICE, PeriodParam, 2) + (PriceEntryMult * roundValue(sqATR("Current", 0, MTATRPeriod2, 1)))), 1, StopLoss),mmRiskPercent,mmDecimals,mmStopLossPips,mmLotsIfNoMM,mmMaxLots), (sqHighest("Current", 0, MEDIAN_PRICE, PeriodParam, 2) + (PriceEntryMult * roundValue(sqATR("Current", 0, MTATRPeriod2, 1)))), MagicNumber, "", 0, true, false, null);

12:05:04 ________^^^^^^^^^^^

12:05:04 The method sqOpenOrder(IEngine.OrderCommand, String, double, double, int, String, long, boolean, boolean, Color, boolean) in the type Strategy_3_58_105_USDJPY_POST_PATCH is not applicable for the arguments (IEngine.OrderCommand, String, double, double, int, String, int, boolean, boolean, null)

12:05:03 Compiling Strategy_3_58_105_USDJPY_POST_PATCH.java

12:00:15 Compilation successful. Strategy ID: 8E374C727C048441C79A410B87258603

12:00:14 Compiling Strategy_3_58_105_USDJPY_PRE_PATCH.java


TT
#4

Tamas

04.12.2020 13:54

Status changed from Fixed to In progress

TT
#5

Tamas

04.12.2020 14:12

Status changed from In progress to Fixed

The patch works only from version 130


Here is the link to download the newest version with the patch included 

https://cdn.strategyquantcdn.com/install/sq/SQX_130_Dev3_win.zip

N
#6

nathan

04.12.2020 15:20
Thanks, that's working.


One question, the Friday close condition is being evaluated 'on candle' as opposed to 'on tick' ?....I can only get the Friday close to close 'on the hour'....UTC 15:04 Friday close will close at UTC 16:00 for example?


Might be worth a note or restriction when using the jforex engine for building that Friday Close can only be set/executed on the hour...unless it is possible change the evaluation method of the condition to 'on tick', but that might be processor intensive I guess.







Votes: 0

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please