Questions from Beginners MQL5 MT5 MetaTrader 5 - page 384
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
...
if (OrdersTotal() == 0 && ********** )
OrderSend("USDCHF",OP_BUY,Lots,Ask,0,0,0, "5891",MagicNumb,0,Red);
if (OrdersTotal() == 0 && ***********)
OrderSend("USDCHF",OP_SELL,Lots,Bid,0,0,0, "58892",MagicNumb,0,Red);
...If you have two Expert Advisors, they should have the same wizard. They should be launched on different charts for one symbol. In general, of course, it is easier to improve the main one than to start another one.
I can't improve it, it's from the Market.
I can't use it on 2 charts because I can't find any suitable conditions. It will open orders in 2 directions when there are 0 left.
Well, the check is a function call that returns a flag:
if(!Function_check_open_position(symbol,OP_BUY,magic)) function_open_position(symbol,OP_BUY,Lots,stop_loss,take_profit,magic,comment);
if(!Function_check_open_position(symbol,OP_SELL,magic)) Function_open_position(symbol,OP_SELL,Lots,stop_loss,take_profit,magic,comment);
Yeah, my mistake came out when talking about "no inludes", this feature is just in the Trade.mqh inluder.
No problem. I closed with the opposite one.
The end is written in a blink of an eye, it takes longer to make a signal.
on the 4-rka it seems to be worse from this point of view....
and that multicurrency is a beauty, I can't believe my eyes.
BRAVO to the developers! //transition for the first time was exactly 1 day.
First of all, if you want to find out if there is an order again, you will have to call the function again. And if you want to store the value in variables, you can pass them further without calling the function again. Secondly, it is a matter of taste, I don't like to make complex constructions, especially if there are a few conditions or a lot of arguments are passed to a function. It makes understanding the code worse.
I can't improve it, it's from the Market.
It can't work on 2 charts because I can't find suitable conditions. it will open orders in 2 directions when there are 0 of them left. it needs 2 directions to work
Judging by the question, there is nothing else needed there.
The projects are expanding,
Artyom Trishkin:
It should work on one chart, and the second - a simple one that opens two positions - on the other. You have already been told how to do it.
You're not a bit inadequate.Goodbye.
Projects are expanding, you have to try to think ahead.
Yeah, thanks for the science. I'll be sure to think about it...
ZS. What prevents then to return the check not in a condition, but in a variable and already check it? Probably the wildest complexity of this project in the future...
And one more thing: if the project is being expanded, the code execution time may increase too. As a result, there will be a lot of calculations to be performed after the data is written into the variable. So, isn't it possible that by the time we need a second check, the order will have already been closed (at a stop, for example ... or take ...), and the program will then calculate an incorrect value stored in the variable?
Exactly - we must think in advance about large projects and all the possible situations that may occur. So I stand by my conviction - always have the latest data just before you use it. As far as possible.
le0nid2014:
You're a bit inadequate.Goodbye.