Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1771

 
Mihail Matkovskij #:

Your order logic is wrong from the start. Find a simple EA on MA(e.g. CodeBase) and use it. Or you can modify it to suit your own idea. Regarding your code as a whole, everything is wrong there. Pay more attention to coding. Start with a simple one. Or, like I said, find a ready-made example.

Add code snippets using the special button at the top:


thank you. what exactly is the wrong logic?
 
Mihail Matkovskij #:

Your order logic is wrong from the start. Find a simple EA on MA(e.g. CodeBase) and use it. Or you can modify it to suit your own idea. Regarding your code as a whole, everything is wrong there. Pay more attention to coding. Start with a simple one. Or, like I said, find a ready-made example.

Add code snippets using the special button at the top:


Sanjakotik78 #:
18

I looked at examples from other EAs and it didn't throw up anything like that.
 
Sanjakotik78 #:
thank you. what exactly is the wrong logic?

You call:

if(OrderClose(OrderTicket(),OrderLots(),Ask,3,Black))
   if(OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"",0,0,Red))
      return;
But in order to call OrderTicket() and OrderLots() correctly, you need to call OrderSelect() before them. And that's not all...


What do you think the OrderClose function does before the order or position closes?

 
Sanjakotik78 #:
thank you. what exactly is the wrong logic?

Initially in the fact that

нужно правильно вставлять код!
 
Сергей Таболин #:

Initially in the fact that the sp

Sergey Tabolin #:

The original point is...

Thank you all. I will look into it further.

 
Sanjakotik78 #:
I've looked at examples of other EAs, and they didn't display anything like that.

I've already highlighted some of your mistakes in a previous post. Look at the code carefully and you will find more than one more error. So, like I said, start with a simple one. Or make your own robot based on a simple example (I told you that too), where all necessary functions and operators are spelled correctly.

 
Sanjakotik78 #:

Mihail Matkovskij #:

I've already highlighted some of your mistakes in a previous post. Look at the code carefully and you will find more than one more error. So, like I said, start with a simple one. Or make your own robot on the basis of a simple example (I've told you about it too), where all needed functions and operators are registered correctly.

Although, MQL4 doesn't need brackets). The Bid and Ask are variables. I decided yesterday, thatBid() and Ask() are functions, like in MQL5.I've been writing applications in MQL5 for a long time, and I haven't written anything for MetaTrader 4 only.

Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
  • 2021.11.28
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
People help. There is an indicator and a bot. The indicator opens orders, and the bot accompanies. To work correctly the bot needs timeframe on which the order was opened. Timeframe indicator is written in the order comment, but when the bot closes the part of volume, the comment is rewritten and instead of TF appears, for example, "from #30029192". Is there another simple way to read the order timeframe to the bot?
 
Nerd Trader #:
The indicator opens orders.

The indicator cannot open orders and make trades. See documentation.

Nerd Trader #:
To work correctly, the bot needs the timeframe, on which the order has been opened.

An order is opened by a symbol. No timeframe is needed for this.

 
Mihail Matkovskij #:

The indicator cannot open orders and make trades. Please refer to the documentation.

The order is opened by the symbol. No timeframes are needed for this.

So it's a bot, not the point. The first bot opens, the second bot accompanies. I know how orders open, but the second bot needs a timeframe, you didn't read it carefully.