Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 150
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
Good evening!
Please help me write the code, I don't feel I can do it myself, here's the gist:
If you need to do it for you - this is a freelance. And to help you tell what you want to get, show what you have done and describe what failed.
The point is this: here in this thread to help the suffering and the seeking.
If you need to do it for you - that's in the freelance. And to get help, you need to tell what you want to get, show what you're doing and describe what failed.
The point is, I don't understand how to make the EA analyse only the orders of one particular pair, rather than the orders of all pairs in the terminal.
If you can, please give me an idea or code example, as the textbooks describe separately what works and how it works, but there aren't many concrete examples.
I would be grateful for your help.
Thank you.
Its name is High_Low v2 (ZigZag), (in the attachment for some reason the name glitched)
double zz2 = iCustom( NULL, 0, "High_Low v2 (ZigZag)",300, 6, 0, 0);
I.e., I have replaced the name of one custom indicator and its
In the case of fractals, for example, it worked for me.
The point is that I don't understand how to make the EA only count orders of one particular pair, and not the total of all pairs in the terminal.
I don't understand how to make an EA calculate only orders of one particular pair, and not the sum of all pairs in the terminal.
I will be very grateful for help.
I would appreciate it.
feel free to look into the CodeBase - every EA has an order loop :-)
For example https://www.mql5.com/ru/code/16588 (the first one I came across)
for(int index = orders-1; index >= 0; index--)
{
if(OrderSelect(index,SELECT_BY_POS,MODE_HISTORY)==false)
{
Print("Error in history!");
break;
}
if(OrderSymbol()==symbol && OrderMagicNumber()==MAGICMA)
{
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
{
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
}
}
the"if(OrderSymbol()==symbol && OrderMagicNumber()==MAGICMA)" condition is exactly what selects orders by a specific symbol and with a specific MAGIC
PS/ in the above copy-paste code break in case of an OrderSelect error is not quite correct, rather use continue (no matter what the reason is the order is not picked, maybe there is a problem with some internal MetaTrader mechanism, but the next order won't be skipped)
feel free to look into the CodeBase - every EA has an order loop:-)
For example https://www.mql5.com/ru/code/16588 (the first one I came across)
Hello guys!!! Help me write a function that would return a buy or sell signal. I don't know how to work with bars in MQL yet (although I don't know a lot of things!).
The condition is as follows: the parent bar is a bar inside which, namely, inside the high and low is a bar with the close price (it's important!!! exactly the close price.) Once some bar pierces the parent one and closes above the high or below the low, it now becomes the parent bar!
If the close price of the parent bar is higher than the open price, we return the signal to buy.
If the close price of the mother bar is lower than the open price, we return the signal to sell.
It is very important to set the timeframe in the external variable.
But here is the problem, at least for me, how can the Expert Advisor find the last matte bar on the chart? Yes, visually I can see it right away! ....
It would be convenient for me to specify the index of the last MAT bar in an external variable and then the function will start dancing from it; or another variant to take a bar with the index, for example, 50 and go through the loop to zero.
Very please help orphan!!!
Good afternoon!
Can you give me an idea? We need an EA to be unable to open an order if an order has already been opened at this price. How to implement the check?
Good afternoon!
Can you give me an idea? We need an EA to be unable to open an order if an order has already been opened at this price. How to implement the check?
This is a difficult task. Out of desperation, I used to assign a magic order to the desired_price/_Point given the slippage.
It is much easier in mql5: there is a position with a price that does not correspond to the requested price and an order with the requested price.
Good afternoon!
Can you give me an idea? We need an EA to be unable to open an order if an order has already been opened at this price. How to implement the check?
You write a loop of orders, in which you compare the opening price of each order with the given price value, and if there is a match, then the flag of a new order is not raised.