[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 255

 

Vadim, no one doubts your awesomeness, I meant that all this can be done with simpler API tools, which is what the questioner started with, but instead of explaining and helping, you took the conversation to your own topic as usual. And the consequences are soon to follow.

As for me - everything at me switches, works, always, and as it should:

>
 
sergkodan:

... and after the weekend the tester reports an error of 131 incorrect volumes...


Well, print the lot before you feed it to the OrderSend() function - let the EA show what it is so indignant about
 
Hello all)) I'm a newbie and I don't like to read or watch things, I mostly like to trust people, is there anyone who can help me in my quest?
 
lx-7:
Hello all)) I'm a newbie and I don't like to read or watch things, I mostly like to trust people, is there anyone who can help me in my quest?


Well, for starters, it would not be a bad thing to say, what exactly are your endeavors? What do you need help with?

 
  
bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ExtBuffer2[i]=current;
         ExtBuffer1[i]=0.0;
        }
      else
        {
         ExtBuffer1[i]=current;
         ExtBuffer2[i]=0.0;
        }
     }
Please explain the meaning of the logical operation if(!up). ! - means NOT, but its essence in this code I cannot understand.
 
silhouette:
Please explain the meaning of the logical operation if(!up). ! - means NOT, but its essence in this code I can't understand.


Is this more understandable?

bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(up)
        {
         ExtBuffer2[i]=0.0;
         ExtBuffer1[i]=current;
        }
      else
        {
         ExtBuffer1[i]=0.0;
         ExtBuffer2[i]=current;
        }
     }
 

Although I would have done things differently

   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev)
        {
         ExtBuffer2[i]=0.0;
         ExtBuffer1[i]=current;
        }
      else if(current<prev) 
        {
         ExtBuffer1[i]=0.0;
         ExtBuffer2[i]=current;
        }
     }
 
silhouette:
Please explain the meaning of the logical operation if(!up). ! - means NOT, but its essence in this code I cannot understand.


if is a conditional jump operator. If the brackets in this operator are true, then the command/command list that follows it is executed. Otherwise, the code jumps to...

in other words:

if(up==false){// если высказывание (up==false) истинно, то
  ExtBuffer2[i]=current;
  ExtBuffer1[i]=0.0;
}
else{// иначе
  ExtBuffer1[i]=current;
  ExtBuffer2[i]=0.0;
}
 
Vinin:

Although I would have done things differently


He didn't do it. He said he didn't understand the design. So he couldn't have made it. It's someone else's code.
 

Vinin, drknn thanks for the replies. I assumed as much, it's just that I've never used this design myself and wasn't sure I understood it correctly.

PS The code is not mine, of course. It's a snippet from Awesome custom indicator that comes standard with the program.