Experts: Multi Levels Trend Expert Advisor

 

Multi Levels Trend Expert Advisor:

This expert advisor is based on the concept that market does not move always in one direction. Even when the market is trending in one direction at some points it pullback. The EA has been backtested from July 1, 2011 to Jan 13, 2012 on EURUSD. It has

Author: heao

 
No tiene stop esta EA??? Porque una vez que hace las entradas y va en contra no cierra las posiciones.
 

I've checked this EA, and after some modifications (smaller TP and lot size) looks great.

Two issues after few days of tests on demo account with incoming results (not backtest):

1. Some brokers has FIFO restriction (First In First Out) and flooding with warning messages. Is there any solution for respect FIFO?

2. After initializing, this EA create iMA, makes direction of trend, and holds trend all the times. There is no checkpoint for change of the trend. Another checking of trend is prepared after reinitalizing EA.

 

Thanks Orzels for your feedback.

The FIFO alerts can be fixed easy. We can modify the system to start closing the trades in FIFO orders when the profit target is met for the last level. I will add an option to the next version to allow traders to enable or disable FIFO.

The default for the EA is to follow the MA(34) on the day time frame, which takes long time to reverse its trend. However, you still can use trade-type 1 and 2 to decide the direction of your trade. The system does change it direction until the profit target is met and then examine the trend for the next trades.

I think you get better result, if you use this EA with my Multi Currency Pairs Indicator on timeframes H1 or above.

 

First of all: thanks for your work and for sharing it! Generally I like your idea of working in a high timeframe and then look on the price action to decide about trades.

I backtested nearly the same time window as you did and my results are very different from those you displayed:

Please note: this is just QUICK & DIRTY, for my backtest data is not of high quality at the moment - but I don't think this fact should affect my test results too much.

Next I analyzed your code and found that you implemented a logic to close profitable trades, but no code to close non-profitable ones. To discuss that fact let us have a look at the chart with my tester results:

Section A: We start with a few trades that have to wait for a very long time to be closed. According to the EA they block further trades to be opened and finally are closed about at break even.

Section B: Here is where disaster takes place. According to the opening rules three long trades are opened, while the market itself has already turned down - for a very long time! Fast price action and the heavy lagging of SMA(34) worked against us. Now the EA waits for the market to turn ... and waits ... and waits ... - those three trades are closed by tester in the end causing heavy losses. Allright: in a forward test the EA might wait for some more months without realizing losses - but right now EURUSD is way below 1.30 ! I would not like to wait until it reaches more than 1.45 again to realize some moderate profit. Would you?

Section C: If trades weren't blocked, the EA would try to open short trades during this one week rejection - a full week of missed opportunities.

Additional Code

What I did next was to implement a simple logic to close non-profitable trades, very similar to the logic you used for TP closes:

extern double SL = 600;     
/*
  original code here ...
*/
   //------------------ Check non-profitable trades for closing conditions
   for (j = 1; j < 50; j++)
   {
      if (OrderSelect((j - 1), SELECT_BY_POS) == true)
      {
         if ((OrderType() == OP_BUY) && ((OrderOpenPrice() - OrderClosePrice()) / Point) >= SL)
         {
            CloseAllBuy();
            return(0);
         }
         if ((OrderType() == OP_SELL) && ((OrderClosePrice() - OrderOpenPrice()) / Point) >= SL)
         {
            CloseAllSell();
            return(0);
         }
      }
   }
/*
  original code here ...
*/

Please not that for simplicity I used the same value for my SL like originally used for TP - this might be subject to optimization!

The outcome was the following ...

... or in a chart:

Well: this does not look too nice - but better than my first attempt!

This represents the current status of my analysis. Now I would like very much to discuss the following points:

  1. Why is there such a large difference between the test results shown in the original balance and in my first balance? Is it a problem of the admittedly poor quality of my backtest data?
  2. What I do not understand in the EA's logic is the fact, that if the first trade ends in losses, a second one in the SAME direction will be opened. Why not in the opposite direction?
  3. What was your reason to NOT implement a rule to get rid of non-profitable trades?
  4. Did you consider to use a faster MA that does not lag so heavily behind the price action like SMA(34)? I believe that a much shorter SMA / EMA might work better!
  5. Did you consider to use a completely different trend indicator - maybe John Ehlers' instant trend line? This one has really low lag!

Lastly: if all or part of my analysis should sound too ridiculous to you, please note that I am still a Forex newbie with no more than three months of experience!

Hope to proceed this discussion an upload my test results as a ZIP file - if I manage to find the upload button. This is my first post in this forum.

I also tested in timeframe H4 with nearly identical results - see ZIP.

 
Thanks for your detailed backtesting. i will add a detailed reply when i have time. however, please make sure that you are using every tick when you test the system as it is based on every tick.
 
hodhabi:
Thanks for your detailed backtesting. i will add a detailed reply when i have time. however, please make sure that you are using every tick when you test the system as it is based on every tick.
Yes - my backtest works on every tick. But - as stated before - at the moment my backtest data is of poor quality. Maybe this is the reason for the difference.
 

Hello again,

I repeated my backtest with the original EA, no modification, with better data now (90% modeling quality). A few more trades, but generally the same result:

Everything works fine until 2011-08-29:

I can't figure it out until now.

 

Please see the following backtest results:

 
hodhabi:


Hi .

the Stop loss is the same as take profit now .

can you help to add and change the Take Profit in 1 slot .

and the Stop loss in anyother slot .

Note : change the EA Only Activated in this Chart .

Because now if it Trigger a take Profit slot and at the same time it close all my other EA Opening too .

 

duplex:

I can't figure it out until now.


IMO backtest is valid when "Close at stop" is going with provided direction. Because this three stops in your test (120, 121, 122) is not declared by EA! It's simply end of time...

Prepare this test: take one week for testing (eg 02.01.2012 - 06.01.2012), and look at the end - probably on "Close at stop" EA produces looses.

Next test: Add another week (02.01.2012 - 13.01.2012) and see again. Impressed? The previously lost postions is profitable now!

It's very important to make backtests with good timeframe and good result at the end.

Reason: