1

I have a trading strategy based on ADX, in a simplest way I enter when ADX is above 30 both on the 30 minutes and hourly chart.

I need to create an EA in MQL5 just to give me a sound alert, when ADX has hit level 30 both on 30 minutes and hourly timeframe.

I would really appreciate if someone can help me with that.

user3666197
  • 1
  • 6
  • 43
  • 77
  • and what is the problem? what is your mvce example to follow/comment? Alert() for alerts, keep ADX handles and recalculate them each tick/each bar/whenever you need that, example of that you can found in mt5 (examples of EA's) – Daniel Kniaz Aug 02 '17 at 21:06
  • **Would you mind to read about how to ask** the MCVE-based questions? StackOverflow encourages users to present a **M**inimum ( efficiency ) + **C**omplete ( self-contained -- Yes -- also with data ) + **V**erifiable ( ready for re-runs ) + **E**xamples ( a full example, with all details+data, to allow others do re-testing ) of code, that you tried to make work and struggle to make it work right. **The best next step is to learn about this Community practice+ revise & complete your MCVE** above. Anyway, **welcome in this great Community of Knowledge & become our active, contributing member.** – user3666197 Aug 02 '17 at 23:23

1 Answers1

0

So,
let's move on:

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{

  if (  iADX( _Symbol, PERIOD_H1,  anAvgPERIOD, PRICE_HIGH, MODE_MAIN, 0 ) > 30.
     && iADX( _Symbol, PERIOD_M30, anAvgPERIOD, PRICE_HIGH, MODE_MAIN, 0 ) > 30.
        ){

        PlaySound( "aFileWithDesiredSOUND.wav" );
  }
}

One ought not be surprised, that this does not work for obvious reasons in the MT4 Strategy Tester.

user3666197
  • 1
  • 6
  • 43
  • 77