Libraries: BestInterval - page 9

 
fxsaber:

Yes, almost any TC has a beautiful picture in one or two clicks. The more beautiful it is, the more it compromises itself. So it's good for the bottom line.

But in reality, almost no one will do anything.

Yeah, the best thing to do is fuck everyone.

 

1. I run with default parameters, on the first pass I get OnTester Critical Error, line 53, as in the first comment



2. on the second pass optimisation works fine

2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   Profit = -9408.19 = -9408.19 + 0.00 (0.00%) - Amount of Delete Intervals = 0
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   00:00:00 - 23:59:59 : Profit = -9408.19 (100.00%), Total = 1552 (42.85%), PF = 0.27, Mean = -6.06, DD = 11981.00, RF = -0.79
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   SUMMARY: 00:00:00 - 23:59:59 : Profit = -9408.19 (100.00%), Total = 1552 (42.85%), PF = 0.27, Mean = -6.06, DD = 11981.00, RF = -0.79
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   Profit = 1832.70 = -9408.19 + 11240.89 (-119.48%) - Amount of Delete Intervals = 1
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   00:00:00 - 05:26:38 : Profit = 730.60 (39.86%), Total = 137 (41.61%), PF = 16.68, Mean = 5.33, DD = 38.25, RF = 19.10
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   15:43:31 - 23:59:59 : Profit = 1102.10 (60.14%), Total = 762 (41.60%), PF = 2.39, Mean = 1.45, DD = 400.95, RF = 2.75
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   SUMMARY: 00:00:00 - 23:59:59 : Profit = 1832.70 (100.00%), Total = 899 (41.60%), PF = 3.18, Mean = 2.04, DD = 400.96, RF = 4.57
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   Profit = 2272.64 = 1832.70 + 439.94 (24.01%) - Amount of Delete Intervals = 2
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   00:00:00 - 05:26:38 : Profit = 730.60 (32.15%), Total = 137 (41.61%), PF = 16.68, Mean = 5.33, DD = 38.25, RF = 19.10
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   15:43:31 - 18:15:27 : Profit = 1339.72 (58.95%), Total = 326 (48.16%), PF = 5.86, Mean = 4.11, DD = 156.95, RF = 8.54
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   21:07:40 - 23:59:59 : Profit = 202.32 (8.90%), Total = 157 (24.84%), PF = 14.31, Mean = 1.29, DD = 19.97, RF = 10.13
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   SUMMARY: 00:00:00 - 23:59:59 : Profit = 2272.64 (100.00%), Total = 620 (40.81%), PF = 7.74, Mean = 3.67, DD = 156.96, RF = 14.48
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   final balance - InitBalance (10000.00) + Profit (-9408.19) without BestInterval.
2018.10.20 00:02:35.785 Core 1  2017.05.16 15:49:00   OnTester - Profit (2272.64) with BestInterval.

3. I choose the interval with the highest profit and trade only in it, but trades are not opened, probably the library is trying to protect the user from playing with martin :)

if (!IsTradingTime(15, 45, 18, 15)) return; // 15:45 - 18:15

4. I choose the interval with average profit only, the Expert Advisor passes 2017 without a loss.

5. I switch to OOS, i.e. 2018, the interval is optimised for 2017, the Expert Advisor also passes through 2017 without crashing, although the profile drops significantly


 
...:

1. I run with default parameters, on the first pass I get OnTester Critical Error, line 53, as in the first comment

Closer to November I will see the reason.

3. I choose the interval with the highest profit and trade only in it, but trades are not opened, probably the library is trying to protect the user from playing with martin :)

This implementation of throwing out violates the logic of the original TS. This was mentioned by

Forum on trading, automated trading systems and testing trading strategies.

Libraries: BestInterval

fxsaber, 2018.10.18 10:28 AM

If the EA is not MT4-style, the library will use 90% of its capabilities. And intervals will be obtained. However, it will not be possible to see their application in the Tester at once. The programmer will have to invent something big for this purpose. That's why only MT4-style can reveal 100% of biblical possibilities.

So, either MT4-style or by yourself. Without virtual trading environment this task cannot be solved in general case.
 

Most likely the library will be finalised. Current status is beta.


SZY

1 undeleted objects left
1 object of type ORDERS left
504232 bytes of leaked memory

If such messages appear in the Tester, it is a bug of build 1930.

 
Checked all current functionality of bibla in MT4-tester. It works.
 
...:

1. I run with default parameters, on the first pass I get OnTester Critical Error, line 53, as in the first comment

It doesn't play.

 
fxsaber:
Checked all current functionality of bibla in MT4-tester. It works.

I made a cosmetic touch-up to make the output in the MT4-tester log correct. If you are interested in MT4, it looks like this


Calculated

BestInterval Action(true - single pass & MT4-style is required) = false

Profit = 196.25 = 196.25 + 0.00 (0.00%) - Amount of Delete Intervals = 0
00:00:00 - 23:59:59 : Profit = 196.25 (100.00%), Total = 1436 (70.19%), PF = 1.01, Mean = 0.14, DD = 3335.13, RF = 0.06
SUMMARY: 00:00:00 - 23:59:59 : Profit = 196.25 (100.00%), Total = 1436 (70.19%), PF = 1.01, Mean = 0.14, DD = 3335.13, RF = 0.06

Profit = 9111.81 = 196.25 + 8915.56 (4543.06%) - Amount of Delete Intervals = 1
00:00:00 - 02:53:38 : Profit = 7422.16 (81.46%), Total = 262 (86.26%), PF = 10.58, Mean = 28.33, DD = 127.97, RF = 58.00
17:45:41 - 23:59:59 : Profit = 1689.65 (18.54%), Total = 257 (67.32%), PF = 1.33, Mean = 6.57, DD = 1366.75, RF = 1.24
SUMMARY: 00:00:00 - 23:59:59 : Profit = 9111.81 (100.00%), Total = 519 (76.88%), PF = 2.56, Mean = 17.56, DD = 861.31, RF = 10.58

Profit = 10303.79 = 9111.81 + 1191.98 (13.08%) - Amount of Delete Intervals = 2
00:00:00 - 02:53:38 : Profit = 7422.16 (72.03%), Total = 262 (86.26%), PF = 10.58, Mean = 28.33, DD = 127.97, RF = 58.00
17:45:41 - 18:32:36 : Profit = 1558.95 (15.13%), Total = 44 (70.45%), PF = 2.35, Mean = 35.43, DD = 367.52, RF = 4.24
19:12:02 - 23:59:59 : Profit = 1322.68 (12.84%), Total = 189 (70.90%), PF = 1.57, Mean = 7.00, DD = 456.22, RF = 2.90
SUMMARY: 00:00:00 - 23:59:59 : Profit = 10303.79 (100.00%), Total = 495 (78.99%), PF = 3.42, Mean = 20.82, DD = 583.22, RF = 17.67

final balance - InitBalance (10000.00) + Profit (196.25) without BestInterval.
OnTester - Profit (10303.79) with BestInterval.
OnTester returns 10303.79000000000087
2714656 tick events (64659 bars, 2714756 bar states) processed in 0:00:40.670 (total time 0:00:41.169)


Applied


BestInterval Action(true - single pass & MT4-style is required) = true
Calculation time activated intervals is 2018.11.02 21:30:10 - Test (common folder)  ago.

Amount of Delete Intervals = 2
00:00:00 - 02:53:38 : Profit = 7422.16 (72.03%), Total = 262 (86.26%), PF = 10.58, Mean = 28.33, DD = 127.97, RF = 58.00
17:45:41 - 18:32:36 : Profit = 1558.95 (15.13%), Total = 44 (70.45%), PF = 2.35, Mean = 35.43, DD = 367.52, RF = 4.24
19:12:02 - 23:59:59 : Profit = 1322.68 (12.84%), Total = 189 (70.90%), PF = 1.57, Mean = 7.00, DD = 456.22, RF = 2.90
SUMMARY: 00:00:00 - 23:59:59 : Profit = 10303.79 (100.00%), Total = 495 (78.99%), PF = 3.42, Mean = 20.82

final balance - InitBalance (10000.00) + Profit (10351.44) with BestInterval.
OnTester - Virtual InitBalance (10000.00) + Profit (5003.00) without BestInterval. Profit is calculated with TickValue=1 and w/o Commission+Swap.
OnTester returns 15003.00000000000000

2714862 tick events (64668 bars, 2714962 bar states) processed in 0:00:30.997 (total time 0:00:31.434)


The highlighted does not match. I haven't analysed the reasons.


ZY The second variant was calculated 25% faster.

 

In MT5-Hedge, limit orders are sliding, this creates tester grails, which can't help but be annoying.

Switching to MT5-Exchange-Netting solves this problem. But there TP will still be sliding. So they have to be replaced by limit trades. Which may well generate in/out trades that MT4Orders don't see in the current implementation...


