Noob question. I'm trying to get my EA to take multiple trades, 1 per pair at a time to avoid FIFO. Example - EURUSD - 1 trade / GBPUSD - 1 Trade / USDCHF - 1 trade. The EA I am utilizing has settings for both MaxTrades/Tradesperbar . Can someone help me understand the difference, please. I don't want the EA to open up 4 trades in EURUSD and avoid trading on the other pairs, I would like for it to have one open trade per pair when possible, if that makes sense. Thanks.
- How to trade one pair only?
- EA to take screenshot of chart when trade is opened
- MQL4 Programming Help!!! - Only One Opened Trade Pair, Per Signal.
Tactikill44 :
Noob question. I'm trying to get my EA to take multiple trades, 1 per pair at a time to avoid FIFO. Example - EURUSD - 1 trade / GBPUSD - 1 Trade / USDCHF - 1 trade. The EA I am utilizing has settings for both MaxTrades/Tradesperbar . Can someone help me understand the difference, please. I don't want the EA to open up 4 trades in EURUSD and avoid trading on the other pairs, I would like for it to have one open trade per pair when possible, if that makes sense. Thanks.
Noob question. I'm trying to get my EA to take multiple trades, 1 per pair at a time to avoid FIFO. Example - EURUSD - 1 trade / GBPUSD - 1 Trade / USDCHF - 1 trade. The EA I am utilizing has settings for both MaxTrades/Tradesperbar . Can someone help me understand the difference, please. I don't want the EA to open up 4 trades in EURUSD and avoid trading on the other pairs, I would like for it to have one open trade per pair when possible, if that makes sense. Thanks.
Before sending a trading signal (or even better: as soon as a signal to open a position has been generated), it is necessary to check how many positions are open for this symbol.
An example of checking the number of positions by symbol - excluding Magic number:
//+------------------------------------------------------------------+ //| IsPositionExists.mq5 | //| Copyright © 2020, Vladimir Karputov | //+------------------------------------------------------------------+ #property copyright "Copyright © 2020, Vladimir Karputov" #property version "1.000" #include <Trade\PositionInfo.mqh> //--- CPositionInfo m_position; // object of CPositionInfo class //--- input parameters input int Input1=9; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { if(!IsPositionExists("EURUSD")) { //--- open positions "EURUSD" } else { return; } //--- if(!IsPositionExists("USDJPY")) { //--- open positions "USDJPY" } else { return; } //--- } //+------------------------------------------------------------------+ //| Is position exists | //+------------------------------------------------------------------+ bool IsPositionExists(const string symbol) { for(int i=PositionsTotal()-1; i>=0; i--) if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties if(m_position.Symbol()==symbol) return(true); //--- return(false); } //+------------------------------------------------------------------+
Files:
IsPositionExists.mq5
5 kb
Tactikill44: MaxTrades/Tradesperbar . Can someone help me understand the difference,
- Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Without the code we can only guess. Post the code or ask the owner.
- MaxTrades could be maximum count of trades on a symbol or all symbols.
- Tradesperbar seams self-evident but you would only have multiple signals if it trades using bar zero.
- If the EA only trades the current symbol you might be able to limit one trade per symbol using MaxTrades. Otherwise no idea without the code.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register