Results 1 to 6 of 6
 2 Attachment(s)    

Thread: Trend Trading EA

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    13

    Default Trend Trading EA

    Hi Traders,
    Couple of days ago I made this EA and want to share with you guys. Iím also need help to make it better. This EA works very well on higer timeframes H4.

    This EA uses 4 simple moving averages to determine the trend. 10 SMA, 30 SMA, 50 SMA and 100 SMA.
    It also uses 3 indicators (ADX, SAR and AO) for conformation the trend and find a sweet spot to enter the market.

    The trading strategy is this:
    BUY

    1. MA Conditions: MA10 > MA30 & MA30>MA50 & MA50>MA100 & MA30[0]>MA30[5] & MA50[0]>MA50[1] & Close > MA50 & Close > MA100
    2. AO Condition: AO> 0 & AO[1] > 0
    3. SAR Condition: SAR <Low[0] & SAR[1]>Low[1]
    4. ADX Condition: ADX+ > ADX- & ADX+[1] > ADX-[1]


    We buy when are those conditions are met.

    Exit buy:
    • MA10 < MA50 || MA30 < MA50 || Bid < MA100


    Sell and exit sell is other way round.

    On the back testing I noticed that this EA makes many small losses as the market ranges no matter how many MAís we use. There is no way we can filter it out.

    The only way to filer the small movements is this:
    Let say, all the setup conditions are applied and the EA gives a Long Signal. Normally we would immediately jump into the market. But this time we wait until the market has moved letís say 200 pips up. Then we go long (if the conditions are still UP) because the chances are big at this point that a trend has started.
    To wrapped al up:
    • EA gives a Long Signal at let say 1,3500
    • The market moves 200 pips up to 1,3700
    • The Long Signal is still valid
    • Then we enter Long at 1,3700
    • We add more lots once the market goes another 200 pips up.

    I tried to code the above strategy into this EA but unfortunately without any success.
    Can someone help me out with this concept and add it into the EA that I have enclosed.

    Cheers,
    Shahram
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Jan 2011
    Location
    Austria
    Posts
    36

    Default

    Will take a look at this later this day. To filter ranging markets, a possible solution could be to use suport/resistance levels. If e.g. the levels stay unchanged (within a Range of +/- x PIPs, depending on the timeframe), the market is ranging and we will not trade.
    Waiting for big moves could be a problem as the trend could change to the opposite direction when we enter. If your signals are clear and the only problem is in ranging markets, it should be possible to find a solution for that.

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    13

    Default

    Hi Chris,
    Te signals are definitely clear. The strategy is based on price action and if you back test it you will see that this strategy works only on trending markets and it rides all the way up/down. I spent lots of time by studying charts to find out this simple strategy. I believe in simplicity KISS.

    The trouble is that 60% of the time the markets ranges and flapping around. That why many traders losses money. To filter those out I use 4 moving averages. Unfortunately it is not 100% accurate.

    On this EA I donít use the settings TP and SL. Instead of that I use dynamic (moving averages) for TP and SL.
    • TP is: if MA10 cross MA50 or MA30 cross MA50. If those conditions applied it means usually weakening of the trend and itís time to exit the market.
    • SL is SMA100. If the price breaks up/down the SMA100 depending of the trade (long/short). That to me means the end of the big trend.


    The challenge is right now to filter the false signals. I like your idea by using support and resistance. I hoop you can find a solutions for it.

    Cheers
    Shahran

  4. #4

    Default

    I'm working on a similar project... Try increasing the lot size after each false trigger / losing trade so that when then eventual trend hits you will profit more and offset your small loses.

  5. #5
    Member
    Join Date
    Jan 2011
    Location
    Austria
    Posts
    36

    Default

    OK, just took a look at this ...
    With the MA approach you miss the optimal entry point. But when looking at the chart, there is something quite obvious which you can use to filter for "wrong" ranging signals.
    Try to do this:

    Buy Signal: Same rules as you use atm, but additionally SAR > MA(100)
    Sell Signal: Same Rules, SAR < MA(100).

    So you will only enter a trade when SAR confirms that there was a big up-/downtrend which indicates the "beginning" of a trending market.

    I will do the backtest later, but this could work quite good at least on the H4 timeframe. Didn't look ath the others yet.

    Edit:
    Here are the backtest results. Backtested from 2010/01 until today, initial deposit 10.000, no money management.
    Your Version: +53.27, RDD 10.92%
    With the SAR rule added: +841.59 RDD 7.50%

    I know it misses some trades now and enters later, but it makes good profits with little losses.
    When adding a money management and maybe optimizing with SL and TP, it this could be a quite good EA
    Attached Files Attached Files
    Last edited by CodingChris; 01-29-2011 at 16:39.

  6. #6
    Member
    Join Date
    Apr 2010
    Location
    Canada,Panama,USA
    Posts
    76

    Default

    Quote Originally Posted by CodingChris View Post
    OK, just took a look at this ...
    With the MA approach you miss the optimal entry point. But when looking at the chart, there is something quite obvious which you can use to filter for "wrong" ranging signals.
    Try to do this:

    Buy Signal: Same rules as you use atm, but additionally SAR > MA(100)
    Sell Signal: Same Rules, SAR < MA(100).

    So you will only enter a trade when SAR confirms that there was a big up-/downtrend which indicates the "beginning" of a trending market.

    I will do the backtest later, but this could work quite good at least on the H4 timeframe. Didn't look ath the others yet.

    Edit:
    Here are the backtest results. Backtested from 2010/01 until today, initial deposit 10.000, no money management.
    Your Version: +53.27, RDD 10.92%
    With the SAR rule added: +841.59 RDD 7.50%

    I know it misses some trades now and enters later, but it makes good profits with little losses.
    When adding a money management and maybe optimizing with SL and TP, it this could be a quite good EA
    Hello CodingChris:
    Was this EA ever posted in the Elite Section for further refinement? Or, did you do any revisions after v1.1.mq4 posted above in post#5?
    I would like you to look at an EA I have to improve, then post on this Forum. If interest please PM me.
    Thanks,
    Atlas1

Similar Threads

  1. RENKO trend trading EA
    By IL_DUCA in forum Ideas for expert advisors
    Replies: 4
    Last Post: 05-15-2014, 15:16
  2. Intraday Trend Following Trading System
    By fxEAlover in forum Trading discussion
    Replies: 0
    Last Post: 01-21-2014, 05:08
  3. Intraday Trend Following Trading System
    By fxEAlover in forum Ideas for manual systems
    Replies: 0
    Last Post: 01-21-2014, 05:05
  4. How To Improve Your Trend Line Trading
    By TrendLineTrader in forum Trading discussion
    Replies: 10
    Last Post: 11-28-2010, 12:31
  5. Trend trading EA need code
    By saambask in forum Ideas for expert advisors
    Replies: 0
    Last Post: 06-02-2010, 03:50

Tags for this Thread

100, add, adx, atm, backtest, ea works, elite, indicators, low, mq4, pips, price action, profit, resistance, signal, signals, simple, sma, strategy, support, test, time, trading, trend, trend trading

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •