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

 
Good afternoon Friends, I am currently trading with the help of an EA,
Can you please advise whether I can use these parameters to write my own EA?
------------------------------------------------------------------------------
GridA=true
GridB=true
GridC=true
OrdersSideOptimize=true
StopTradeAfterTP_GridA=false
StopTradeAfterTP_GridB=false
StopTradeAfterTP_GridC=false
MaxTrades_GridA=15
MaxTrades_GridB=15
MaxTrades_GridC=15
MagicNumber_GridA=7771
MagicNumber_GridB=7772
MagicNumber_GridC=7773
MaxLots=100.0
AutoMM=3.0
T6="Lots Settings"
BaseOrderLevel=1
LotExponent=1.33
T7="TakeProfit settings".
TakeProfit=125.0
Slippage=3.0
T10="Step settings"
Step_GridA=170.0
Step_GridB=170.0
Step_GridC=200.0
DistanceExponent=1.18
BaseDistanceOrder=10

Regards to you Noble Savage
 

Good afternoon. Can you tell me something?


When compiling, an error is thrown up.

if(flag_Cl_Buy = "on" && Ask>=BB)

'&&' - illegal operation use

This character is a logical AND. The translation of '&&' is illegal operation use. )))

What's wrong? ))

Standard branching. Make what is in if condition 1(flag_Cl_Buy = "on") and the price value is higher than what is specified. What's wrong with this AND???


 
Gilmor:

Good afternoon. Can you tell me something?


When compiling, an error is thrown up.

'&&' - illegal operation use

This character is a logical AND. The translation of '&&' is illegal operation use. )))

What's wrong? ))

Standard branching. Make what is in if condition 1(flag_Cl_Buy = "on") and the price value is higher than what is specified. What's wrong with this AND???


==

So the comparison is "==", you missed one sign.

 
Gilmor:

Good afternoon. Can you tell me something?


When compiling, an error is thrown up.

'&&' - illegal operation use

This character is a logical AND. The translation of '&&' is illegal operation use. )))

What's wrong? ))

Standard branching. Make what is in if condition 1(flag_Cl_Buy = "on") and the price value is higher than what is specified. What's wrong with this AND???


You are not comparing, you are assigning.

if(flag_Cl_Buy = "on" && Ask>=BB)

The comparison looks like this:

if(flag_Cl_Buy == "on" && Ask>=BB)
 
dodon_:
Good afternoon Dear friends, I am currently trading with the help of my Expert Advisor,
Can you tell me if I can write my own EA based on these parameters?

Based on what little of the answers I've seen, you can write anything, and even good people will tell you where the questions and mistakes are. But, no one will just write to you and with such vague questions most often they send you to the stock exchange.

https://www.mql5.com/ru/job

Торговые приложения для MetaTrader 5 на заказ
Торговые приложения для MetaTrader 5 на заказ
  • www.mql5.com
Добрый день. Нужно написать советника на основе мартингейла работающего в обе стороны с усреднениями на ТФ м1/м5/м15/Н1/Н4/D1 , с тейк профитом но без стоп лоса, для центового счета, с функцией привязки советника на определенные счета. Требуются данные входные параметры для управления советником: Стратегия GridA: включить/выключить стратегию...
 
Vladimir Karputov:

You are not comparing, you are assigning.

The comparison looks like this:

Thank you very much. =)

 

I apologise in advance. Just a couple more questions.

Please advise where I can't understand it. MQL4


void OnTick()
  {
//---
............
тело самого советника
.........
return;
  }

What are the errors? It generates.

'OnTick' - function declarations are allowed on global, namespace or class scope only

'OnTick' - function already defined and has body

see previous declaration of function 'OnTick'

'}' - The following is an error at the end of program

Since it highlights parentheses, I double-checked. It is the closing parenthesis of the 'OnTick' function.

Before this function there is only variable declaration and int OnInit(), void OnDeinit(const int reason)

-----------------------------

I stole a simple solution from this forum to close all the orders.

for(z=OrdersTotal()-1; z>=0; z--)    // закрытие всех ордеров.
        {
         if(OrderSelect(z,SELECT_BY_POS)==true && OrderSymbol() == Symbol())
           {
            OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red);
           }
        }

It gives me a yellow icon and asks to double-check returned value. I don't need to check the return value. What is it hinting at?

------------------------------

Switch operator

Nice switch thing. Expression made

switch(flag_1)

As the name says flag. It switches to 1 of the flag values during the computation depending on the solution. Markers. Markers i.e. values of this flag are 3. These are "zero", "BUY", "SELL".

string flag_1 = "zero";

void OnTick()
  {
switch(flag_1)
     {

      case "zero":
  .............
...............
break;
     case "BUY":
 .............
...............
 break;
    case "SELL":
 .............
...............
 break;
return;
}
}

