forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


Forex Forum → Portfolio Expert → Validate Portfolio and re-export produces different portfolio

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 15

Topic: Validate Portfolio and re-export produces different portfolio

Hi
Looking for some advice...
A couple of weeks ago I generated a portfolio of EAs (38 in total), and today I reloaded them into Validator, turned on Opt and Norm, and re-imported them, moved them to Portfolio and re-exported them.

I expected some of the parameters to change due to the Opt + Norm, but, wholesale changes have occurred to the order of the list of strategies...it is no longer the same as I originally had.

I even tried just importing them through Validator, no Opt, no Norm, and then downloading again through Portfolio -  same result, they're different...

I have quite a few open positions, and if I change the running EA (old version) to this version, then what happens to open positions - surely the magic numbers now no longer match up? 

Am I missing something?
Thanks

Re: Validate Portfolio and re-export produces different portfolio

did you use the same data?

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Validate Portfolio and re-export produces different portfolio

timelleston wrote:

Hi
Looking for some advice...
A couple of weeks ago I generated a portfolio of EAs (38 in total), and today I reloaded them into Validator, turned on Opt and Norm, and re-imported them, moved them to Portfolio and re-exported them.

I expected some of the parameters to change due to the Opt + Norm, but, wholesale changes have occurred to the order of the list of strategies...it is no longer the same as I originally had.

I even tried just importing them through Validator, no Opt, no Norm, and then downloading again through Portfolio -  same result, they're different...

I have quite a few open positions, and if I change the running EA (old version) to this version, then what happens to open positions - surely the magic numbers now no longer match up? 

Am I missing something?
Thanks


Are you missing something?  Yes.  And I've also been down this path.

You can't change EAs when there are open trades because the MagicNumbers will be different for the two EAs.  MagicNumbers are generated based on the sequence of the strategies in the EA and there is no guarantee (nor should there be) that MagicNumbers will be preserved from one portfolio EA to another.

Another thing -- you may think that your settings haven't changed, but they have.  In particular, the OOS analysis -- which is affected by the data horizon.  If the data horizon is different for the two portfolio EAs then for sure the OOS analysis will yield different settings and the order of the strategies in the portfolio EA will be different.

If you really, really want to switch EAs then there are a couple of solutions:
(1) Bite the bullet and close all Open orders before switching.
(2) If you don't want to close the Open orders then you'll need to allow the original portfolio EA to continue to run.  And for the new portfolio EA you'll need to edit its 'Base_Magic_Number' so the two EAs will use different MagicNumbers that don't conflict with one another.

This may initially seem like a pain and inconvenient -- but it really isn't.  Once you understand how the pieces work together then you'll figure out ways to live with it.  Everything comes with a trade-off -- and if Popov were to propose a solution then not only would it increase complexity but it would also come with its own price and side-effects.

4 (edited by timelleston 2022-08-20 00:28:32)

Re: Validate Portfolio and re-export produces different portfolio

Blaiserboy wrote:

did you use the same data?

No, I've updated the underlying data (just added the last week to it), which I guess, re-orders things...

5 (edited by timelleston 2022-08-20 00:29:33)

Re: Validate Portfolio and re-export produces different portfolio

sleytus wrote:

Are you missing something?  Yes.  And I've also been down this path.

You can't change EAs when there are open trades because the MagicNumbers will be different for the two EAs.  MagicNumbers are generated based on the sequence of the strategies in the EA and there is no guarantee (nor should there be) that MagicNumbers will be preserved from one portfolio EA to another.

Hmmm, thanks guys, appreciate it.   
My goal was to update the running parameters on the running strategies (because of the open positions), because of slight re-optimisation. 
Have to think this one through more in terms of how best to do it.  There's 38 strategies running in the portfolio.  Might have to do it manually I guess?

Re: Validate Portfolio and re-export produces different portfolio

The question is if after a "slight optimization" the strategy is the same or not.
I assume the strategy is different and it has to have a different magic number.


One possibility is to add an option "Close only" in the Portfolio Expert. It will allow to re-run the current Portfolio expert in a "close" mode to close the currently open position according to the original trading rules.
At the same time, we can run the new Portfolio with a different Magic number. It will open new positions following its updated signals and will not mess with the previous ones.

I may try to do it during this weekend for a test.

7 (edited by sleytus 2022-08-20 04:15:38)

Re: Validate Portfolio and re-export produces different portfolio

Popov wrote:

The question is if after a "slight optimization" the strategy is the same or not.
I assume the strategy is different and it has to have a different magic number.


One possibility is to add an option "Close only" in the Portfolio Expert. It will allow to re-run the current Portfolio expert in a "close" mode to close the currently open position according to the original trading rules.
At the same time, we can run the new Portfolio with a different Magic number. It will open new positions following its updated signals and will not mess with the previous ones.

