How to run an EA on multiple symbols by sticking it to one chart

To add comments, please log in or register
Patrick A.
141
Patrick A.  

Hello, 

I would like to run my EA on all Forex Majors and Forex Minors, I've got my code all done, but I want it to automatically run on all symbols in my market watch. 

Here is my code, its very simple, can someone please help in showing me how I can make this run automatically on all Symbols or Symbols in my market watch


   double RSI = iRSI(NULL,15,7,PRICE_CLOSE,0);

   double Stoc = iStochastic(NULL,15,5,3,3,MODE_SMA,STO_LOWHIGH,0,0);

   double BoliUpper = iBands(NULL,15,20,2,0,PRICE_MEDIAN,1,1);

   double BoliLower = iBands(NULL,15,20,2,0,PRICE_MEDIAN,2,1);   

   double CandlePrevHigh = iOpen(NULL,15,1);

   double CandlePrevLow = iClose(NULL,15,1);

   if ((RSI > 75) && (Stoc > 80)&& (BoliUpper < CandlePrevHigh) )

   {

    Alert(Symbol()+" is over bought");

   }

   else if ((RSI < 25) && (Stoc < 20)&&(BoliLower>CandlePrevLow))

   {

    Alert(Symbol()+" is over sold");

   }



=====================================================================================================================================================================================

Please help



Marco vd Heijden
Moderator
8180
Marco vd Heijden  
//+------------------------------------------------------------------+
//| loop through all symbols                                         |
//+------------------------------------------------------------------+
for(int i=0;i<SymbolsTotal(1);i++)
  {
   Print("SYMBOL: ",SymbolName(i,1)," Found At: ",i);
   
   // Do Something...
  }
//+------------------------------------------------------------------+
Mohamad Zulhairi Baba
16048
Mohamad Zulhairi Baba  
social_junkie:

Hello, 

I would like to run my EA on all Forex Majors and Forex Minors, I've got my code all done, but I want it to automatically run on all symbols in my market watch. 

Short answer:
Replace NULL with intended symbol, then repeat for the next symbol
example double RSI = iRSI("EURUSD",15,7,PRICE_CLOSE,0);

soubra2003
31847
soubra2003  

it is enough to be an indicator 

why you creating it as an EA?

Cornelis Duiker
1498
Cornelis Duiker  

Combine Marco and Mohamad above

//+------------------------------------------------------------------+
//| loop through all symbols                                         |
//+------------------------------------------------------------------+
for(int i=0;i<SymbolsTotal(1);i++)
  {
   Print("SYMBOL: ",SymbolName(i,1)," Found At: ",i);
   
   // Do Something...
    example double RSI = iRSI(SymbolName(i,1),15,7,PRICE_CLOSE,0);
  }
//+------------------------------------------------------------------+
To add comments, please log in or register