forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Expert Advisor Studio → History Data Randomization not working correctly (v21.12.13)

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 14

Topic: History Data Randomization not working correctly (v21.12.13)

Hi Mr. Popov,

the history data randomization seems to be broken in the recent version v21.12.13. Regardless how high I set the Data range change ATR % and the Count of changed bars %, the line in all subsequent tests (e.g. 500 "Count of Tests") always looks *exactly* the same. It seems like EA Studio is randomizing only one dataset and then uses that 1 data set for all tests, which makes no sense. I can make a video if needed, but I think the problem is pretty obvious.

Thank you for fixing this.

Re: History Data Randomization not working correctly (v21.12.13)

It was discussed here -> https://forexsb.com/forum/topic/8948/fa … nte-carlo/

Your observations are correct, one dataset is randomized and then used in all tests, 10x faster this way smile

It's the same thing with walk forward as well, the same dataset is used in strategy generation and then in optimization segments, thus rendering the process useless. There will be a fix for this though or a separate procedure, maybe it will be similar to data randomization also.

Re: History Data Randomization not working correctly (v21.12.13)

Oh, I see, that makes no sense. If I want to run Monte Carlo with *only* history data randomization, I expect EA Studio to create a new data set for all iterations, just like it did in the past, not just 1 and then use the same set for all passes, which then all look exactly the same. This misses the point completely. Please fix this Popov, it makes no sense this way. Thanks.

Re: History Data Randomization not working correctly (v21.12.13)

Just made a video of this. The whole randomization is pointless for any amount of passes > 1, the dataset and hence the outcome of each iteration > 1 is always the same.

https://youtu.be/zKUHbSDHRSg

Please re-add the old mode where it generates a new dataset for each iteration, Mr. Popov. Thank you.

Re: History Data Randomization not working correctly (v21.12.13)

Hi Mr. Popov,

can you please be so kind to readd the previous behavior so that EA Studio generates a new randomized history data set for each iteration, just like it did before? Or at least make it an option (e.g. "don't cache randomized history data")? The current behavior is a really not useful for testing many randomized history data sets like it was possible before.

Thank you.

Re: History Data Randomization not working correctly (v21.12.13)

> Or at least make it an option (e.g. "don't cache randomized history data")?

More proper will be: [v] Cache randomized history data

I thought about such case when designed the caching mechanism. My idea was to have caching enabled when "Randomize data" is on and there are other options also on. I could not figure out what is the best solutions at that time.

>  readd the previous behavior so that EA Studio generates a new randomized history data
The algo is progressively slower when add a higher percentage of bars. In such a cases the caching is a significant improvement.

Re: History Data Randomization not working correctly (v21.12.13)

Sure, the cache speeds things up a lot, but it defeats the purpose of it actually. If I now run a monte Carlo test with only randomized history data, it uses the same data set for all iterations, hence the result is always the same, which makes no sense for the way I used to test my strategies on *many* randomized history data sets. Can't you possibly add an option in the global settings that re-enables the old behavior without caching, so everyone can decide what they need? That would be great.

Re: History Data Randomization not working correctly (v21.12.13)

Two things:
- added an option for enabling caching of the randomized data. (on by default)
- found a way to optimize the randomization algorithm. Now it is 50-100 times faster. This simply means we can remove the caching data feature at all.

https://image-holder.forexsb.com/store/eas-monte-carlo-randomize-historical-data-thumb.png

https://image-holder.forexsb.com/store/eas-monte-carlo-historical-data-cahce-options-thumb.png

Merry Christmas, and happy new trading year!

9

Re: History Data Randomization not working correctly (v21.12.13)

Happy New Year to everybody

Re: History Data Randomization not working correctly (v21.12.13)

Good morning everyone,

I optimized the randomization algorithm even more. Now the caching feature doesn't make any sense, so I removed. I removed also the option for the cache control I introduced yesterday.

Now the Monte Carlo is both reliable and faster.

Happy holidays!

11 (edited by geektrader 2021-12-28 01:17:06)

Re: History Data Randomization not working correctly (v21.12.13)

LOL, you are completely crazy Mr. Popov. 100 times faster!? Haha, thanks sooo much! It works great and takes just a second, even for 35 years of history data with a chance of 50% randomization. Great work.

Re: History Data Randomization not working correctly (v21.12.13)

That's nice! smile What's the secret behind such a big optimization and speed step?
Happy New Year!

Re: History Data Randomization not working correctly (v21.12.13)

> That's nice! smile What's the secret behind such a big optimization and speed step?

Nice question Footon,
Actually, the secret is removing the "clever" things I did before.
Initially, my idea was to modify random bars. Let's say we want to randomize 20% of the bars and we have 100 000 bars. The alogo before was something like that

barsToChange= []
do {
  randomBar = RandomNumber(1, bars)
  If (not barsToChange.contains(randomBar) ) {
     barsToChange.add(randomBar)
 }
} while(barsToChange.length < 20000)

In that way, we generate a random number between 1 and the number of bars in the data series and check if we already had this before. If not, we add it to the `barsToChange` list. The loop continues until we have 20 000 numbers on the list.

After that loop, EA Studio starts the actual bar randomization for the chosen bars.

This simple function looks well at a fierce glance. However, the problems start to appear when we want a higher percentage of randomized bars. Even more, the function is really wrong when we want to randomize 80% or 90% of the bars.

Do you see the problem?

It becomes progressively more difficult to find a random number, which is not already on the list. Obviously, this is not the way to find 20 000 unique random numbers from 1 to 100 000.

...

Actually, I saw this problem after optimizing the other part of the function - calculating the Average True Range and generating new High, Low and Close prices for the given bar.

The straightforward optimization I did was t replace function calls with online code as much as possible. This speeded up the calculations a lot.

Before:

for (bar ...) {
    newDataSet.high[bar]  += getPriceChangeDelta(atr[bar], maxAtrPercent)
    newDataSet.low[bar]   += getPriceChangeDelta(atr[bar], maxAtrPercent)
    newDataSet.close[bar] += getPriceChangeDelta(atr[bar], maxAtrPercent)
}
...

function getPriceChangeDelta(atr: number, maxAtrPercent: number): number {
    return (Math.random() < 0.5 ? -1 : 1) * (atr / 2.0) * ((maxAtrPercent / 100) * Math.random())
}

Now:

for (bar ...) {
    const factor = (atr[bar] / 2.0) * (maxAtrPercent / 100)
    newDataSet.high[bar]  += (Math.random() < 0.5 ? -1 : 1) * factor * Math.random()
    newDataSet.low[bar]   += (Math.random() < 0.5 ? -1 : 1) * factor * Math.random()
    newDataSet.close[bar] += (Math.random() < 0.5 ? -1 : 1) * factor * Math.random()
}

Now the Data Randomization function is relatively fast. It takes 4.5% of calculation time on default settings without caching.

https://image-holder.forexsb.com/store/randomizeDataSet-performance-thumb.png

Trade Safe!

Re: History Data Randomization not working correctly (v21.12.13)

Superb smart work, thanks again for this amazing update.

Posts: 14

Pages 1

You must login or register to post a reply

Forex Software → Expert Advisor Studio → History Data Randomization not working correctly (v21.12.13)

Similar topics in this forum