I may try to do it during this weekend for a test.


I like the "Close only" idea.  It's simple and would address the issue of "gracefully" transitioning to an updated portfolio EA (with different Magic Numbers).  Also, it would seem to have no downside.

Re: Validate Portfolio and re-export produces different portfolio

Popov wrote:

The question is if after a "slight optimization" the strategy is the same or not.
I assume the strategy is different and it has to have a different magic number.


One possibility is to add an option "Close only" in the Portfolio Expert. It will allow to re-run the current Portfolio expert in a "close" mode to close the currently open position according to the original trading rules.
At the same time, we can run the new Portfolio with a different Magic number. It will open new positions following its updated signals and will not mess with the previous ones.

I may try to do it during this weekend for a test.

Yes that sounds like a good approach - if the original signals continued to work to close an open trade, rather than just relying on the SL or TP attached to the position. 

So the new "optimised" parameters for a strategy would show up as a new strategy, obviously with new magic number.

For instance, if the Portfolio consists of 2 strategies and it's re-optimised, and the first strategy retains the same parameters as before, but the second strategy changes the MA Crossover from (Simple, Simple, 14, 42) to (Simple, Simple, 10, 38), the second strategy would be marked "Close Only" and a new strategy would be added to the Portfolio...  When it's downloaded, there'd be 3 strategies in the Portfolio.

One question would be...the next time you upload the Portfolio to re-validate/re-optimise, what happens to the "Close Only" strategies?  Maybe there's a check box (similar to resolve correlations) to remove them?   Possibly have to add a date to the strategy so you could selectively remove them prior to a particular date?

Re: Validate Portfolio and re-export produces different portfolio

The option will be in the exported Portfolio Expert.

It can be used like that:
- stop the running "old" portfolio expert
- start the "old" portfolio expert in "close only" mode with the same Base Magic Number as before.
- run the "new" updated portfolio expert with a new Base Magic Number

The "old" portfolio will close its positions according to the original strategies rules.
The "new" portfolio will open its own positions.

It may happen that some strategy may open a position before the original one was closed. However, there is no drama because both the "old" and the "new" strategies follow their trading rules.

Re: Validate Portfolio and re-export produces different portfolio

Popov wrote:

The "old" portfolio will close its positions according to the original strategies rules.
The "new" portfolio will open its own positions.

It may happen that some strategy may open a position before the original one was closed. However, there is no drama because both the "old" and the "new" strategies follow their trading rules.

Sounds a good approach.
Thanks

Re: Validate Portfolio and re-export produces different portfolio

Now I'm looking the Portfolio Expert code and found out that such behaviour can be imitated by setting the "Max Open Positions" count.

If we set "Max Open Positions" = 0, the Portfolio Expert will manage the currently open positions accordingly but will not open new ones.

12 (edited by timelleston 2022-08-20 06:07:33)

Re: Validate Portfolio and re-export produces different portfolio

Ok, thats good... so, to confirm, the process would:

1) Upload an existing Portfolio into Validate and re-optimise as needed
2) Download the "new" Portfolio Expert
3) Set the old Portfolio Expert Max Open Positions to 0
4) Add the new Portfolio Expert to another chart and change the Magic Number to something else

Old trades get closed according to old rules.
New trades get opened according to new rules.

Re: Validate Portfolio and re-export produces different portfolio

timelleston wrote:

Ok, thats good... so, to confirm, the process would:

1) Upload an existing Portfolio into Validate and re-optimise as needed
2) Download the "new" Portfolio Expert
3) Set the old Portfolio Expert Max Open Positions to 0
4) Add the new Portfolio Expert to another chart and change the Magic Number to something else

Old trades get closed according to old rules.
New trades get opened according to new rules.


Yeah -- that's the way I understand it, as well.

Popov -- nice solution, and no code changes!!

Re: Validate Portfolio and re-export produces different portfolio

This looks like that solves all problems. We don't need a Portfolio Editor or fixed individual strategies Magic Numbers.

Simply set the current Portfolio with Max Positions = 0 to close its open position.
Run the modified, optimized, or edited Portfolio with a different Base Magic number.

It even solves a case for revalidating and merging Portfolios or Collections.

If we have several Portfolios for a single symbol, we can import all of them at once in the Valiador to re-test them on newer data. Then we can merge them into a new Portfolio and use the above trick gracefully replace them.

Re: Validate Portfolio and re-export produces different portfolio

Yes its a great solution - I've just done that with mine, very easy to do...and we'll watch over the next few days as they close out old, and open new new.

Thanks Mr Popov - brilliant solution.  Should definitely promote this as I'm sure lots of others are wondering how to do the same thing.

Posts: 15

Pages 1

You must login or register to post a reply

Forex Forum → Portfolio Expert → Validate Portfolio and re-export produces different portfolio

Similar topics in this forum