And it does not like everything. Neitherflag_1 itselfnor its values. How can we fix it? I don't want to be forced into numbers. Visually, it's more difficult to comprehend if there will be only digits x = 1, 2, or 3. :( Are text labels not allowed?

-------------------------------

// Удалить старую отложку
            OrderDelete(OrderBufer_B[i].ticket,clrRed);
            if(OrderSelect(OrderBufer_B[i].ticket,SELECT_BY_TICKET,MODE_TRADES) = true)
              {
               OrderDelete(OrderBufer_B[i].ticket,clrRed);
              }  // повторить

Errors

return value of 'OrderDelete' should be checked

'OrderSelect' - l-value required

'=' - l-value required

Does this process make sense at all? Is it necessary to put all my actions connected with orders into a loop until they are done? Or the server, even if it is busy right now, will it still process your request?

I understand that if we are talking about orders on the market to buy / sell now, then at the time of news when the server will be free, the price can already go far and then the order will not be executed.




 
Gilmor:

I apologise in advance. Just a couple more questions.

Please advise where I can't understand. MQL4


What are the errors? It generates.

'OnTick' - function declarations are allowed on global, namespace or class scope only

'OnTick' - function already defined and has body

see previous declaration of function 'OnTick'

'}' - The following is an error at the end of program

Since it highlights parentheses, I double-checked. It is the closing parenthesis of the 'OnTick' function.

Before this function there is only variable declaration and int OnInit(), void OnDeinit(const int reason)

-----------------------------

I stole a simple solution from this forum to close all the orders.

It gives me a yellow icon and asks to double-check returned value. I don't need to check the return value. What is it hinting at?

------------------------------

Switch operator

Nice switch thing. Expression made

As the name says flag. It switches to 1 of the flag values during the computation depending on the solution. Markers. Markers i.e. values of this flag are 3. These are "zero", "BUY", "SELL".

And it does not like everything. Neitherflag_1 itselfnor its values. How can we fix it? I don't want to be forced into numbers. Visually, it's more difficult to comprehend if there will be only digits x = 1, 2, or 3. :( Are text labels not allowed?

-------------------------------

Errors

return value of 'OrderDelete' should be checked

'OrderSelect' - l-value required

'=' - l-value required

Does this process make sense at all? Is it necessary to put all my actions connected with orders into a loop until they are done? Or the server, even if it is busy right now, will it still process your request?

I understand that if we are talking about orders to buy / sell the market now, then at the time of news when the server will be free, the price can already go far and then the request will not be executed.




The results of OrderSend, OrderDelete, OrderClose, OrderModify should be checked. These are just rules of decency elevated to the rank of warnings.

And "lvalue" errors are your favourite comparison and assignment mix-ups.

PS/ well you don't learn MT programming. MT is a harsh application.

 
Gilmor:

I apologise in advance. Just a couple more questions.

Please advise where I can't understand. MQL4


What are the errors? It generates.

'OnTick' - function declarations are allowed on global, namespace or class scope only

'OnTick' - function already defined and has body

see previous declaration of function 'OnTick'

'}' - The following is an error at the end of program

Since it highlights parentheses, I double-checked. It is the closing parenthesis of the 'OnTick' function.

Before this function there is only variable declaration and int OnInit(), void OnDeinit(const int reason)

-----------------------------

I stole a simple solution from this forum to close all the orders.

It gives me a yellow icon and asks to double-check returned value. I don't need to check the return value. What is it hinting at?

------------------------------

Switch operator

Nice switch thing. Expression made

As the name says flag. It switches to 1 of the flag values during the computation depending on the solution. Markers. Markers i.e. values of this flag are 3. These are "zero", "BUY", "SELL".

And it does not like everything. Neitherflag_1 itselfnor its values. How can we fix it? I don't want to be forced into numbers. Visually, it's more difficult to comprehend if there will be only digits x = 1, 2, or 3. :( Are text labels not allowed?

-------------------------------

Errors

return value of 'OrderDelete' should be checked

'OrderSelect' - l-value required

'=' - l-value required

Does this process make sense at all? Is it necessary to put all my actions connected with orders into a loop until they are done? Or the server, even if it is busy right now, will it still process your request?

If we are talking about orders to buy/sell now, then at the time of news when the server will be free, the price can go far away and the order will not be executed.




You have 2 OnTick functions


The switch operator expression must be of integer type.

 
Artyom Trishkin:

Yes, create a separate topic. Just try to choose the right section of the forum in which to create the topic.

Yes, ok. Is"MQL4 and MetaTrader 4" ok? Or is it better in "Indicators"?
Reason: