Enhancing Stability and Robustness of Automated Trading Robots: Strategies, Challenges, and Insights - page 2

 

There are some general tips that the guys above have already stated.

I'll add my own tip:

In a general way, there are only 2 types of EAs:

- EAs that make money on ranging market

- EAs that make money on trending market

As long as you have come up with a strategy to properly analyse how the market is behaving (ranging or trending), your EA should make money.

I mean, if your EA is programmed to trade on a ranging market, a simple strategy using bollinger bands will make money, no matter what, right?

The same is true for a trending market. If its clearly trending, a simple MA cross strategy will make you money.

The true problem is how to program an algorithm that can analyse and differentiante ranging and trending on a particularly fast and efficient way. Most of the time, when your EA detects a ranging or trending movement and start to trade, the market will change. It always does that -> ranging -> trending -> ranging -> trending. It's a cycle.

And both types of market are completely opposite. On a ranging market, you want to sell when the price goes up. On a trending market, you want to buy when the price goes up (and vice-versa when the price goes down).

So you will generally end up with a opened position on the wrong side. Then comes the second most important part of the EA: when to close at a loss? At some point you will need to close.

If you wait too long you will have bigger but fewer losses. If you close too soon you will have a lot of smaller losses. You have to come up with and algorithm that analyses the market and adjust the size of the loss to that particular moment. A fixed stop loss will probably never work.

So the questions are really simple: 1) Is the market ranging or trending? 2) When do I accept and close a losing position?

But the difficult part is finding the answer to those questions. If you do, you are good to go!

 
Rafael Grecco #:

There are some general tips that the guys above have already stated.

I'll add my own tip:

In a general way, there are only 2 types of EAs:

- EAs that make money on ranging market

- EAs that make money on trending market

As long as you have come up with a strategy to properly analyse how the market is behaving (ranging or trending), your EA should make money.

I mean, if your EA is programmed to trade on a ranging market, a simple strategy using bollinger bands will make money, no matter what, right?

The same is true for a trending market. If its clearly trending, a simple MA cross strategy will make you money.

The true problem is how to program an algorithm that can analyse and differentiante ranging and trending on a particularly fast and efficient way. Most of the time, when your EA detects a ranging or trending movement and start to trade, the market will change. It always does that -> ranging -> trending -> ranging -> trending. It's a cycle.

And both types of market are completely opposite. On a ranging market, you want to sell when the price goes up. On a trending market, you want to buy when the price goes up (and vice-versa when the price goes down).

So you will generally end up with a opened position on the wrong side. Then comes the second most important part of the EA: when to close at a loss? At some point you will need to close.

If you wait too long you will have bigger but fewer losses. If you close too soon you will have a lot of smaller losses. You have to come up with and algorithm that analyses the market and adjust the size of the loss to that particular moment. A fixed stop loss will probably never work.

So the questions are really simple: 1) Is the market ranging or trending? 2) When do I accept and close a losing position?

But the difficult part is finding the answer to those questions. If you do, you are good to go!

1) Is the market ranging or trending?
Have you, or anyone been successful to find a robust answer to this? I spent thousands of hours, no success. It looked to me, the question was not answerable and I left the approach of differentiating these two types of move.

2. When do I accept and close a losing position?
Even this question is about finding first question's answer. It is applicable for TP too.

 

My approach is Pure Mathematics:

1. Design a mathematical EA with a robust mathematical logic.

2. After design, backtest it on a short pass, like 1 year with real tick data.

3. See what is suffering it. Avoid the sufferings. Do not change the values of parameters. I mean only obvious sufferings like market gaps.

4. Then backtest it on long run pass, I prefer from 2000-current.

It indicates the Maximal Drawdown. It is about past. To estimate how much Margin you would need.

There is a VaR which indicates possible future results based on the trades. It may be considered as future results, if you use mathematical model. However it does not indicate a valid value on so called prediction model.

Then you can have a meaningful image from your system rank.

Remember: If an EA does not profit without optimizing the parameters' values, it is not solid. You may notice this kind of optimization profits periodically. So even the DD and VaR are not valid.

 
HosseinKOGO #:

1) Is the market ranging or trending?
Have you, or anyone been successful to find a robust answer to this? I spent thousands of hours, no success. It looked to me, the question was not answerable and I left the approach of differentiating these two types of move.

2. When do I accept and close a losing position?
Even this question is about finding first question's answer. It is applicable for TP too.

1) Just like you, I've spent thousands of hours searching for an answer to this question. To be more precise, I've been programming MQL5 sinsce 2016. After each failure I learn something new. My latest algorithm is very promising, I've been running it live on a demo account on all major and minor forex pairs (28 pairs in total) and getting excellent results.

2) I somewhat agree, but is does not apply to every situation. The algorithm I'm currently testing does not use a SL or TP. If a position is at a loss, it will look for a situation where it can "lower" the loss. If it is positive, it will try to maximize the profit - but that means it will never take maximum profit in any trade - but the final result is better.

HosseinKOGO #:

My approach is Pure Mathematics:

1. Design a mathematical EA with a robust mathematical logic.

2. After design, backtest it on a short pass, like 1 year with real tick data.

3. See what is suffering it. Avoid the sufferings. Do not change the values of parameters. I mean only obvious sufferings like market gaps.

4. Then backtest it on long run pass, I prefer from 2000-current.

It indicates the Maximal Drawdown. It is about past. To estimate how much Margin you would need.

There is a VaR which indicates possible future results based on the trades. It may be considered as future results, if you use mathematical model. However it does not indicate a valid value on so called prediction model.

Then you can have a meaningful image from your system rank.

Remember: If an EA does not profit without optimizing the parameters' values, it is not solid. You may notice this kind of optimization profits periodically. So even the DD and VaR are not valid.

I mostly agree!! I stopped using otimization a long time ago. Optimization will mask the problem with any EA. It will make the EA good at a very specifict market moment but it will still fail outside of that time window.

 
HosseinKOGO #:

My approach is Pure Mathematics:

1. Design a mathematical EA with a robust mathematical logic.

2. After design, backtest it on a short pass, like 1 year with real tick data.

3. See what is suffering it. Avoid the sufferings. Do not change the values of parameters. I mean only obvious sufferings like market gaps.

4. Then backtest it on long run pass, I prefer from 2000-current.

It indicates the Maximal Drawdown. It is about past. To estimate how much Margin you would need.

There is a VaR which indicates possible future results based on the trades. It may be considered as future results, if you use mathematical model. However it does not indicate a valid value on so called prediction model.

Then you can have a meaningful image from your system rank.

Remember: If an EA does not profit without optimizing the parameters' values, it is not solid. You may notice this kind of optimization profits periodically. So even the DD and VaR are not valid.

My approach is kind of similar, but I'd add a couple of things:

  1. If you have enough data, you can tune the parameter settings, but (important) only to improve an already reasonably profitable & consistent (high r-correlation) strategy, not to turn an unprofitable/inconsistent strategy into a viable one.  If the 20 MA works fine, but the 21 does better, why not take the slightly improved odds?
  2. If I see there are long stretches (i.e., several weeks) where the strategy performed poorly, I try to determine what the macro conditions were — bull, bear, sideways, choppy, etc. Is there any kind of market regime filter I can use to either improve performance in those stretches (without blowing it everywhere else), or just keep it from trading entirely?
 
Comments that do not relate to this topic, have been moved to "Please help with inputs of EA on the Candle Color Indicator".