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

 
trader781:

Correcting

There is no other way to put it anywhere else, it will be wrong parameters

It should take into account the most recent one.

I'll try to change it.

I tried to use standard OrderModify() but it gets banned if I move a lot of orders simultaneously and constantly

Thanks for the critique.

Declare it WITHOUT ARGUMENT, is it really that hard?

int Counts()
{код функции}

And call an empty one too, and put the elza from there behind curly brackets:

if(Counts()==0){че там нужно когда нет ордеров}
else {когда есть ордера}

And now you have this:

if(Counts()==0){че там нужно когда else {когда есть ордера} нет ордеров}
 
Alekseu Fedotov:

Try it ^_~



It's not working ...There's still no deal.
 
Movlat Baghiyev:
It's not working... No trades, no trades...

Does it at least put out the pending orders, no, what are the errors?

...I fixed it.

Files:
0.mq4  8 kb
 
Finished the arguments. the terminal hangs tight.
Files:
count.mq4  19 kb
 
trader781:
Finished arguments. terminal hangs tight.

So some sort of loop is flailing around endlessly.

Write #property strict at the beginning of the code and fix it, lots of warnings.

It is quite possible division by 0 in the last function.

After else only the first line will be executed, the braces block is left orphaned.

In general, write out the logic on paper with words first, otherwise it's wobbly.

 
Vitalie Postolache:


It is supposed to execute a command with a floating decimal point depending on decimals on the chart

NormalizeDouble(Ask+TakeProfit*Point(),Digits)

and how did you see that some lines were not executed?

 
trader781:

It is supposed to execute a command with a floating decimal point depending on decimals on the chart

NormalizeDouble(Ask+TakeProfit*Point(),Digits)

How do you know that some lines are not executed?

Yep. I have big problems with logic. And what would be left of the result if it is written into an integer variable? What's the point of this code?

int lastlot,tp;
lastlot=NormalizeDouble(lastlot*Martin,3);
tp=NormalizeDouble(avg_price+TakeProfit*Point(),Digits);

Here, is it so hard to understand that part of the code is orphan and will be executed regardless of the condition?

else//+-------------если ордера уже есть
otype=FindLastOType(); //код, исполняющийся для else
{
код-сирота
}
 
Vitalie Postolache:

Yeah, that's a big problem with logic. And what's left of the result if it's written to an integer variable? What is the point of this code?

int lastlot,tp;
lastlot=NormalizeDouble(lastlot*Martin,3);
tp=NormalizeDouble(avg_price+TakeProfit*Point(),Digits);

Is it so hard to understand that part of the code is an orphan and won't be executed?

else//+-------------если ордера уже есть
otype=FindLastOType(); //код, исполняющийся для else
{
код, который никуда не идёт, сирота
}

Stop

if there are orders

The order type is

{

then operations are executed for that order type

}

not?

Can't figure out where zero divide comes from
 
trader781:

Stop

if there are orders

is the order type

{

then operations are carried out for this order type

}

no?

Yes, you're right, it's just that the code is written in such a style that the previous speaker misinterpreted it.

Added:zero div ide is a division by zero, and it tells you in the log what line

 
trader781:

Stop

if there are orders

is the order type

{

then operations are carried out for this order type

}

no?

Corrected above. What comes after else is executed depending on the condition. Block of curly brackets is separate, so it has nothing to do with else.

I can't figure out where zero divide comes from.

That's where

void ModifyOrders() //+------------модификация ввод тип
  {
   double avg_price; //+------------средняя цена
   price=0;//+------------цена
   bool z;//+------------выход в переменную
   double orderlots=0; //+------------лоты

   avg_price=NormalizeDouble(price/orderlots,Digits);//+------------то средняя ценаравна цена деленная на лот
@Vitaly Muzichenko Where is "misinterpreted" here? Use your brain.