Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Doubts about Detrend modes #476619
03/14/19 12:23
03/14/19 12:23
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
I have an strategy that exploits short term inefficiencies and I am using Detrend to find out if the performance is due to trend bias but I am not sure I understand correctly each Detrend type.

I have tested with Detrend equal TRADES, CURVE and INVERT and the system continue to be as profitable as it was.

But with Detrend equal PRICES, RECIPROCAL, SHUFFLE, SHUFFLE+CURVE the system lowered the profit or even became unprofitable. The problem is that I don't know if I understood the manual, according to it:
Quote:

For determining if a system's profit is caused by artifacts, temporarily set Detrend = SHUFFLE+CURVE and test. If the profit is caused by a real edge, it should then disappear.


Questions:

1) So, since with Detrend = SHUFFLE+CURVE the profit dissapeared, there is a real edge? Or the manual is wrong and is the other way round?

2) What does it mean that the profit decreases only in the case of Detrend=PRICES?

3) Since the strategy exploits short term inefficiencies, I am not concerned that it turns unprofitable with Detrend=SHUFFLE since it 'removes any short-term trends and correlations between the prices' according to the manual. I am right?

Here are the test results

Detrend=SHUFFLE+CURVE
Code:
Test shortterm1.0 

Simulated account   AssetsFix 
Bar period          1 hour (avg 87 min)
Test period         2013-01-02..2018-12-31 (36271 bars), detrended, shuffled
Lookback period     80 bars (3 days)
Simulation mode     Realistic (slippage 5.0 sec)

Gross win/loss      1701$ / -2267$ (-5854p)
Average profit      -94.45$/year, -7.87$/month, -0.36$/day
Max drawdown        -602$ -106.4% (MAE -616$ -108.9%)
Total down time     99% (TAE 65%)
Max down time       312 weeks from Jan 2013
Max open margin     201$
Max open risk       128$
Trade volume        1073555$ (179079$/year)
Transaction costs   -96.83$ spr, 11.18$ slp, -18.83$ rol
Capital required    627$

Number of trades    929 (155/year, 3/week, 1/day)
Percent winning     28.2%
Max win/loss        105$ / -17.85$
Avg trade profit    -0.61$ -6.3p (+67.1p / -35.1p)
Avg trade slippage  0.0120$ 0.1p (+2.9p / -1.0p)
Avg trade bars      39 (+76 / -25)
Max trade bars      747 (6 weeks)
Time in market      102%
Max open trades     17
Max loss streak     21 (uncorrelated 22)

Annual return       -15%
Profit factor       0.75 (PRR 0.68)
Sharpe ratio        -0.89
Kelly criterion     -5.27
R2 coefficient      0.830
Ulcer index         100.0%

Portfolio analysis  OptF  ProF  Win/Loss  Wgt%

EUR/USD avg         .000  0.55   76/212   52.9  
GBP/USD avg         .000  0.90   89/236   16.5  
USD/JPY avg         .000  0.74   97/219   30.6  

EUR/USD             .000  0.55   76/212   52.9  
EUR/USD:L           .000  0.54   34/101   24.0  
EUR/USD:S           .000  0.56   42/111   28.9  
GBP/USD             .000  0.90   89/236   16.5  
GBP/USD:L           .000  0.87   47/113   10.8  
GBP/USD:S           .000  0.93   42/123    5.7  
USD/JPY             .000  0.74   97/219   30.6  
USD/JPY:L           .000  0.69   42/105   17.2  
USD/JPY:S           .000  0.79   55/114   13.3



Detrend=PRICES , a bit of decrease of profitability
Code:
Test shortterm1.0 

Simulated account   AssetsFix 
Bar period          1 hour (avg 87 min)
Test period         2013-01-02..2018-12-31 (36271 bars), detrended
Lookback period     80 bars (3 days)
Montecarlo cycles   200
Simulation mode     Realistic (slippage 5.0 sec)

Gross win/loss      4383$ / -2633$ (+18116p)
Average profit      292$/year, 24.33$/month, 1.12$/day
Max drawdown        -535$ 30.6% (MAE -694$ 39.7%)
Total down time     77% (TAE 78%)
Max down time       66 weeks from Jan 2017
Max open margin     245$
Max open risk       2460$
Trade volume        943247$ (157342$/year)
Transaction costs   -78.44$ spr, -36.74$ slp, -69.41$ rol
Capital required    623$

Number of trades    783 (131/year, 3/week, 1/day)
Percent winning     42.3%
Max win/loss        110$ / -53.86$
Avg trade profit    2.24$ 23.1p (+137.1p / -60.3p)
Avg trade slippage  -0.0469$ -0.5p (+2.5p / -2.7p)
Avg trade bars      114 (+182 / -65)
Max trade bars      1055 (9 weeks)
Time in market      248%
Max open trades     17
Max loss streak     14 (uncorrelated 13)

