Wave Trend Expert Advisor Issue

 

Hi Traders

Im trying to create a small expert advisor for wave trend indicator.

Im doing something wrong here, as im a new bee to this mql4 coding.

I have indicator for it, but im trying to create EA to buy and sell automatically.

my conditions are,

if wave trend indicator is below -60 and crossed, buy

if wave trend indicator is above 60 and crossed, sell

I attached the indicator. Please assist or guide me to resolve this. Thank you very much


      double BullBuffer;
      double BearBuffer;
      double ap;
      double WaveMABuffer;
      double Buffer_4;
      double Buffer_5;
      double Buffer_6;
 
      ap = (High[1] + Close[1] + Low[1]) / 3.0;
      WaveMABuffer = iMA(NULL, 0, WavePeriod, 0, MODE_EMA, ap, 1);
      Buffer_6 = MathAbs(ap - WaveMABuffer);
      Buffer_4 = iMA(NULL, 0, WavePeriod, 0, MODE_EMA, Buffer_6, 1);
      Buffer_5 = (ap - WaveMABuffer) / (0.015 * Buffer_4);
      BullBuffer = iMA(NULL, 0, AvgPeriod, 0, MODE_EMA, Buffer_5, 1);
      BearBuffer = iMA(NULL, 0, 4, 0, MODE_SMA, BullBuffer, 1);

      if (BullBuffer >= BearBuffer) {
         Alert("buy ");
      }

      if (BullBuffer <= BearBuffer) {
         Alert("sell");
      } 
Create Your Own Expert Advisor in MQL5 Wizard
Create Your Own Expert Advisor in MQL5 Wizard
  • www.mql5.com
The knowledge of programming languages is no longer a prerequisite for creating trading robots. Earlier lack of programming skills was an impassable obstacle to the implementation of one's own trading strategies, but with the emergence of the MQL5 Wizard, the situation radically changed. Novice traders can stop worrying because of the lack of...
Files:
 
psraju:

When posting code please use the code button (Alt+S). Edit your post to display the code correctly.

Anything to do with MT4, please post in the correct section.

I will move your topic to the MQL4 and MT4 section.

 
  1. Perhaps you should read the manual.
    Your code
     Documentation
    Buffer_4 = iMA(
    NULL, 
    0, 
    WavePeriod, 
    0, 
    MODE_EMA, 
    Buffer_6,         
    1
    );
    double  iMA(
       string       symbol,           // symbol
       int          timeframe,        // timeframe
       int          ma_period,        // MA averaging period
       int          ma_shift,         // MA shift
       int          ma_method,        // averaging method
       int          applied_price,    // applied price
       int          shift             // shift
       );
    Your double variable is not a ENUM_APPLIED_PRICE

  2. Use SRC.
  3. Post in the correct place.
 

Thank you for the information.

I see this in the indicator 

 iMAOnArray(Buffer_5, 0, AvgPeriod, 0, MODE_EMA, i);

I dont know how to code this in EA. 

Reason: