indicator to allow ticker with suffix to work on signals

To add comments, please log in or register
johmabe
34
johmabe  

Just got a signal and it is sent to tickers EURUSD.m, GBPUSD.m 


I'm allowed to trade EURUSDMicro, and don't want to take the huge lots of EURUSD so I'd like to adapt this signal on my side (user). I gathered by reading the forum that creating an indicator to make MT5 recognize only the 6 first letters of the ticker would be a solution, but the code posted doesn't work anymore when I compile, and I don't know much about coding either. 


So can anyone fix this code that another forumer posted?


.

.

}

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,const int prev_calculated,

                const datetime &Time[],

                const double   &Open[],

                const double   &High[],

                const double   &Low[],

                const double   &Close[],

                const long     &TickVolume[],

                const long     &Volume[],

                const int      &Spread[])

{

.

.

.

InitSymbolNames();

.

.

.

//--- done

   return(rates_total);

}

//+------------------------------------------------------------------+

void InitSymbolNames()

  {

   AddSymbolToMarketWatch(SYMBOLS_NAMES[1],"EUR","eur","GBP","gbp");

  }

//+------------------------------------------------------------------+

string AddSymbolToMarketWatch(string name,string PART_1,string part_1,string PART_2,string part_2)

  {

   name=empty_symbol;                // Symbol name

   total_symbol=SymbolsTotal(false);          //--- Total symbols on the server

//--- Iterate over the entire list of symbols

   for(int i=0;i<total_symbol;i++)

     {      

      if(

         (SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_BASE)==PART_1&&SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_PROFIT)==PART_2)

         ||

         (SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_BASE)==part_1&&SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_PROFIT)==part_2)

        )

        {

         name=SymbolName(i,false);  //--- If this symbol is available,

         SymbolSelect(name,true);   //--- add it to the Market Watch window and

         return(name);              //--- return its name

         break;

        }

     }

   return(name);

  }

//********************************************************************************************************************

Sergey Golubev
Moderator
106112
Sergey Golubev  
johmabe
34
johmabe  

I was unable to edit the post, sorry, but here is the SRC


.
.
}
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,
                const datetime &Time[],
                const double   &Open[],
                const double   &High[],
                const double   &Low[],
                const double   &Close[],
                const long     &TickVolume[],
                const long     &Volume[],
                const int      &Spread[])
{
.
.
.
InitSymbolNames();
.
.
.
//--- done
   return(rates_total);
}
//+------------------------------------------------------------------+
void InitSymbolNames()
  {
   AddSymbolToMarketWatch(SYMBOLS_NAMES[1],"EUR","eur","GBP","gbp");
  }
//+------------------------------------------------------------------+
string AddSymbolToMarketWatch(string name,string PART_1,string part_1,string PART_2,string part_2)
  {
   name=empty_symbol;                // Symbol name
   total_symbol=SymbolsTotal(false);          //--- Total symbols on the server
//--- Iterate over the entire list of symbols
   for(int i=0;i<total_symbol;i++)
     {      
      if(
         (SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_BASE)==PART_1&&SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_PROFIT)==PART_2)
         ||
         (SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_BASE)==part_1&&SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_PROFIT)==part_2)
        )
        {
         name=SymbolName(i,false);  //--- If this symbol is available,
         SymbolSelect(name,true);   //--- add it to the Market Watch window and
         return(name);              //--- return its name
         break;
        }
     }
   return(name);
  }
//********************************************************************************************************************
johmabe
34
johmabe  
johmabe:

I was unable to edit the post, sorry, but here is the SRC



up

Marco vd Heijden
Moderator
8166
Marco vd Heijden  

What is the error ?

To add comments, please log in or register