---
title: "Discussion on \"Creating a Reliable EA with Custom Optimization in Metatrader 5\" | Hashnode"
description: "Discussion on \"Creating a Reliable EA with Custom Optimization in Metatrader 5\". My experience in creating an EA with a custom optimization criterion for the MetaTrader 5 Strategy Tester instead of relying on a single metric."
url: "https://hashnode.com/posts/creating-a-reliable-ea-with-custom-optimization-in-metatrader-5-1/681f2fcdda00b9d702d383d8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Creating a Reliable EA with Custom Optimization in Metatrader 5](https://jamestedy.hashnode.dev/creating-a-reliable-ea-with-custom-optimization-in-metatrader-5-1?utm_source=hashnode&utm_medium=feed)

My experience in creating an EA with a custom optimization criterion for the MetaTrader 5 Strategy Tester instead of relying on a single metric.

May 10, 2025 · 3 min read · jamestedy.hashnode.dev  
Read the article

-   [#programming-tips](https://hashnode.com/tag/programming-tips)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#mqls](https://hashnode.com/tag/mqls)
-   [#tech](https://hashnode.com/tag/tech)
-   [#coding](https://hashnode.com/tag/coding)
-   [#metatrader5](https://hashnode.com/tag/metatrader5)
-   [#backtesting](https://hashnode.com/tag/backtesting)
-   [#trading](https://hashnode.com/tag/trading)
-   [#forex-trading](https://hashnode.com/tag/forex-trading)

## Written by

[James Tedy](https://hashnode.com/@jmstdy95)

@jmstdy95

  
[View profile](https://hashnode.com/@jmstdy95)

I love building projects related to Tech, especially Blockchain, AI, Frontend, and Algo (Finance)

## Responses 1

Markdown supported · ⌘↵ to post

[Arnold Holm](https://hashnode.com/@stratcorealpha)

[Oct 19](https://hashnode.com/posts/creating-a-reliable-ea-with-custom-optimization-in-metatrader-5-1/681f2fcdda00b9d702d383d8/comment/6ad633308c5f7b3129e627cf)

I would add two small boundary checks before using this score. With zero trades, the win-rate division happens before the rejection condition, so return before that division. Also, a rejected run scores zero while an accepted run can score below zero. That can put a rejected run above a valid one. Give rejected runs a value below every accepted score, and keep the score and thresholds frozen for the test on later, untouched data. A combined score still needs that separate check.
