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

 
Need to remove one of the orders identical in opening time, lot and opening price (the last two), forcibly remove one of these. Thank you.
 
Vitaly Muzichenko #:

The question is different, to output the "Input parameters" in the desired language.

Exactly.

Is it possible to do this through?

#define  LANG(...)
...
#ifdef
...
#else 
...
#endif 
 
Vitaly Muzichenko #:

The question is different, to output the "Input parameters" in the desired language.

Only by defining the terminal language at compile time and using #ifdef -- #else -- #endif for conditional compilation

 
Порт-моне тв open time, lot and open price (the last two), forcibly remove one of them. Thank you.

Post the code from bracket to bracket

{
.....
ticket = OrderSend(Symbol(),OP_BUY, Lot*3, Ask, Slippage, SLbuy, 0, "открыт ордер на покупку", Magic, 0, Blue);
.....
ticket = OrderSend(Symbol(),OP_SELL, Lot*3, Bid, Slippage, SLsell, 0, "открыт ордер на продажу", Magic, 0, Red);
}
This particular section.
 
Artyom Trishkin #:

Only by defining the terminal language at compile time and using #ifdef -- #else -- #endif for conditional compilation

This is an oversight in MQL. Unfortunately (
 
Порт-моне тв #:

I'm racing in a tester. I don't need psychics when I am a telepath myself. And that's why I know exactly what I need. And you are wasting your and my time with meaningless chitchat.

Check before opening if there is a position opened on this candle (if one position per bar), if there is a position opened on this candle at this price (unreliable because of slippage), if there is a position opened a certain number of seconds ago by this signal....

There are a lot of ways to do this. But in your code, you need to check the existence of a position on this signal. You decide how to do it, since you do not have a code.

It is because of the lack of code that everyone is guessing, which ultimately turns out to be meaningless chatter.

 
MakarFX #:

Post the code from bracket to bracket

that particular section.
   if(sb1 + sb1/100*LotRisk*(DayMultiplicatorProfit/100/2) > AccountBalance()  && TimeCurrent()>TimeCheck_a && TimeCurrent()<TimeCheck_ac && Ogranichitel > 0)
     {

      if(OrderOfSymbol<1)
         if(signal=="buy")
            if(Close[1]>Open[1])
              {
               ticket = OrderSend(Symbol(),OP_BUY, Lot, Ask, 3, SLbuy, TPbuy, "открыт ордер на покупку", Magic, 0, Green);
               Print("OpenOrderSuccess");
              }


      if(OrderOfSymbol<1)
         if(signal=="sell")
            if(Close[1]>Open[1])
              {
               ticket = OrderSend(Symbol(),OP_SELL, Lot, Bid, 3, SLsell, TPsell, "открыт ордер на продажу", Magic, 0, Red);
               Print("OpenOrderSuccess");
              }

     }
 
Порт-моне тв #:
I am immediately confused by
OrderOfSymbol
how do you define it?
 
MakarFX #:
I am immediately confused as to how you define it?
OrderOfSymbol=CounterOrderTradeType(-1);

............


//+------------------------------------------------------------------+
//| Подсчет ордеров потекущему символу                               |
//+------------------------------------------------------------------+
int CounterOrderTradeType(ENUM_ORDER_TYPE order_type)
  {
   int cnt=0;
//----
   for(int pos=OrdersTotal()-1; pos>=0; pos--)
     {
      if(OrderSelect(pos, SELECT_BY_POS, MODE_TRADES)==false)
         continue;
      if(OrderSymbol()!=_Symbol)
         continue;
      if(order_type == OrderType() || order_type == -1)
         cnt++;
     }
//----
   return(cnt);
  }

//+------------------------------------------------------------------+
you are still trying to find the error, but I have been asking you for hours to do something else. Why is that?
 
Порт-моне тв #:

Try

   if(sb1 + sb1/100*LotRisk*(DayMultiplicatorProfit/100/2) > AccountBalance()  && TimeCurrent()>TimeCheck_a && TimeCurrent()<TimeCheck_ac && Ogranichitel > 0)
     {
      if(OrderOfSymbol<1)
        {
         if(signal=="buy"&&Close[1]> Open[1])
           {
            if(OrderSend(Symbol(),OP_BUY, Lot, Ask, 3, SLbuy, TPbuy, "открыт ордер на покупку", Magic, 0, Green))
              {Print("OpenOrderSuccess");}
           }
         if(signal=="sell"&&Close[1]> Open[1])
           {
            if(OrderSend(Symbol(),OP_SELL, Lot, Bid, 3, SLsell, TPsell, "открыт ордер на продажу", Magic, 0, Red))
              {Print("OpenOrderSuccess");}
           }
        }
     }
It's highlighted in yellow. Is it supposed to be like that?