[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 550

 

Good morning, dear friends. Please advise a beginner in what direction to dig. The problem is not solved. The bottom line is this:

On the H4, the bar breaks the bar from the bottom to the top, where it actually closes and this is a buy condition. We buy. Now we should take some points, or roughly ten, to close (everything was simple and clear for me till this moment) and go smoke till the next bar (this does not work). As soon as an order is closed, a new one is opened (the condition is still fulfilled), how to avoid trading until the next bar?

The solution seems to be simple, I feel it is close to me, but I lack knowledge (or brains))). I must admit that I didn't read 549 pages and if someone already asked... Do not swear too much))))

Can you please help me

 

FAQ

 
Thank you
 
ex_kalibur:

Hi, help me please, I can't see the most obvious thing((((

double LotsAllPos(int op) {

int i;

double ll=0;

for (i=0; i<OrdersTotal(); i++) {

if (OrderType()!=op) continue;

if (OrderSymbol()!=sy) continue;

if (OrderMagicNumber()==Magic || OrderMagicNumber()==Magic+1) ll+=OrderLots();

}

return(ll);

here I need to return the summed volume by my symbol, and by type

for (i=0; i<OrdersTotal(); i++) {
 if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
   if (OrderType()!=op) continue;

....
   }
 
Sepulca:


Thank you for your help.
 

Can you tell me what the problem could be. The variable newlots is 0.2.

When I run an EA, Print 1 first prints a message saying 1 0.2, then the condition to open an order triggers, the order is opened but the Print 2 function before it does not show the message, I can not figure out why it is skipped, since the condition triggers and if the order function is open, the Print function should be opened too. In addition to this, the log does not show a message that the order has been sent, the standard message which was shown each time an order was opened.

But that's not the worst thing yet, the main problem is that the variable newlots is equal to 0.2 and the order opens with 0.1 volume, how is this possible at all, since it is clearly specified in the function instead of volume as variable newlots.

  Print("1 ",newlots);
  
  if(условие)
    {
    if(buytime != Time[0] && buys == 0 && sells == 0)
      {
      Print("2 ",newlots);
        if(OrderSend(Symbol(),OP_BUY,newlots,Ask,Slippage,0,0,0,MagicNumber,0,BuyColor) > 0)
          {
          buytime = Time[0];
          }
      }
    }

// пробовал даже вот так, в этом случае выводятся только первые два сообщение, причем значение выводится что newlots все таки равен 0.2, но третье сообщение
не выводится, и ордер открывается с лотом 0.1.


Print("1 ",newlots); - равен 0.2


Print("2 ",newlots); - равен 0.2

Print("3 ",newlots); - не выводится сообщение, и далее ордер открывается с лотом 0.1



Print("1 ",newlots);
  if(((Ask > (MA1+3*Point*a)) && (Open[0] < (MA1+3*Point*a)) && (Ask < (MA1+5*Point*a))) || ((Low[0] < (MA1+3*Point*a)) && (Bid > (MA1+3*Point*a)) && (Bid < (MA1+5*Point*a))))
    {
    Print("2 ",newlots);
    if(buytime != Time[0] && buys == 0 && sells == 0)
      {
      Print("3 ",newlots);
        if(OrderSend(Symbol(),OP_BUY,newlots,Ask,Slippage,0,0,0,MagicNumber,0,BuyColor) > 0)
          {
          buytime = Time[0];
          }
      }
    }

 
sss2019:

Can you tell me what the problem could be. The variable newlots is 0.2.

When I run an EA, Print 1 first prints a message saying 1 0.2, then the condition to open an order triggers, the order is opened but the Print 2 function which precedes it does not show the message, I can not figure out why it is skipped, since the condition triggers and if the order function is open, the Print function should be closed too. In addition to this, the log does not show a message that the order has been sent, the standard message which was shown each time an order was opened.

But that is not the worst thing yet, the main problem is that the variable newlots is equal to 0.2 and the order opens with 0.1 volume; it may happen because it is clearly stated in the function instead of volume that variable newlots.


Where is the opening of an order in the code? Where is OrderSend?

In that section, that you have shown, the condition is not executed, and consequently your Print 2, and consequently, OrderSend in this condition too, does not open an order with 0.2 lot.

Another OrderSend is being executed.

 
zxc:


Where else in the code is the order opening? Where else is OrderSend?

In the section that you have shown, the condition is not fulfilled and therefore your Print 2, and therefore the OrderSend in this condition is also not opened - no order with lot 0.2 is opened.

Another OrderSend is executed.


Here we go.

if(OrderSend(Symbol(),OP_BUY,newlots,Ask,Slippage,0,0,0,MagicNumber,0,BuyColor) > 0)

I have only one OrderSend in my EA, the condition is fulfilled and the order is opened with an unclear volume.

 

Can you tell me, when an EA comes with a set, which folder should I put it in? Thank you.

 

Good afternoon!

Can you help, reading from file, there is one line (generally speaking there will be more, but it doesn't matter), it loops, as if it doesn't see the end of file...

int qq=0;
 while (FileIsEnding(h3)==false)
 {
  int uu=0;
  while (FileIsLineEnding(h3)==false)
  { 
    Histxmas[qq][uu]=StrToDouble(FileReadString(h3));
    Print("Histxmas[",qq,"][",uu,"]=",Histxmas[qq][uu]);
    uu+;
  }
  FileSeek(h3,0,SEEK_END);   
  qq++;
  Print("Бро зациклился, покажи мне кюкю",qq);
 }
Reason: