How to Auto Trade All Symbols?

 

Good day,

I'm still learning MT4 and I have this quick question. Once I dragged the EA to the chart and clicked the auto trading button on the tools bar, will the EA trade on all symbols or it only will trade on the symbol of the current chart? if so how to trade on all other symbols?

Regards,

 
Jose Daniel Stromberg Martinez #:

<Incorrect post deleted>

Does this mean that if I want to auto trade all symbols I need to open a chart for each symbol and drag the EA to it?
 
matrixyb #:
Does this mean that if I want to auto trade all symbols I need to open a chart for each symbol and drag the EA to it?

No that is incorrect. 

You can trade multiple symbols from one EA attached to one chart, but you will need to code your EA appropriately to deal with it and pay extra attention to the synchronisation of data for other symbols not on the current chart.

 
Paul Anscombe #:

No that is incorrect. 

You can trade multiple symbols from one EA attached to one chart, but you will need to code your EA appropriately to deal with it and pay extra attention to the synchronisation of data for other symbols not on the current chart.

I got you.

Now on the EA if I have if statment to check the condition like this for example

if(iRSI(_Symbol,PERIOD_CURRENT,ii_RSIPeriod,PRICE_CLOSE,0) )

{

OrderSend (_Symbol,OP_BUY,0.10,Ask,5,Ask-0.1,Ask+0.03*_Point,NULL,0,0,Green);

}

Do you have an idea how to change this to to make it go symbol by symbol and check the condition insted of just doing it for _Symbol?

 
matrixyb #:

I got you.

Now on the EA if I have if statment to check the condition like this for example

Do you have an idea how to change this to to make it go symbol by symbol and check the condition insted of just doing it for _Symbol?

change _Symbol to the symbol name you want to trade, change PERIOD_CURRENT to an explicit period, change _Point to the correct value for the symbol.

BUT  if you don't check and sync data then you will end up with all sorts of problems including failed orders.

have a look through code base and find some multi-symbol EAs and have a look at how they work.

 
Paul Anscombe #:

change _Symbol to the symbol name you want to trade, change PERIOD_CURRENT to an explicit period, change _Point to the correct value for the symbol.

BUT  if you don't check and sync data then you will end up with all sorts of problems including failed orders.

have a look through code base and find some multi-symbol EAs and have a look at how they work.

Through a quick searching in the code base, I couldn't find anything about what I'm looking for.

I think I need to structure a "for" statement or something similar to check them one by one but the problem is symbol goes by name not number so that you cannot depend on integer to do the work

You have any idea how to begin or EAs on the base code to look for

 
matrixyb #:

Kod tabanında hızlı bir arama yaparak aradığım şey hakkında hiçbir şey bulamadım.

Bunları tek tek kontrol etmek için bir "for" ifadesi veya benzer bir şey yapılandırmam gerektiğini düşünüyorum, ancak sorun sembolün sayıya göre değil isme göre gitmesidir, böylece işi yapmak için tamsayıya güvenemezsiniz.

Aramak için temel kodda nasıl başlayacağınız veya EA'lar hakkında herhangi bir fikriniz var.

use string for symbols

 
Ahmet Metin Yilmaz #:

use string for symbols

What I meant is that you cannot do this

for(int i = Symbols; i>0; i-)

Since _Symbol in the RSI formula isn't integer

 
matrixyb #: Now on the EA if I have if statment to check the condition like this for example
if(iRSI(_Symbol,PERIOD_CURRENT,ii_RSIPeriod,PRICE_CLOSE,0) )

iRSI does not return a boolean.

 
matrixyb #:

Through a quick searching in the code base, I couldn't find anything about what I'm looking for.

I think I need to structure a "for" statement or something similar to check them one by one but the problem is symbol goes by name not number so that you cannot depend on integer to do the work

You have any idea how to begin or EAs on the base code to look for

you can use an array of symbol names to then use with an integer loop.

based on your comments I think you are a long way off having the programming skills to implement a multi-symbol EA at the moment, you could use the freelance section.

 

Here I found a way


input bool InpMarketWatch=true;
int m_num_symbols;
int i;
m_num_symbols = SymbolsTotal(InpMarketWatch); 

for(i=0; i<m_num_symbols; i++)
{
        if(iRSI(SymbolName(i,InpMarketWatch),PERIOD_CURRENT,19,PRICE_CLOSE,0)==20)
        {
                OrderSend (SymbolName(i,InpMarketWatch),OP_BUY,0.10,Ask,5,Ask-0.1,Ask+0.03*_Point,NULL,0,0,Green);
        }
}


That was it. Thank to all who tried to help

Reason: