Ea Gold

 
Hey!  I am writing Ea on Gold (XAUUSD).  What code should I use to automatically use EA it only on gold.  How to pass the tests before putting the ready EA on the market.  Please help.
 

There is one article which every seller on the market should read: it is about validation of the Market products - 

---------------- 

The checks a trading robot must pass before publication in the Market

Why products are checked before they are published in the Market 

Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products.

If any errors are identified by the Market moderators in the process of checking your product, you will have to fix all of them. This article considers the most frequent errors made by developers in their trading robots and technical indicators. We also recommend reading the following articles: 

 
Marcin Brylkowski:
Hey!  I am writing Ea on Gold (XAUUSD).  What code should I use to automatically use EA it only on gold.  How to pass the tests before putting the ready EA on the market.  Please help.
#include <Trade\SymbolInfo.mqh>

//--- create symbol object
CSymbolInfo m_symbol;

int OnOnit()
{
        if(m_symbol.Name(Symbol())
        {
         string this_symbol = Symbol();
         Print(this_symbol);
         //--- check if this_symbol is XAUUSD
         if(this_symbol!="XAUUSD")
           return(INIT_FAILED);
return(INIT_SUCEEDED);
}
/*
        Note the symbol on your market watch. some brokers have gold as XAUUSDm or something different. 
        You need to write a more complex code to make it work on all gold pairs with or without the variations. 
        I hope you can learn from this example and implement it yourself. 
        Good luck man.
*/