Learning logic - page 6

 
PapaYozh:

These two lines, to put it mildly, look strange:

it's better this way:


Maybe. I'm not going to argue.
 
denis_orlov:

It's not bad either, but it would be good to either clarify the name of the branch or start studying logic.

I really don't know how to do the second one myself...)


What prompted the branch was this construction

int CountTrades(int tip, int imagic) {
   int count = 0;
   for (int trade = OrdersTotal() - 1; trade >= 0; trade--) {
      if (!OrderSelect(trade, SELECT_BY_POS, MODE_TRADES)) continue;
      if (OrderSymbol() != Symbol() || OrderMagicNumber() != imagic) continue;
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == imagic)
      if (tip>=0){
         if (OrderType()==tip) count ++;
      }
      else count ++;
   }
   return (count);
}
The name of the branch can still be changed. Suggest a better one
 
Vinin:


I was prompted to start this thread by this design

Yep, there really is something in the code that needs to be removed and something that just needs to be added.....

The name of the veti can still be changed. Suggest a better one.

I would name the branch like this: "Logic of coding, debugging and optimisation by examples, or just a debriefing" :)

 
drknn: I can share how it was for me.

Great, appreciate such revelations!

It's rare to find confessions here at all. I used to write mine here too, but it had to do with what I was doing as a hobby before I discovered Forex.

 

I would like to propose another task.

But there is a small problem.

The question is how to solve the problem with minimal effort

Files:
 
drknn:


I can share how it was for me.


Logic, logic, and what about intuitive thinking, at the level of unconsciousness, when you solve a problem logically for days and nights and can not solve it logically (well, nothing adds up), and then once went to the toilet )) and you give birth, and as it turns out the solution was as always laid on the surface.
 
sanyooooook:

Better delete the post. Otherwise the example is not quite correct.
 
Vinin:

Better delete the post. Otherwise the example is not quite correct.
When Archimedes discovered his law, he didn't exactly do the right thing either.
 
sanyooooook:
When Archimedes discovered his law, he didn't do the right thing either.

A bathtub is better than a toilet.
 
Vinin:

The bathtub is better than the toilet.
Who said I went to the toilet on the toilet (I have a combined shower and toilet), so there's logic, if you go to the toilet, you have to go to the toilet