Need some coding help

 

I have a couple different EA's that I designed.  But the programmer I used just closed his business and doesn't take coding jobs anymore.

I would like to make a simple modification to all of the ea's.  Basically, I want to add the function that if the current Heiken Ashi candle on the chart is bullish, the ea will open only long trades.  If the candle is bearish, the ea will open only sell trades.  Also, when the change from bullish to bearish, or vice versa, occurs all open trades in the opposite direction will close.

What would be ideal is if I could get the coding for this so that I could just copy and paste it into the existing code for all of the EA's that I want to add that function to.

If anyone could help me out with this it would be much appreciated.

I just this week started trying to learn to code in mql4.  But, I have no coding experience, so it is slow going and this would really save me some time.

Thanks!

 
j0e438:

I have a couple different EA's that I designed.  But the programmer I used just closed his business and doesn't take coding jobs anymore.

I would like to make a simple modification to all of the ea's.  Basically, I want to add the function that if the current Heiken Ashi candle on the chart is bullish, the ea will open only long trades.  If the candle is bearish, the ea will open only sell trades.  Also, when the change from bullish to bearish, or vice versa, occurs all open trades in the opposite direction will close.

What would be ideal is if I could get the coding for this so that I could just copy and paste it into the existing code for all of the EA's that I want to add that function to.

If anyone could help me out with this it would be much appreciated.

I just this week started trying to learn to code in mql4.  But, I have no coding experience, so it is slow going and this would really save me some time.

That is not how coding works. It is not possible to just supply you with a "universal" code snippet for you to just copy/paste into your existing code and have it work correctly.

Correcting, modifying or extending an existing EA, requires being able to have access to the current source code in order to be able to understand its structure and how it is implemented in order to create the necessary modification and have it applied correctly.

If your programmer is no longer available, then consider hiring another one, either directly or via the Freelance section.

 

j0e438:

I want to add the function that if the current Heiken Ashi candle on the chart is bullish, the ea will open only long trades.  If the candle is bearish, the ea will open only sell trades.  Also, when the change from bullish to bearish, or vice versa, occurs all open trades in the opposite direction will close.

I could just copy and paste it into the existing code

If anyone could help me out with this it would be much appreciated. But, I have no coding experience,

  1. You need to get the HA values, test direction, and then close opposites and open new order. The first two are easy, the rest you will have to code.
    #define  PRICE double            // A PRICE
    #define     PRICE_MAX   (PRICE)EMPTY_VALUE
    #define     PRICE_MIN   (PRICE)0
    #define     CHANGE      PRICE    // Difference of two prices.
    //+------------------------------------------------------------------+
    //| Heiken Ashi iCustom function                                     |
    //+------------------------------------------------------------------+
    enum HAbuffer{ HA_LOW_HIGH, HA_HIGH_LOW, HA_OPEN, HA_CLOSE, HA_BOTTOM, HA_TOP };
    PRICE    Heiken_Ashi(HAbuffer buf, INDEX iBar){
       return Heiken_Ashi(_Symbol, ENUM_TIMEFRAMES(_Period), buf, iBar);
    }
    PRICE    Heiken_Ashi(ENUM_TIMEFRAMES tf, HAbuffer buf, INDEX iBar){
       return Heiken_Ashi(_Symbol, tf, buf, iBar);
    }
    PRICE    Heiken_Ashi(SYMBOL sym, ENUM_TIMEFRAMES tf, HAbuffer buf, INDEX iBar){
       #define  HA    "Heiken Ashi"
       if(buf < HA_BOTTOM)  return iCustom(sym, tf, HA,
                                           // All four parameters are just colors
                                           buf, iBar);
       PRICE    lh = iCustom(sym, tf, HA, HA_LOW_HIGH, iBar);
       PRICE    hl = iCustom(sym, tf, HA, HA_HIGH_LOW, iBar);
       return HA_BOTTOM == buf ? MathMin(lh, hl) : MathMax(lh, hl);
    }
    :
    if(!isNewBar) return;
    bool isUpTrend = Heiken_Ashi(HA_CLOSE, 1) > Heiken_Ashi(HA_OPEN, 1);
    if(isUpTrend) ...
              New candle - MQL4 and MetaTrader 4 - MQL4 programming forum
              Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum

  2. Cut and paste is not possible. It must be integrated.

  3. You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
              No free help
              urgent help.

 

Thanks for the reply.  I figured it wouldn't be that easy, but I thought I'd ask.  I just started trying to learn to code this week, which is of course a bit intimidating to a beginner. So I thought I'd see if there was any easy solution.  Anyway, I will hopefully be ready to use what you have given me post an attempt within a couple weeks and maybe someone can give me any pointers I need at that point. Thanks for taking the time to respond and point me in the right direction.