MT5 EA for market watch and multiple timeframes ?

DroidM

Trader
May 21, 2020
12
0
6
23
Is it possible to have an EA attached on a single chatt and have it trade across all the pairs on the market watch and across multiple timeframes ?
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,000
805
144
Odessa
www.earnforex.com
To open a trade in another currency pair you just substitute _Symbol with something else in the CTrade's PositionOpen method. E.g.:
MQL5:
Trade.PositionOpen(_Symbol, ORDER_TYPE_BUY, Lots, Ask, SL, TP);
becomes:
MQL5:
Trade.PositionOpen("AUDUSD", ORDER_TYPE_BUY, Lots, Ask, SL, TP);

To analyze data from other currency pairs and timeframes, you just use iOpen(), iHigh(), iLow(), iClose() with whatever parameters (symbol/timeframe) you want.
 

DroidM

Trader
May 21, 2020
12
0
6
23
To open a trade in another currency pair you just substitute _Symbol with something else in the CTrade's PositionOpen method. E.g.:
MQL5:
Trade.PositionOpen(_Symbol, ORDER_TYPE_BUY, Lots, Ask, SL, TP);
becomes:
MQL5:
Trade.PositionOpen("AUDUSD", ORDER_TYPE_BUY, Lots, Ask, SL, TP);

To analyze data from other currency pairs and timeframes, you just use iOpen(), iHigh(), iLow(), iClose() with whatever parameters (symbol/timeframe) you want.
Can i create a function called symbols1 in which i can create an infinite loop of all the market watch symbols and have it return a string ? Same with timeframes ? So with every tick the EA is watching all pairs and all timeframes for my setup
 

Enivid

Administrator
Staff member
Nov 30, 2008
16,000
805
144
Odessa
www.earnforex.com
Can i create a function called symbols1 in which i can create an infinite loop of all the market watch symbols and have it return a string ? Same with timeframes ? So with every tick the EA is watching all pairs and all timeframes for my setup
Yes, you can loop through all symbols (either only those in Market Watch or ALL symbols present in your broker's server) and do whatever you want with them.
 

DroidM

Trader
May 21, 2020
12
0
6
23
Yes, you can loop through all symbols (either only those in Market Watch or ALL symbols present in your broker's server) and do whatever you want with them.
Could you please share how ? Or redirect me to an article i can learn from ?
 

DroidM

Trader
May 21, 2020
12
0
6
23
I've been trying to code my strategy into an EA and i use all symbols and all timeframes when using my scalping strategy, i've been trying to do the same with the EA and end up with some error, i am still a little new to coding and my code may be completely wrong but someone help me out. If im using iRSI for example, i want to enter sym for symbol and and TF for period in the parameters.
MQL5:
int symbol= SymbolsTotal(1);
  for(int sym=0;sym<symbol;sym++)
 
  ENUM_TIMEFRAMES period[10]={PERIOD_M1,PERIOD_M2,PERIOD_M3,PERIOD_M4,PERIOD_M5,PERIOD_M6,PERIOD_M10,PERIOD_M12,PERIOD_M15,PERIOD_M20};
  for(int TF=0;TF<10;TF++)