Errors, bugs, questions - page 3175

 
A100 #:
A compilation error:
class A {};

void* t = new A;

Pointers have become addresses in MQL, or what does that mean now?

 
fxsaber #:

Have pointers become addresses in MQL or what is the meaning of this now?

Yes, nothing seems to have changed (in build 2949 similarly). A pointer to a class could be converted to void * before

 

Is there any way to overcome clicking on the object through the object.

I create a TrendLine and then right above it there is a BitmapLabel that completely covers it and if you click directly on the place where the TrendLine is under the BitmapLabel it starts to move

I am attaching a video of it.

 
William Roeder #:

Your broker messed up. Talk to them.

I'm understand that perhaps the broker forgot to udjust something properly in the settings of some symbols, but it's not only my broker problem, my customer also have such problem with another borker.

And today we have no alternative for OrderCalcMargin(). If this function return wrong value of required margin, then all other custom functions also return wrong value.

OrderCalcMargin is often used for many trading tools, which help to see customer required margin and calculate the lot properly.

What to do? Maybe we can somehow get such formula which will not depend on people factor? Some broker will adjust all properly, and many other no. And we always will get this error with wrong margin.

 
Aleksei Beliakov #:

Is there any way to overcome clicking on the object through the object.

I create a TrendLine and then right above it there is a BitmapLabel that completely covers it and if you click right where the TrendLine is under the BitmapLabel it starts to move

I am attaching a video of it.

Is it possible to do something with OBJPROP_SELECTABLE... Let's say by pressing a certain key (or button on the chart) to block or unblock the selection of an object

 

I suppose it would be convenient if the compiler would show a warning if the attachment, which is after OrderSelect(), contains more OrderSelect() call(s), including function calls.

Yesterday all night looking for the bug, and this is the second time for this reason.

void Trailing()
{
   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 >= GetAveragePrice(OP_BUY)+start_tral_level*Point)//OrderOpenPrice()
               {
                  if(Bid >= OrderStopLoss()+(tral_stop+tral_step)*Point || OrderStopLoss()==0)
                  {
                     if(!OrderModify(OrderTicket(), OrderOpenPrice()
                     , NormalizeDouble(Bid-tral_stop*Point, Digits), OrderTakeProfit(), OrderExpiration())) 
                     {
                        Print("Trailing buy err ", GetLastError());
                     }
                  }
               }
            }
            if(OrderType()==OP_SELL)
            {
               if(Ask <= GetAveragePrice(OP_SELL)-start_tral_level*Point)//OrderOpenPrice()
               {
                  if(Ask <= OrderStopLoss()-(tral_stop+tral_step)*Point || OrderStopLoss()==0)
                  {
                     if(!OrderModify(OrderTicket(), OrderOpenPrice()
                     , NormalizeDouble(Ask+tral_stop*Point, Digits), OrderTakeProfit(), OrderExpiration())) 
                     {
                        Print("Trailing sell err ", GetLastError());
                     }
                  }   
               }   
            }   
         }
      }
   }
}
double GetAveragePrice(int in_type)//расчет средней цены позиций
{
   double dRes=-1;
   double dSum=0;
   double dLot=0;
   double dComission=0;
   double dSwap=0;
   int iTotalPos=OrdersTotal();
   for(int cnt=0;cnt<iTotalPos;cnt++)
   {
      if(!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) Print( "Error Select Order");
      {
         if(OrderType()==in_type && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
         {
            dSum+=OrderOpenPrice()*OrderLots();
            dLot+=OrderLots();
            dSwap+=OrderSwap();
            dComission+=OrderCommission();
         }
      }    
   }     
   if(in_type==OP_BUY && dLot!=0) dRes=dSum/dLot-dSwap/dLot*Point-dComission/dLot*Point;
   if(in_type==OP_SELL && dLot!=0) dRes=dSum/dLot+dSwap/dLot*Point+dComission/dLot*Point;
   
   return dRes;
}
 
Andrei Sokolov function calls.

Yesterday I was searching for the bug all night and this is the second time for this reason.

A couple more days like this and you won't need any warnings.

 
Alexey Viktorov #:

A couple more days like this and you won't need a warning.

This does not invalidate the fact that it would be more convenient with a warning

 
How to use this application is how to win
 
Hanene1304 #:
How to use this application is how to win

Please check the post/information/links below -

Forum on trading, automated trading systems and testing trading strategies

how i can gain 1 million dollar?

Sergey Golubev, 2022.02.17 15:20

Find Metatrader broker (there are a lot of Metatrader brokers, use google to find), and open the account according to their condition on their websites.
Try with demo first.

1. The article - MQL5.community - User Memo 

2. MetaTrader 5 Help - Open an Account

3. Where Do I start from?
https://www.mql5.com/en/forum/212020 

4. MetaTrader 5 Help - Trading Platform — User Manual 

5. How to make a search on the forum
https://www.mql5.com/en/forum/193510 

6. Find a Server by the Broker's Name: 
https://www.mql5.com/en/forum/214820

7. My list of brokers: https://www.mql5.com/en/forum/353226/page3


Reason: