How to limit "number" of trading symbols? if I drag EA into 28 pairs but want to limit only 4 pairs. ?
-
How to limit "number" of trading symbols? if I drag EA into 28 pairs but want to limit only 4 pairs that activate it's condition first to trade. ?
-
In other words, the 4 pairs can say if the ea trades or not?
You will need global variables, so the eas can talk to each other -
can kindly you show some example?
-
Wow, what? I know that the way EAs can communicate is by those terminal variables that are called Global Variables in MetaTrader (click F3). Or maybe you can do it in the EA. remember that the trading blocks (No trade and others) can filter the trades by magic number (Group), symbol and type, but you can exclude some of them if you want.
-
Hi fxdreema,
Can this condition block limit pair traded at one time?
https://fxdreema.com/shared/2ckslDrgd
A bit difficult to test the idea due to backtest only allow one pair at one time.
Thanks.
-
This purple dot (on Trade) thing is only to be used under the "on Trade" event, it doesn't mean that there are trades from 5 markets out there. There is nothing actually to check how many pairs are traded at the moment and as long as I remember you are the first one to ask for such thing. Or at least this is what I think you are asking for, I'm not sure. But true, the Tester in MT4 is very limited with that 1 pair only.
-
Hi again fxDreema,
At least, you got what my idea it is.
In order to make you grasp my idea fully, let me explain more.
When the condition in my EA met, buy/sell trade will initiate.
Let say the idea only 4 symbols/pairs are allow to trade simultaneously.
For this situation, 4 symbols/pairs already initiate a trade. Doesn't matter how many trade(layer/volume added) in these pairs, as long as only 4 of these symbols/pairs were involved.
If the condition also met in the 5th symbol/pair, buy/sell trade will not initiate until one or more current symbols/pairs traded have reach Take Profit/closed trade. This is to maintain 4 symbols/pairs limitation.
This idea is very useful if account balance was limited.
Let say, my account balance can only withstand 4 symbols traded at one time (unrealized loss/floating amount).
I just imposed the condition to trade only 4 symbols at one time.
So, with this idea we can limit any numbers of symbols to be traded at one time depending on account balance.
This is due to known fact
, we don't know which symbols will initiate trade first. As the EA will be attach to maybe 28 symbols/pairs chart or more.If you can implement this idea, I'm sure our EA will be more flexible with any account balance.
Thanks.
-
@jakkarin79 UP
anyone know how to do this? -
I am creating an EA on fxdreema and I would like some help to limit trades per currency. I intend to trade eurcad, eurusd, nzdusd, usdcad, usdjpy and euraud but I want to trade no more than one usd and no more than 2 EUR. I turned to AI for help because this question was asked before but it was not clearly resolved. It gave a 5 steps process . I am unable to implement all the Steps except step 1 and step 3 . Below find the steps and provide help . To limit trades per currency in fxDreema â specifically:
âą
No more than 1 USD trade
âą
No more than 2 EUR trades
â across pairs like EURCAD, EURUSD, NZDUSD, USDCAD, USDJPY, and EURAUD, follow this step-by-step guide using fxDreemaâs built-in blocks (no custom MQL4 coding required).
đ§ Concept:
Weâll:- Loop through all open trades
- Count how many contain "USD" or "EUR" in their symbol
- Use conditions to block new entries if the limit is reached
Step-by-Step in fxDreema
Step 1: Define Your Variables
Go to the âVariablesâ tab and create:
Name Type Initial Value
usdCount int 0
eurCount int 0
These will track the number of open USD and EUR trades.
Step 2: Reset Variables on Every Tick
In the âon Tickâ event, add two blocks:
âą Set Variable â usdCount = 0
âą Set Variable â eurCount = 0
This ensures we reset before recounting each time.
Step 3: Loop Through All Open Trades
Add a block:
Block: For each Trade
Scope: All Trades
This will loop through each open trade.
Step 4: Inside the Loop â Count Currencies
†Check if Trade Symbol Contains "USD"
âą Condition block:
o Left: Symbol
o Is: Contains
o Right: "USD"
â Connect this to a Modify Variables block:
âą Variable: usdCount
âą Action: Add
âą Value: 1
†Check if Trade Symbol Contains "EUR"
âą Condition block:
o Left: Symbol
o Is: Contains
o Right: "EUR"
â Connect this to another Modify Variables block:here is the link for the project. https://fxdreema.com/shared/ytofVuile
-
The logic is correct. The problem is that fxDreema condition blocks do not use that 'contains' options, sadly. I think the only option here should be using custom code or a programmer (I'm not one, sorry) could confirm is we could use the '*USD' form on the 'text(code input)' display option. More than that, I'm afraid I cannpt be more helpful.
-
Thanks. I will look for a programmer to help with coding.
-
You're welcome.