Re: Definition of insanity...looking for some guidance

sleytus wrote:

RE: Market conditions -- lately they have been crazy.  Not only the war in Ukraine but also last week Japan propping-up the Yen (for the first time in 24 years) and this week UK doing the same for the pound.  There have been events this year that never occurred before -- and there are people who believe that using last year's data will make their algorithm trade smarter tomorrow?  I don't know...

Totally agree with you on this one!  Bonkers time.

27 (edited by timelleston 2022-09-29 10:42:10)

Re: Definition of insanity...looking for some guidance

sleytus wrote:

Here's a test -- I hope I'm not burdening you.  It's been many years since I last used Excel...

Repeat your tests using CADJPY / M15 with a maximum of 300 bars.  300 bars is the fewest bars allowed by EA Studio.  No Reactor, no optimization, no OOS -- just the Generator.  Let it run for a couple of hours and sort on SQN, move the top 50 strats to a portfolio...

No burden at all.  I'll use 300 bars and I'll set up 5 rolling periods of 300 bars each, through to 27th.  Leave it with me.

28

Re: Definition of insanity...looking for some guidance

I tried to follow your way of thinking.
So, I made a run using more bars for same period. 3x300=900 bars
M5. I work on it.

Re: Definition of insanity...looking for some guidance

Ok, so my End Date Limit Data Horizons are as follows (each with 300 bars):

7 Sept
10 Sept
15 Sept
21 Sept
26 Sept

That gives each run 300 bars back in time from those dates, which almost overlaps on the start dates.

Strategy Properties:
Entry Lots: 0.1
Direction: Long and Short
Opposite Signal: Ignore or Reverse
Stop Loss: Always use, Fixed, 95 & 95
Take Profit: Always use, Fixed, 95 & 95  (I'd normally change these a bit, but these will do for the test)

Generator Properties:
Search best: Net Balance
Out of Sample: In sample
Max Entry: 4
Max Exit: 2
Validation: Use common acceptance is ticked

Common Acceptance is:
Complete Backtest:
Min Win/Loss: 0.6
Min Net Profit: 10
Min R-Squared: 70

Cooking 5 portfolios now for 120 minutes...

Once cooked, I'll set Sort Collection by System Quality Number, and move the Top 50 to Portfolio, then download into MT5 and run backtest on Every Tick based on real Ticks, using the same start dates as the Portfolio was generated on, but the end date will be 29th Sept...so we get the "real-data" into the portfolios.

Cooking now smile

30 (edited by timelleston 2022-09-29 13:49:13)

Re: Definition of insanity...looking for some guidance

Ok, we're all cooked up here (stopped at 1 hour), and my eyes + brain has melted down.

I actually can't believe the results.  They're really good.  I stand corrected Sleytus.  Each time-frame generally stood up for at least another 5 days.  Some more.

See the chart attached below.

I've re-aligned the dates so that each In Sample result starts at the same point - day 1.  Each run had 4 "days" of data as In Sample.  Some had slightly less, which is possibly why a couple of the results are lower.

Once they cross the vertical dotted red line, they're "in market".  This was the date the EAS generation stopped, but continued using data in MT5, up until midnight 28th...which allowed the last period to run for 3 additional days.

The blue dotted line would be the profit from closed positions if each strategy were stopped on the 3rd day.  Note that I haven't taken into account any open positions that would be closed if that approach was taken.  But given the drawdowns were marginal during those periods, I don't believe it would have made too much impact on the net profit.

So, that's another very interesting result.  Bear in mind also that these results are converted back into AUD as the account currency.

And I'm now curious if different pairs react better to algo-trading - maybe AU doesn't, but CJ does.

Oh man, another rabbit hole!

So, Sleytus, thank you - you've taught me something tonight.

Post's attachments

Screen Shot 2022-09-29 at 10.44.09 pm.png 260.76 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Definition of insanity...looking for some guidance

Very, very cool -- thanks for performing the tests...

If you compare different pairs I think you'll find that CJ lends itself best.  GJ also works, but sometimes DD can get a bit hairy...

EA Studio is the magic sauce since it allows us to create new portfolio EAs at the press of a button.  Even if a portfolio EA could survive a few days I still substitute with a new one every day starting a few hours prior to London Open.  And if there are Open trades then I set Max Open Trades to '0' for the decaying EAs and let those close gracefully.  I also use broker data because it is more up-to-date.  Premium Data lags behind by about 4 hours -- and because my data horizon is so short then every hour counts...

One last point -- I only provided very crude instructions -- i.e. CJ / M15 / 300 bars.  There are many other configuration settings in EA Studio where we probably differ.  Yet, you still saw decent results.  That is an indication this approach is robust and doesn't necessarily rely on fine tuning...

Re: Definition of insanity...looking for some guidance

Good stuff Sleytus.  I will continue down the rabbit hole, and will experiment more with CJ and others.

Its certainly an awesome bit of software - there is no other that makes the generation so easy and quick.  Some of the periods I used y/day had over a million strategies tested and ascended over 4000 in about an hour - whittled down to the top 300 in the collection, and then down to the top 50 in the portfolio.  Incredible stuff. 

Happy trading.

Re: Definition of insanity...looking for some guidance

Great conversation here timelleston and Sleytus.

From your conversation and personal experience, here is a summary of my deductions:

- the strategies survives approx 1-2 days after IS
- best to create new portfolio everyday to capture the 1-2 days performance period
- no need to complicate the process. whether with or without OOS, the pattern of performance seems to be the same

Re: Definition of insanity...looking for some guidance

timelleston wrote:

Ok, so re-ran a generation, with 20% OOS on 1000 bars, from 30th Aug to 13 Sept.

Same process as above - plotted it in Excel.

Identical results as before.

The OOS slope matches the IS slope.  As soon as OOS finishes, it crashes.

I'm sorry, but that cannot be market conditions.  It was 2 days apart.  That would mean that the market conditions has coincidentally significantly changed every time at the end of OOS. Thats not likely.

If the strategy is generated on 80% data, and the generator never sees the 20% OOS data, there's no way these can continuously repeat themselves in their results i.e. OOS slope consistent until end of OOS, then it caves in. 

And, I re-ran this on 300 bars, and on 500 bars, it did exactly the same.  OOS fine, end of OOS performance crashed.  I'm sorry, but that doesn't make sense.  It's too consistent.


Mr Popov, can you please confirm that the Generator and Reactor do not see/use OOS data in the generation of strategies, when you select an OOS percentage?

My 2 cents. This exemplifies how OOS usage turns out-of-sample data into in-sample data. And using the same OOS data for all strats brings about another minus - that is biasing the strats to the underlying OOS data set.

Re: Definition of insanity...looking for some guidance

Right... 

But not only that OOS doesn't help -- neither does optimizing historical data.  The only data that matters is just enough to capture current market conditions and satisfies the Generator's minimal data requirements...

footon wrote:

My 2 cents. This exemplifies how OOS usage turns out-of-sample data into in-sample data. And using the same OOS data for all strats brings about another minus - that is biasing the strats to the underlying OOS data set.

Re: Definition of insanity...looking for some guidance

That is another point for debate! Generator in essence still uses optimization, the fact that it throws indis with different parameter values at the data is still a form of optimization. If default values would be used then it is still a form of optimization - a passive one. Where's the right balance?

OOS is not useless, but to me it is acceptable only in checking the methodology, not as a filter for strats.

sleytus wrote:

Right... 

But not only that OOS doesn't help -- neither does optimizing historical data.  The only data that matters is just enough to capture current market conditions and satisfies the Generator's minimal data requirements...

footon wrote:

My 2 cents. This exemplifies how OOS usage turns out-of-sample data into in-sample data. And using the same OOS data for all strats brings about another minus - that is biasing the strats to the underlying OOS data set.

Re: Definition of insanity...looking for some guidance

That about sums it up and certainly seems to be a good and workable approach dRQc9Y84

dRQc9Y84 wrote:

Great conversation here timelleston and Sleytus.

From your conversation and personal experience, here is a summary of my deductions:

- the strategies survives approx 1-2 days after IS
- best to create new portfolio everyday to capture the 1-2 days performance period
- no need to complicate the process. whether with or without OOS, the pattern of performance seems to be the same

Re: Definition of insanity...looking for some guidance

Yes -- no disagreement.  I used "optimization" too loosely and should have said "computations".

But no matter -- when using only the most minimal data to compute settings for current market conditions then concern about "over curve-fitting" goes away.  This is because we no longer care if the settings are over curve-fitted, since if they are then they are over curve-fitted for current market condtions and that is what we want.  All we are hoping for is for current market conditions to persist for another day or so.

footon wrote:

That is another point for debate! Generator in essence still uses optimization, the fact that it throws indis with different parameter values at the data is still a form of optimization. If default values would be used then it is still a form of optimization - a passive one. Where's the right balance?

Re: Definition of insanity...looking for some guidance

Check-out the attached image -- it further confirms timelleston's tests...

I'm not skilled with Excel so I did a simpler test:
1. CADJPY / M30 / 300 bars
2. Ran Generator for 45 minutes and generated > 300 strategies
3. Moved the top 50 strats to a portfolio
4. Build portfolio EA in MT5 and ran simulator

The generator used the data horizon 2202-08-29 thru 2022-09-06 of 300 bars (NOTE: this happens to include a weekend).  I then ran a simulation using MT5's Strategy Tester where the start and end dates were 2022.08.29 and 2022.09.10.

On the balance / equity chart I've marked the IS and In-Market regions.  The green rectangle highlights the In-Market trades shortly after the IS ends and shows that the portfolio EA continues to perform well for about a day before it begins to taper-off.

Post's attachments

CADJPY-M30-IS-vs-InMarket.png 363.68 kb, 3 downloads since 2022-10-01 

You don't have the permssions to download the attachments of this post.

Re: Definition of insanity...looking for some guidance

Nice work Sleytus.

Here's another little insight...

On CJ, I was experimenting with SL level.  I'd originally had both SL and TP at 95 pips.  I'd noticed a couple of things over the last couple of days... SL was getting hit, not that often, but it was getting hit. 

And the other thing was that the overnight spreads can go to 200 (checked it via ICMarkets downloading bars - max was 200 over the last month).  Problem with that is that if you're short (it tends to be the Ask thats jacked up), and the spreads go beyond your SL, you get stopped out.  Not good.

So, I modified Mr Popovs code for a test to see what happens when SL is moved out massively...my theory was that I'd write a script that moved my open short position stop losses to 250 pips when/if the spreads started to get towards my 95 (example only).

What I found was initially interesting. 

If I moved SL out to 200-500 pips (huge yes I know), as you'd expect, they didn't get hit...but, what was surprising was that it didn't impact the results from the portfolio over the next 1-2 days. 

What this was showing was that the reversal/close rules were working really well at closing trades (maybe for a loss yes) but not closing them too soon (i.e. getting stopped out to soon). 

Note: I'm a huge advocate of SL and money management for sure. 

So, I'm going to experiment some more, to make sure that this does actually happen over a longer period and I'll report back here.

I'll be watching equity drawdowns, length of open position and correlation between MAE and MFE. 

When we launch a new portfolio, we set the Max Positions to 0, which still runs the exit signals, just won't open any new positions.  So, unless you get a massive move in the market - which is possible - the exit rules should come into play and close out positions "on-time"...

Re: Definition of insanity...looking for some guidance

In this form of testing how many trades from IS region extend to unknown territory (OOS part)? I have and still am strictly observing a cut-off point, meaning there's no mix between in-sample and out-of-sample data, because trades, which start in-sample, essentially pollute the results.

sleytus wrote:

Check-out the attached image -- it further confirms timelleston's tests...

I'm not skilled with Excel so I did a simpler test:
1. CADJPY / M30 / 300 bars
2. Ran Generator for 45 minutes and generated > 300 strategies
3. Moved the top 50 strats to a portfolio
4. Build portfolio EA in MT5 and ran simulator

The generator used the data horizon 2202-08-29 thru 2022-09-06 of 300 bars (NOTE: this happens to include a weekend).  I then ran a simulation using MT5's Strategy Tester where the start and end dates were 2022.08.29 and 2022.09.10.

On the balance / equity chart I've marked the IS and In-Market regions.  The green rectangle highlights the In-Market trades shortly after the IS ends and shows that the portfolio EA continues to perform well for about a day before it begins to taper-off.

Re: Definition of insanity...looking for some guidance

There's no OOS, no Reactor, no optimization.  Only the Generator using 300 bars IS.  You should see good performance for about 1 day after IS ends, and then it tapers-off.

footon wrote:

In this form of testing how many trades from IS region extend to unknown territory (OOS part)? I have and still am strictly observing a cut-off point, meaning there's no mix between in-sample and out-of-sample data, because trades, which start in-sample, essentially pollute the results.

43 (edited by sleytus 2022-10-01 10:51:09)

Re: Definition of insanity...looking for some guidance

> "And the other thing was that the overnight spreads can go to 200 (checked it via ICMarkets downloading bars - max was 200 over the last month)."
Yep...  I add code to check the spread and if it is over 40 points then the EA ignores signals.

> "If I moved SL out to 200-500 pips (huge yes I know), as you'd expect, they didn't get hit...but, what was surprising was that it didn't impact the results from the portfolio over the next 1-2 days."
I agree with you about large StopLosses.  I've experimented with Fixed and Trailing and haven't seen much difference.  In live trading the WinRate is very high (e.g. > 75%) just as backtesting shows, and I think that may be why SL rarely gets hit.

I'm also interested in MT5's "Average Position Holding Time".  When testing CJ / M15 it was typically around '2', and now with CJ / M30 it is around '6'.  I've read elsewhere and have also seen for myself that swings typically average 3-8 bars for all pairs and timeframes.  I don't know why APHT is around '2' for M15 and '6' for M30 -- but what this does tell me is that for short data horizons the strategies that EA Studio generates are focused on detecting swings.

> "When we launch a new portfolio, we set the Max Positions to 0, which still runs the exit signals, just won't open any new positions."
Exactly...

Re: Definition of insanity...looking for some guidance

Let me rephrase my question: you showed a pic of craptester results, a graph. On it you have marked in-market line, which represents the start of unseen data, the start of simulation of trading in other words, correct? Now, is it 100% clean sheet? I mean there are no trades, which are opened before the in-market line and remain open after the in-market line until they are closed?

sleytus wrote:

There's no OOS, no Reactor, no optimization.  Only the Generator using 300 bars IS.  You should see good performance for about 1 day after IS ends, and then it tapers-off.

footon wrote:

In this form of testing how many trades from IS region extend to unknown territory (OOS part)? I have and still am strictly observing a cut-off point, meaning there's no mix between in-sample and out-of-sample data, because trades, which start in-sample, essentially pollute the results.

45 (edited by timelleston 2022-10-01 13:24:00)

Re: Definition of insanity...looking for some guidance

footon wrote:

Let me rephrase my question: you showed a pic of craptester results, a graph. On it youNow, is it 100% clean sheet? I mean there are no trades, which are opened before the in-market line and remain open after the in-market line until they are closed?

Ah, good question Footon - that can run in MT5 using forward testing from the point of "end of IS".  I'll have a look at that. It won't be exact though because 300 bars in EAS can start mid-way through a day, whereas in MT5 it starts at the beginning of the day...but, it'll be a proxy.

I'll change it to 384 bars, which represents 4 full days, then I can align it to MT5 dates.

Although, given the average holding time is about 4 hours, and the average profit is $6 (on my settings) probably won't make too much difference.  But, we'll test it for sure.

46 (edited by timelleston 2022-10-01 14:49:52)

Re: Definition of insanity...looking for some guidance

Very quick test results, for one period only, so I'd recommend doing this across other periods:

Data Horizon End: 27/9/22
Bars: 384
Resulting Start Date: 21 Sept 00:00
Resulting End Date: 26 Sept 23:45

In the interests of time, I ran the Generator for 30 minutes. It generated 2212 strategies, of which it kept 300.  I moved top 50 based on SQN to Portfolio then exported to MT5. 

Set start in MT5 as 21 Sept.  End as 28 Sept.
Set Custom Forward date as 27 Sept.

Result is attached image below.
Net profit for the 27th was A$107 on size of 0.01 lots (EAS was 0.1 lots).
I used a SL of 220 pips and TP of 95 pips.
In the backtest, of 621 deals, there were 0 SLs, and 32 TPs triggered.
In the forward test, of 146 deals, there were 0 SLs and 0 TPs triggered.

I had not added any custom code to manage spread protection either (normally I set it to 50 pips).
While not repeated across multiple dates, due to time, it does show that this method does actually work.  Of course, sometimes it won't, thats the probability of it, and we can't foretell the sequence of wins and loses, but, it definitely seems to be an edge.

Using the forward test, it closes all deals at the end of the back test, and starts new deals as needed on the forward test - so, Footon, to you question, this is a clean data set.  No trades held over.

Post's attachments

Back and Fwd Test.png 580.84 kb, file has never been downloaded. 

EAS Portfolio.png 339.37 kb, file has never been downloaded. 

Forward Test Results.png 579.76 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

47 (edited by sleytus 2022-10-01 14:45:50)

Re: Definition of insanity...looking for some guidance

Craptester?  Ahhh, another fan of reliable, accurate Strategy Tester?   smile

Okay -- now I better understand your question.  No -- it is not a 100% clean sheet, so that could be an issue.  But consider these points:

(1) Left-over, open trades from IS are probably more likely to have less favorable outcomes than trades near the middle of IS.

(2) The average holding time is about 6 hours in my CADJPY / M30 test.

(3) When using larger data horizons then performance drops off **immediately** after IS.  The important point here is that when using a short data horizon that only captures the current market then good performance persists for a short period after IS into the InMarket region.  Wouldn't you agree?


footon wrote:

Let me rephrase my question: you showed a pic of craptester results, a graph. On it you have marked in-market line, which represents the start of unseen data, the start of simulation of trading in other words, correct? Now, is it 100% clean sheet? I mean there are no trades, which are opened before the in-market line and remain open after the in-market line until they are closed?

48 (edited by sleytus 2022-10-01 14:59:04)

Re: Definition of insanity...looking for some guidance

timelleston wrote:

...it does show that this method does actually work.  Of course, sometimes it won't, thats the probability of it, and we can't foretell the sequence of wins and loses, but, it definitely seems to be an edge.

I think you've said it best -- it's not the HolyGrail and there are no guarantees -- but it's an edge with a very ***low*** DrawDown.

Furthermore, it is only possible because of EA Studio's ability to simply and quickly generate high quality ***portfolio*** EAs.  Otherwise it would be much too tedious and time-intensive to have to create or recalibrate custom strategies every day to accommodate tomorrow's market conditions.

Re: Definition of insanity...looking for some guidance

sleytus wrote:

Furthermore, it is only possible because of EA Studio's ability to simply and quickly generate high quality ***portfolio*** EAs.  Otherwise it would be much too tedious and time-intensive to have to create or recalibrate custom strategies every day to accommodate tomorrow's market conditions.

Yes the ability to very quickly "test" ideas and generate 1000's of strategies based on them, and filter to the good ones, and then re-do it, is incredible.   

You don't even need to necessarily wait an hour or more to generate.  In 36 minutes, while I've been chatting here, it's generated another 1086 strategies.  Pushing to Portfolio, then to a live/demo account is easy.

Re: Definition of insanity...looking for some guidance

I think the reason why we can get away with a large SL is because the strategies are swing-trading -- so, trades close before getting too far out of hand.  It's trend-trading strategies that are vulnerable to large DD and, hence, hitting a large SL.

timelleston wrote:

If I moved SL out to 200-500 pips (huge yes I know), as you'd expect, they didn't get hit...but, what was surprising was that it didn't impact the results from the portfolio over the next 1-2 days.