So we had to learn how to calculate and apply BestInterval on MT5-Exchange-Netting, where the grail is much more difficult to create. It turned out that this task is solvable, but only within MT5, because MT5-tester, unlike MT4-tester, allows working with a timer. And there is no way to work with limit trades without a timer. In general, it is difficult to explain all the pitfalls to an ordinary person. In the end, it turned out like this


Calculated

BestInterval Action(true - single pass & MT4-style is required) = false

Profit = 18238.00 = 18238.00 + 0.00 (0.00%) - Amount of Delete Intervals = 0 (2018.07.01 - 2018.11.08)
00:00:00 - 23:59:59 : Profit = 18238.00 (100.00%), Total = 1618 (71.76%), PF = 1.46, Mean = 11.27, DD = 2286.00, RF = 7.98
SUMMARY: 00:00:00 - 23:59:59 : Profit = 18238.00 (100.00%), Total = 1618 (71.76%), PF = 1.46, Mean = 11.27, DD = 2286.00, RF = 7.98

Profit = 22915.00 = 18238.00 + 4677.00 (25.64%) - Amount of Delete Intervals = 1 (2018.07.01 - 2018.11.08)
00:00:00 - 10:18:47 : Profit = 3586.00 (15.65%), Total = 306 (72.22%), PF = 1.49, Mean = 11.72, DD = 1117.00, RF = 3.21
11:17:57 - 23:59:59 : Profit = 19329.00 (84.35%), Total = 1134 (73.28%), PF = 1.87, Mean = 17.04, DD = 1204.00, RF = 16.05
SUMMARY: 00:00:00 - 23:59:59 : Profit = 22915.00 (100.00%), Total = 1440 (73.06%), PF = 1.77, Mean = 15.91, DD = 1331.00, RF = 17.22

Profit = 24543.00 = 22915.00 + 1628.00 (7.10%) - Amount of Delete Intervals = 2 (2018.07.01 - 2018.11.08)
02:50:42 - 10:18:47 : Profit = 4854.00 (19.78%), Total = 280 (75.36%), PF = 1.86, Mean = 17.34, DD = 683.00, RF = 7.11
11:17:57 - 23:53:05 : Profit = 19689.00 (80.22%), Total = 1130 (73.36%), PF = 1.90, Mean = 17.42, DD = 1204.00, RF = 16.35
SUMMARY: 00:00:00 - 23:59:59 : Profit = 24543.00 (100.00%), Total = 1410 (73.76%), PF = 1.89, Mean = 17.41, DD = 1279.00, RF = 19.19
BestInterval is saved in "Test"-file in common(MT5)/base(MT4) folder.

final balance - InitBalance (10000.00) + Profit (18238.00) without BestInterval.
OnTester - Profit (24543.00) with BestInterval.
final balance 28238.00 USD
OnTester result 24543
Test passed in 0:00:00.639 (including ticks preprocessing 0:00:00.078).


Applied


BestInterval Action(true - single pass & MT4-style is required) = true
Calculation time activated intervals is 2018.11.08 15:09:56 - Test (common folder) 00:31:30 ago.

Amount of Delete Intervals = 2 (2018.07.01 - 2018.11.08)
02:50:42 - 10:18:47 : Profit = 4854.00 (19.78%), Total = 280 (75.36%), PF = 1.86, Mean = 17.34, DD = 683.00, RF = 7.11
11:17:57 - 23:53:05 : Profit = 19689.00 (80.22%), Total = 1130 (73.36%), PF = 1.90, Mean = 17.42, DD = 1204.00, RF = 16.35
SUMMARY: 00:00:00 - 23:59:59 : Profit = 24543.00 (100.00%), Total = 1410 (73.76%), PF = 1.89, Mean = 17.41

final balance - InitBalance (10000.00) + Profit (24543.00) with BestInterval.
OnTester - Virtual InitBalance (10000.00) + Profit (18216.00) without BestInterval. Profit is calculated with TickValue=1 and w/o Commission+Swap.
final balance 34543.00 USD
OnTester result 28216
Test passed in 0:00:00.749 (including ticks preprocessing 0:00:00.078).


In the logs I emphasised (in yellow) that backtest on four months in "real ticks" mode with > 1000 trades and many thousands of OrderSend + calculation (and application) of the best interval takes less than a second.

 

For Market fans. You can take absolutely any EA (MT4-style) and make it "beautiful" in a few seconds, just throw out more bad intervals. The library will do everything automatically.


Before



After (the task is to throw out 20 intervals - the more the prettier).



I don't use more than two intervals myself. If you are writing for your own trading and not for the Market, take low values.

[Deleted]  
Don't offer opium to a nation of marquette lovers ))