Annual return       47%
Profit factor       1.66 (PRR 1.50)
Sharpe ratio        0.83
Kelly criterion     1.48
R2 coefficient      0.722
Ulcer index         17.5%

Confidence level     AR   DDMax  Capital

 10%                 53%   435   553$
 20%                 51%   468   576$
 30%                 49%   499   598$
 40%                 47%   539   626$
 50%                 45%   568   647$
 60%                 43%   604   672$
 70%                 41%   667   717$
 80%                 38%   742   770$
 90%                 35%   838   838$
 95%                 30%  1019   966$
100%                 20%  1713   1457$

Portfolio analysis  OptF  ProF  Win/Loss  Wgt%

EUR/USD avg         .210  1.33  101/151   18.7  
GBP/USD avg         .073  1.92  112/117   49.7  
USD/JPY avg         .097  1.78  118/184   31.5  

EUR/USD             .071  1.33  101/151   18.7  
EUR/USD:L           .353  1.80    5/14     1.3  
EUR/USD:S           .068  1.32   96/137   17.5  
GBP/USD             .144  1.92  112/117   49.7  
GBP/USD:L           .000  0.00    0/12    -0.9  
GBP/USD:S           .146  1.95  112/105   50.6  
USD/JPY             .180  1.78  118/184   31.5  
USD/JPY:L           .195  1.89  112/164   32.7  
USD/JPY:S           .000  0.67    6/20    -1.2



No Detrend
Code:
Test shortterm1.0 

Simulated account   AssetsFix 
Bar period          1 hour (avg 87 min)
Test period         2013-01-02..2018-12-31 (36271 bars)
Lookback period     80 bars (3 days)
Montecarlo cycles   200
Simulation mode     Realistic (slippage 5.0 sec)

Gross win/loss      5686$ / -3668$ (+20915p)
Average profit      337$/year, 28.05$/month, 1.29$/day
Max drawdown        -155$ 7.7% (MAE -262$ 13.0%)
Total down time     73% (TAE 83%)
Max down time       31 weeks from May 2017
Max open margin     245$
Max open risk       338$
Trade volume        1792956$ (299082$/year)
Transaction costs   -146$ spr, -67.29$ slp, -46.08$ rol
Capital required    355$

Number of trades    1494 (250/year, 5/week, 1/day)
Percent winning     39.3%
Max win/loss        123$ / -42.99$
Avg trade profit    1.35$ 14.0p (+100.4p / -41.9p)
Avg trade slippage  -0.0450$ -0.5p (+2.7p / -2.5p)
Avg trade bars      55 (+98 / -28)
Max trade bars      739 (6 weeks)
Time in market      230%
Max open trades     17
Max loss streak     23 (uncorrelated 16)

Annual return       95%
Profit factor       1.55 (PRR 1.44)
Sharpe ratio        1.20
Kelly criterion     1.52
R2 coefficient      0.874
Ulcer index         5.5%

Confidence level     AR   DDMax  Capital

 10%                 96%   148   350$
 20%                 92%   169   365$
 30%                 90%   181   373$
 40%                 88%   193   382$
 50%                 86%   208   392$
 60%                 84%   222   402$
 70%                 81%   238   414$
 80%                 78%   266   434$
 90%                 73%   309   464$
 95%                 69%   342   487$
100%                 61%   427   547$

Portfolio analysis  OptF  ProF  Win/Loss  Wgt%

EUR/USD avg         .126  1.43  171/273   22.2  
GBP/USD avg         .193  1.68  184/260   45.1  
USD/JPY avg         .174  1.51  232/374   32.7  

EUR/USD             .160  1.43  171/273   22.2  
EUR/USD:L           .030  1.06   80/131    1.3  
EUR/USD:S           .222  1.73   91/142   20.9  
GBP/USD             .202  1.68  184/260   45.1  
GBP/USD:L           .096  1.25   88/139    8.8  
GBP/USD:S           .289  2.20   96/121   36.3  
USD/JPY             .136  1.51  232/374   32.7  
USD/JPY:L           .320  2.25  110/166   29.6  
USD/JPY:S           .028  1.08  122/208    3.1



Thanks in advance!

PS: Is there a way to hide the code and when somebody wants to see it can be expanded? I remember there was a [hide] tag or something like that but it does not work.

Re: Doubts about Detrend modes [Re: Mithrandir77] #476640
03/18/19 07:40
03/18/19 07:40
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
A test with Detrend = SHUFFLE with no profit is indeed a hint that your strategy is good. But for really confirming an edge, a reality check with about 1000 tests should return a p-value below 5%. Use NumTotalCycles and plot a return histogram, then compare with the original return. Code for this is also in the black book.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1