What is the best way to make an EA or Indicator compatible with different brokers, where market symbols are different?

 

Hi everyone!


it just occured to me that ECN brokers use symbols in the format of EURUSDi instead of the usual symbol EURUSD,  while other brokers

also use:

  • '.i'  Blueberry markets ECN accounts
  • '.' Tier1FX Demo accounts
  • '.pro' Axitrader PRO accounts
  • '-2' Oanda rebate accounts
  • 'i' TradersWay ECN accounts


EAs and indicators that use symbols of the format type EURUSD will not run on ECN platfroms where symbols have the 'i' suffix,  and I am more in need of the ECN format, with the i suffix,


I guess it's quicker to make one more version of all the programs,  in ECN compatible format,  I am allowed to have 2 versions of each product?

or will have to program external string variables for all symbols used and offer one version?

or what is the standard way of doing this?


Thanks in advance!

 

You can use Symbol() and SymbolName() function then it will always use the instrument name with the correct pre and post fix.

 
string last_char  = StringSubstr(Symbol(),6);
 

The thing is,  I use various pairs that are not related to the actual chart,  some EURUSD indicators use data from the EURCHF, EURAUD, AUDUSD and USDCHF pairs,

I will check your recommendations,  thanks!!

 

This is what i use. 

    for(int x=ArraySize(assets)-1;x>=0;x--)
    {     
      for(int y=ArraySize(assets)-1;y>=0;y--)
      {
        for(int i=SymbolsTotal(false)-1;i>=0;i--)
        {
        
          string smb=SymbolName(i,false);

          if ((SymbolInfoString(smb,SYMBOL_CURRENCY_BASE)==assets[x].asset  
            && SymbolInfoString(smb,SYMBOL_CURRENCY_PROFIT)==assets[y].asset )
             ) 
          {
            SymbolSelect (smb,true);
            int count = ArraySize(pairs);
            ArrayResize (pairs,count+1);
            pairs[count].currencyBase = SymbolInfoString(smb,SYMBOL_CURRENCY_BASE);
            pairs[count].currencyProfit = SymbolInfoString(smb,SYMBOL_CURRENCY_PROFIT);
            pairs[count].pair = smb;
          }  
        }
      }
    } 
 
GEORGIOS VERGAKIS:

The thing is,  I use various pairs that are not related to the actual chart,  some EURUSD indicators use data from the EURCHF, EURAUD, AUDUSD and USDCHF pairs,

I will check your recommendations,  thanks!!

This is not a problem when you use SymbolName(pos,1)