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;
#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
//---
//| 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:
- try to get prices for all symbols at once (in the example above for "EURUSD", USDJPY" and "AUDUSD")
- or for each symbol separately.
Vladimir,
Can you please add an optional Trailing Stop to your expert?
Really appreciate it.
Thanks
CamarillaGorilla :
Vladimir,
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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
EMA_WMA:
Author: Vladimir Karputov