Questions from Beginners MQL5 MT5 MetaTrader 5 - page 101

 
Yedelkin:

These messages appear, for example, when one function is declared inside another. See if there is anything like this in the code:

No, there's nothing like that. Apparently they are just antagonists, and I wanted to attach a peseptron
 
chipo There's no such thing. Apparently they're just antagonists, and I wanted to strap on a pespertron.
Well you give examples of those lines where errors occur, and a couple of lines from top to bottom.
 
Yedelkin:
Well you give examples of those lines where errors occur, and a couple of top-bottom lines.
Yedelkin:
Well, give me some examples of those lines where errors occur, and a couple of lines from top to bottom.

I am an inexperienced beginner and I dock EAs, I don't know how well I do it, but they all work differently and differently from sources and I have failed with this one, though the code is very simple and this may be the problem )))) I want to get everything too easy

//--- if it is time to trade
if((mqldt.hour==TradeTime) && (cantrade))
{
//--- check condition to open short trade (sell)
if(Open[t1]>(Open[t2]+delta*_Point))
{
//---open Short position
OpenShort(lot,10, "EUR/USD 20 pips expert (Short)",1234);
//--- switch the flag (prohibit trade) to not open more positions until the next day
cantrade=false;
//--- exit
return;
}
//--- check condition for opening a long position (buy)
if((Open[t1]+delta*_Point)<Open[t2])
{
//---open long position
OpenLong(lot,10, "EUR/USD 20 pips expert (Long)",1234);
//--- switch the flag (prohibit trade) to not open more positions until the next day
cantrade=false;
//--- exit
return;

Here is where I wanted to add Expert OnTick function from Combo Righd at least some of it, but even some of it does not compile


bool Supervisor(double & Signal) {
double BasicSig=0;
if(!basicTradingSystem(BasicSig))return(false);
Signal=0;
if(pass==4){
if(!Perceptron(output1,sh11,sh12,sh13,sh14,sh15,w11,w12,w13,w14) ||
!Perceptron(output2,sh21,sh22,sh23,sh24,sh25,w21,w22,w23,w24) ||
!Perceptron(output3,sh31,sh32,sh33,sh34,sh35,w31,w32,w33,w34)
)return(false);
if(output3>0){
if(output2>0){
sl=sl3;
tp=tp3;
Signal=1;
return(true);
}

 
chipo

Well, look, it all works out the way I thought it would. You are trying to insert another function inside one function - this one:

bool Supervisor(double & Signal)....
 
Yedelkin:

Well, look, it all works out the way I thought it would. You are trying to insert another function inside one function - this one:

Thank you, sorry for taking time, I thought the previous function-formula worked out and closed, it's the turn of the second function, but it's inside
 
chipo: Thank you, sorry for taking up my time, I thought the previous function-formula worked out and closed, but it turned out to be the second one.
Feel free to ask! The more questions about the language, the more interesting it is.
 
Can mql be used to get and store the opening price of an order at the moment (before deciding to buy) of a request ?
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы - Документация по MQL5
 
kedr275: Could you please tell me if it is possible with mql to receive and save the opening price of an order at the moment (before deciding to buy) of a request ?
The question is not quite clear yet. In mql5 not orders are opened but positions. Are you interested in the opening price of a position?
 
Yedelkin:
The question is not quite clear yet. In mql5, we open positions, not orders. Are you interested in the price of opening a position?

Yes, I am interested in the position, I will formulate the question differently, is it possible to make a decision to open a position based on the price, i.e. we request the price first, make a decision, execute.

 
kedr275:

Yes, I am interested in the position, I will formulate the question differently, is it possible to make a decision to open a position based on the price, i.e. we request the price first, make a decision, execute.

Yes, we can. It is harder to think of something that cannot be done. ))
Reason: