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.
Task created
Status changed from New to Fixed
Attachment SQ.java added
Please download the attached file and replace the existing \extend\Code\JForex\SQ.java
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
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
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
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.