1 (edited by Minch 2020-10-19 02:36:26)

Topic: Portfolio Expert - Changing SL Values Post Export

I would like to ask some assistance with the following, please.

I created 100 strategies and compiled these into a single portfolio. I thought that the strategies all had a SL of 100 but when I ran the portfolio in MT4 Backtester, I had gaps in the SL column (see attached). I now need to check back and amend each of the strategies so that they have a SL of 100. I tried to do this in the EA Studio but the editor is clunky and each time an amendment is made, a new strategy seems to be created and I end up with duplicates, it's very confusing. I thought it would be easier to just change the code, so I opened the editor in MT4 and there are indeed some lines that say : useStopLoss":false

/*STRATEGY CODE {"properties":{"entryLots":0.01,"stopLoss":100,"takeProfit":100,"useStopLoss":false,"useTakeProfit":false,"isTrailingStop":false}

I changed all these lines from false to true and recompiled it and reran the back test. Unfortunately, there is no change - I am getting exactly the same results and there are still the same trades created with no SL.

Is there something else in the code I should be changing, please?

I have attached the original export file and the one where I changed the values. Thank you.

Post's attachments

SL Values Missing.png 15.8 kb, file has never been downloaded. 

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

2 (edited by Minch 2020-10-19 02:28:02)

Re: Portfolio Expert - Changing SL Values Post Export

File attached

Post's attachments

Portfolio Expert EURUSD D1_Test 3_Some SL False_File1.mq4 275.75 kb, 3 downloads since 2020-10-19 

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

3 (edited by Minch 2020-10-19 02:29:03)

Re: Portfolio Expert - Changing SL Values Post Export

File attached

Post's attachments

Portfolio Expert EURUSD D1_Test 3_SL Changed to TRUE_File2.mq4 277.28 kb, 2 downloads since 2020-10-19 

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

Re: Portfolio Expert - Changing SL Values Post Export

Signal signal = CreateEntrySignal(0      , ind0long && ind1long && ind2long, ind0short && ind1short && ind2short, 33, 24, false); return (signal); }

Change IT here in each Signal. The 33 and 24 are sl TP

5 (edited by Minch 2020-10-19 15:59:31)

Re: Portfolio Expert - Changing SL Values Post Export

Hi Roughey,

Thank you - that worked perfectly! smile

I think I was changing the comment line only so no wonder it didnt work for me. I'm trying to improve my awareness of the code so this really helps me to get a new handle on what is happening under the hood, thank you very much again. One additional question, if I may : I assigned a variable X to be the SL so I only need to change one value when I want to change all 100 strategies, i.e.

Signal signal = CreateEntrySignal(0, ind0long && ind1long && ind2long, ind0short && ind1short && ind2short, X, 0, false);

This seem to work OK, but I also noticed that there is the CreateExitSIgnal - do I need to match the SL value in there as well since there seem to be the same two values?

i.e.

Signal signal = CreateEntrySignal(75, ind0long && ind1long && ind2long, ind0short && ind1short && ind2short, X, 0, false);
Signal signal = CreateExitSignal(75, ind3long || ind4long, ind3short || ind4short, X, 0, false);

Thanks for your help -

6 (edited by Roughey 2020-10-19 17:19:30)

Re: Portfolio Expert - Changing SL Values Post Export

yes on both..

here in code you can find how this function is build.

Signal CreateEntrySignal(const int strategyIndex,const bool canOpenLong,const bool canOpenShort,const int stopLossPips,const int takeProfitPips, const bool isTrailingStop)

Signal CreateExitSignal(const int strategyIndex,const bool canCloseLong,const bool canCloseShorts,const int stopLossPips,const int takeProfitPips, const bool isTrailingStop)

i dont know why it is in both ..maybe popov can tell.. i also wish to have magicnumber as a variable as basic portfolio code

Re: Portfolio Expert - Changing SL Values Post Export

Thank you again - I just created a test to see if it appears on both and it does, so thanks for your confirmation as well. The ability t change SL and TP on a global level in my test is a major step forwards in my testing.

I appreciate also the info on the build -

Cheers - have a great day!
Matthew