Errors, bugs, questions - page 2136

 
Igor Golieniev:
   PrintFormat("%.3f %.3f", 123.2, 0.1);
 
Vitaly Muzichenko:

Why?

Because SILVER,H1: invalid stoploss for OrderModify function

OrderStopLoss() = 15,15 should be = 15,155
 
Комбинатор:
I want it for OrderModify, not Print
 
Igor Golieniev:

Because SILVER,H1: invalid stoploss for OrderModify function

There will be a "0" in the third digit, and that won't solve the problem.

You have to look elsewhere

 
Igor Golieniev:
NormalizeDouble(value,3);
 
Pavel Kolchin:

This is crazy: I started modifying an order I had just opened... and how!!! 1912619.624!!!

SILVER,M15: modify #1 sell 0.01 SILVER at 16.965 sl: 1912619.624 tp: 0.000 ok

 
Igor Golieniev:

This is crazy: I started modifying the order I had just opened... and how!!! 1912619.624!!!

SILVER,M15: modify #1 sell 0.01 SILVER at 16.965 sl: 1912619.624 tp: 0.000 ok

NormalizeDouble() is a function which will make a certain number of decimal places, it will not correct mistakes in the code, see what parameters you pass and where they come from

 
Pavel Kolchin:

NormalizeDouble() is a function that will make a certain number of decimal places, it will not correct errors in the code, see what parameters you pass and where they come from

Simple trawl. BUT: SILVER,H1: invalid stoploss for OrderModify function. Why? How to fix it? On all other markets it works.
void Trailing()
  {
   if(Digits==3 || Digits==5)
     {
      TrailingStep *= 10;
      TrailingOpen *= 10;
      TrailingStop *= 10;
     }
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(Bid>OrderOpenPrice()+TrailingOpen*Point)
                 {
                  if(OrderStopLoss()<Bid-(TrailingStop+TrailingStep)*Point)
                    {
                     if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*TrailingStop,Digits),0,0))
                        Print("Oshibka =", DoubleToString(OrderStopLoss(), Digits()));
                    }
                 }
              }
            if(OrderType()==OP_SELL)
              {
               if(Ask<OrderOpenPrice()-TrailingOpen*Point)
                 {
                  if(OrderStopLoss()>Ask+(TrailingStop+TrailingStep)*Point)
                    {
                     if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+TrailingStop*Point,Digits),0,0))
                        Print("Oshibka", DoubleToString(OrderStopLoss(), Digits()));
                    }
                 }
              }
           }
        }
     }
  }
 
Igor Golieniev:
Simple trawl. BUT: SILVER,H1: invalid stoploss for OrderModify function. Why? How to fix it? On all other markets it works.

SYMBOL_TRADE_STOPS_LEVEL

 

Error during compilation

#define  MACRO1( x, y )  x
#define  MACRO2                  MACRO1( , unsigned )
void OnStart()
{
         MACRO2 int i; //Error: 'MACRO1' - undeclared identifier
}

Expected to be replaced by:

void OnStart()
{
                int i;
}