[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 385

 
artmedia70:
I added one more condition to the loop and removed unnecessary parentheses. In general, everything may be done in a different way (it will be even better). Maybe a person initializes his or her variable each time after the loop, we cannot see it anymore. Let's learn from telepaths...

Thanks a lot for the tips ! The reason was inattention after all... :-)))

In case of failure I should have passed the variable the opposite value...

I.e., not

if (OrderProfit() > 0) kickup = 2;

а

if (OrderProfit() > 0) { kickup = 2; } else { kickup = 1; }

 

Can you please tell me what is wrong in the code? The robot should close the sell order and if it is missing, it should buy, i.e. open a buy order.

for(cnt=OrdersTotal();cnt>=0;cnt--){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); mode = OrderType();
if(OrderSymbol() == Symbol()){
if(mode == OP_SELL) result=OrderClose(OrderTicket(), Lots, Ask, slippage, Blue);} // if open, close
else{result=OrderSend(Symbol(),OP_BUY,Lots,Ask,2*Point,0,0, "robot is buying",MagicNumber,0,White); return;}}

 
Please help .... there are 5 buy orders at different distances of 30-150pp from each other, price is far to the top how to make the advisor to transfer all stop losses to the top order to breakeven ????????
 
VOLDEMAR:
Please help .... there are 5 buy orders at different distances of 30-150pp from each other, price is far to the top how to make the advisor to transfer all stop losses to the top order to breakeven ????????
Move.
 
Good morning!!! On silver it often happens that when trying to place a position it asks 20 times to the minute do you want new prices? How to avoid it?
 

Hello all! Here's pulling out the names of the objects.

We have a name, for example: _0Triangle_0.... followed by a variable part.

How would I get just the word Triangle out of this text? Task: compare it to the same one to make sure there is such an object. Or rather, that there is an object whose name part is Triangle

   int    obj_total=ObjectsTotal();
   string name;
   for(int i=0;i<obj_total;i++) {
      name = ObjectName(i);
      Print(i," - объект ",name);
   }
 
ikatsko:

How would you get just the word Triangle out of this text?


StringSubstr
 

Thank you

 
ikatsko:

Hello all! Here's pulling out the names of the objects.

We have a name, for example: _0Triangle_0.... followed by a variable part.

How would I get just the word Triangle out of this text? Task: compare it to the same one to make sure there is such an object. Or rather, that there is an object whose name part is Triangle


   string sMask="Triangle";
   int    obj_total=ObjectsTotal();
   string name;
   for(int i=0;i<obj_total;i++) {
      name = ObjectName(i);
      if ( StringFind(name, sMask) >=0) {
          Print(i," - объект ",name);
      }
   }
 

How do you get the full name from an object number?