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 → Filter Your Strategy Collections by Stop Loss (Free Script)

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

1 (edited by geektrader 2024-11-07 09:47:36)

Topic: Filter Your Strategy Collections by Stop Loss (Free Script)

Hi fellow traders!

Because this is currently not possible in EA Studio, I've created a simple Python/PowerShell script that automatically filters your strategy collections based on the maximum stop loss you want.

Here's what it does:
- Processes all JSON strategy collections in your current directory
- Creates new filtered versions with "-SL-XX-Pips" in the filename
- Keeps only strategies with stop losses below your specified maximum
- Shows you exactly how many strategies were filtered out
- Super fast and reliable (I use it myself all the time)

Using it is super simple:
1. Download the script (attached below)
2. Open it in any text editor
3. Change the MAX_STOP_LOSS value at the top (default is 65 pips)
4. Put the script in the folder with your JSON strategy files
5. Run it with Python

For example, if you want to keep only strategies with stop losses up to 50 pips, just change this line at the top:

Python:

MAX_STOP_LOSS = 50  # Change this to whatever you want

PowerShell:

[double]$MAX_STOP_LOSS = 50

The script will create new files with names like "MyStrategies-SL-50-Pips.json" containing only the strategies that meet your criteria. The original files stay untouched.

Hope this helps some of you streamline your strategy management! Let me know if you have any questions or suggestions for improvements.

Happy trading!

Cheers,

Lorenz


Python version:

Post's attachments

strategy-collection-sl-filter.py 7.93 kb, 4 downloads since 2024-11-07 

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

2 (edited by geektrader 2024-11-08 08:50:26)

Re: Filter Your Strategy Collections by Stop Loss (Free Script)

PowerShell version:

Post's attachments

strategy-collection-sl-filter.ps1 6.11 kb, 1 downloads since 2024-11-08 

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

Re: Filter Your Strategy Collections by Stop Loss (Free Script)

Good

4 (edited by ViniQ 2024-11-08 16:56:50)

Re: Filter Your Strategy Collections by Stop Loss (Free Script)

@Geek Those metrics are very important for any serious trader. I hope someday we have it as acceptance criteria and at the collection filter max/min:

  • Avg. loss trade

  • Avg. profit trade

Below is the MT5 snippet I use as "custom optimization metric" in MT5 optimization, here is my contribution to the community:

   double avg_win = TesterStatistics(STAT_GROSS_PROFIT) / TesterStatistics(STAT_PROFIT_TRADES);
   double avg_loss = -TesterStatistics(STAT_GROSS_LOSS) / TesterStatistics(STAT_LOSS_TRADES);

Using both of those metrics you can create a the metric "RRR" return risk ratio:

double return_risk_ratio = avg_win/avg_loss; // RRR

RRR higher than 1 ( >=1 ) means your system has more profit than losses in the long run and I love this metric!

@Geek glad to see along those years you still continue providing great insights for the community!
Hope you the best trades and Thank you big_smile!  Cheers from Brazil

Re: Filter Your Strategy Collections by Stop Loss (Free Script)

Thanks for the kind words guys, I appreciate it and am happy if my contributions are helpful.

Thanks for your contribution as well. It might make sense if you post it in a separate thread, so that it gets noticed.

Cheers from Germany! :-)

Posts: 5

Pages 1

You must login or register to post a reply

Forex Software → Expert Advisor Studio → Filter Your Strategy Collections by Stop Loss (Free Script)

Similar topics in this forum