MACD Sample

Discussion in 'MetaTrader Expert Advisors' started by Enivid, Dec 13, 2008.

  1. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    Discuss MACD Sample expert advisor. MACD Sample is a standard example MetaTrader 4 EA, which was optimized specifically for GBP/USD currency pair and H4 timeframe is a range pull-back EA with low default take-profit level. You can ask any questions about this expert advisor here.
     
    Last edited: Sep 5, 2017
  2. aharon

    aharon Trader

    17
    1
    9
    hello
    about the macd sample as you can find in mt4 plaform
    1.can anyone here can fix this ea to work so he wont have eror code 130 (it happend with ecn brokers)
    2.put all his parameters out so i can optimize everything there
     

    Attached Files:

    Enivid likes this.
  3. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    I have updated the EA to version 1.01 fixing its work with ECN (Market execution) and adding all the relevant input parameters. You can download it from its description page.
     
  4. aharon

    aharon Trader

    17
    1
    9
    T H A N K Y OU SIR
     
  5. aharon

    aharon Trader

    17
    1
    9

    hello again sir

    i backtest the the ea you fix to work allso with ecn brokers and added external parameters using deafault parameters in mt4 macd sample mql4
    i allso backtest the mt4 macd sample that in mt4 platform and i got other results
    can you do thesame(fix to work with ecn brokers and added external parameters) as you have done in this mql4 file bellow,not at the one that work with gbp 4h,the mt4 deafault one

    thank you for your great support
     

    Attached Files:

  6. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    The actual difference should be only in the input parameters. If you set the input parameters from the EA you just attached into the EA that I've linked to, you should get the same results. And no, I am not interested in doing the same modifications to the attached EA.
     
  7. aharon

    aharon Trader

    17
    1
    9
    hello sir
    i dont have same results .
    thank you anyway for you great support
     
  8. aharon

    aharon Trader

    17
    1
    9
    hello
    is it possible to invert the signal in this macd sample ea ?
    i mean if the ea have a signal to buy at 1.1950 so to make him sell at 1.1948 if spread is 2
    about sl ,tp trailng stop etc allso to be invert to the other direction (if sl is 40 so tp should be 40 ,if tp is 15 so sl will be 15 etc)
    it will help me allot

    thank you
     
    Last edited: Sep 5, 2017
  9. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    Why? You can just swap the entry conditions places and it will work that way. Of course, you might also want to swap places the exit conditions for buy and sell orders.
     
  10. aharon

    aharon Trader

    17
    1
    9
    hello
    im not a programer thats why i dont know at all how to do it (im just a trader)
    mybe you can do this
    it should be a great ea for long term
    hope you can help me

    thank you sir
     
  11. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    You do not need some serious programming skills to do that. I am not interested in applying such a change to an EA, but I will help you if you have some specific questions.
     
  12. aharon

    aharon Trader

    17
    1
    9
    ok thank you for your help
    i have 2 issues
    1.the ea have an OrderModify error 1
    2.can you tell me please step by step how to swap buy with sell ,entry with exit sl with tp etc ,i need this ea to be totaly invert
    i have great result with this strategy if everything will work fine ill send you the pairs ,time frame and inputs
    THANK YOU
     
  13. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    1. That error appears when you try to modify the order with the same values. Normally, this error should not cause any problems - there is just not point to modify an order to set the same parameters as are already there.

    2. Entry conditions are marked with rather explicit commentary in the source code: "check for long position (BUY) possibility" and "check for short position (SELL) possibility". Both exit conditions are marked with the same "should it be closed?" commentary - first is for Buy, second is for Sell. To swap SL and TP, you can just change the SL value to TP value and vice versa.
     
  14. aharon

    aharon Trader

    17
    1
    9
    hello sir and thanks for your answer

    i tryed to do it but dont succes WITH TP AND SL .
    I THINK THAT IN THE MACD EA FROM MT4 (THIS INPUTS I WANT TO INVERT) THERE IS NO SL,
    CAN TOU CHECK THAT AND TELL ME HOW TO INVERT THE SL,TRAILING STOP ETC

    THANK YOU AGAIN FOR YOU GREAT SUPPORT
     

    Attached Files:

  15. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    So, you have 50 pips TP and 30 pips SL (TrailingStop also acts as the initial stop-loss in the original MACD Sample EA). If you want to invert them, you just assign 30 pips to TP and 50 pips to SL. Isn't that obvious?
     
  16. aharon

    aharon Trader

    17
    1
    9
    hello again

    i got 2 errors ,can you please check what is the problem ?
    (i think i have done what you told me )
     

    Attached Files:

  17. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    Remove the extra closing parentheses ("}") on lines 111 and 181 and insert one after line 197.
     
  18. aharon

    aharon Trader

    17
    1
    9
    hello

    thank you for your great support

    i have another 2 errors can you help me again ?
     

    Attached Files:

    • INV.mq4
      INV.mq4
      File size:
      15.8 KB
      Views:
      6
  19. Enivid

    Enivid Administrator Staff Member

    8,360
    289
    114
    It has the same errors as the file you've attached before. One extra curled brack is just on a different line. Try weeding out these errors yourself. It is pretty easy to do as the MetaEditor highlights the syntax and will show you the current opening and closing curled bracket if you put the cursor inside a pair.
     
  20. aharon

    aharon Trader

    17
    1
    9
    Hello
    I would like get results to be exactly the opposite of what you will get if you BT this ea attached by turning the direction of trades, i used aud/usd-5 min chart.
    I've already changed parameters to opposite direction but did not get the exact opposite results in BT
    I would be glad if someone would solve this issue
     

    Attached Files:

    Last edited: Jan 1, 2018

Share This Page