Experts: EMA_WMA

 

EMA_WMA:

EMA_WMA - Expert Advisor for MetaTrader 5. Intersection of two iMA (MA).

Author: Vladimir Karputov

 

Do I have to have a line? If I make, for example, a multicurrency Expert Advisor

m_symbol.Name(Symbol()); // sets symbol name

 

If you need to get information on several symbols, then you just need to declare several objects of CSymbolInfo class:

#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>  
#include <Trade\AccountInfo.mqh>
CPositionInfo  m_position;                   // trade position object
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol_EURUSD;              // symbol info object
CSymbolInfo    m_symbol_USDJPY;              // symbol info object
CSymbolInfo    m_symbol_AUDUSD;              // symbol info object

CAccountInfo   m_account;                    // account info wrapper
input int      period_EMA     = 28;
input int      period_WMA     = 8;

Everything else is standard - initialise them:

//+------------------------------------------------------------------+
//| Expert initialisation function|
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   m_symbol_EURUSD.Name("EURUSD");           // sets symbol name
   m_symbol_USDJPY.Name("USDJPY");           // sets symbol name
   m_symbol_AUDUSD.Name("AUDUSD");           // sets symbol name
//---

And you will also need to rewrite the RefreshRates() function - there are two options here:

  1. try to get prices for all symbols at once (in the example above for "EURUSD", USDJPY" and "AUDUSD")
  2. or for each symbol separately.

 
Vladimir,

Can you please add an optional Trailing Stop to your expert?

Really appreciate it.

Thanks 

 
CamarillaGorilla :
Vladimir,

Can you please add an optional Trailing Stop to your expert?

Really appreciate it.

Thanks 

Expect to publish in the Russian part of the forum: EMA_WMA v2