Questions from Beginners MQL4 MT4 MetaTrader 4 - page 258

 
OlgaKom #:

Hi all!

Can someone tell me how to get the value for tick price and tick size correctly

When getting this for the symbol

Sometimes the received values differ from the actual values.

Does anyone know what this has to do with?

On 4 it might not work correctly if the deposit currency is not USD and there are no required conversions in the market overview. Point price in deposit currency and deposit volumes simply can't be calculated, there is no data.

To be good and correct - if deposit for example in RUB, then ALL available ruble pairs should be included. And it is better to keep deposits in major currencies, USD/EUR/JPY. Minors are just for the sake of despair.

PS/ If the deposit is not in USD: The instrument has properties SYMBOL_CURRENCY_PROFIT,BASE,MARGIN - before you trade/analyse it, add the appropriate pairs with ACCOUNT_CURRENCY, through SymbolSelect(). In advance !

PPS/ I had such a situation only in 4... I just didn't have exotic accounts in 5 yet :-) I won't say anything about it

 

I don't understand why trading levels are not displayed on some symbols and there is no possibility to set one-click trading.

 
Hello, I have a question about MT4 terminal. I've been working with MT4 for several years now, but I've never encountered such a thing. I don't know what to do when I'm working on my PC and I don't have it on the terminals that are on a remote server.
 

Good afternoon!!!!

Please help me to change a function which calculates only losses of unprofitable orders in a grid of orders

//+----------------------------------------------------------------------------+
//| Калькуляция убыточных ордеров                                              |
//+----------------------------------------------------------------------------+
double Loss()
  {
   double oLoss = 0;
   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 || OrderType() == OP_SELL)
              {
               if(OrderProfit()<0)
                 {
                  oLoss += OrderProfit();
                 }
              }
           }
        }
     }
   return(oLoss);
  }

We need to change the function which calculates only minimum lot size from each order in the net of orders. Min Lot=0.01

Thanks!!!!

 

Good day! I just started to learn MQL4 and am trying to write an EA based on renko bricks v2 indicator data. The problem is that EA with simple calculations seems to be very slow in the tester. It works but runs very slowly. I think I may have inexperienced enough to write nonsense so I am asking for help from elder guys).

Bottom line. Expert Advisor scalper, trades on m1, waits for the colour change of the brick and opens a deal in the direction of a new movement. I attach below source code itself advisor, and turndown. Thanks in advance!

Files:
 
Dmitri73 #:
Hello, question about MT4 terminal. I've been working with MT4 for a few years now, but I've never seen such a thing. I've never seen such a mess before.

Weird, what's the build?

 

Hello. Question for coding experts, as I can't find an answer to my question anywhere. I am using the for function to search for candles, find the right candle and get the data from it, but in an enumeration of candles there are several, how do I get the closest of them? I can't find it.

int SvechaVniz()
  {
   for( a=2; a<55; a++)
     {
      if(iClose(Symbol(),TF_1,a)<iOpen(Symbol(),TF_1,a))
        {
         dn=a;
         dn_o=iOpen(Symbol(),TF_1,dn);
         dn_h=iHigh(Symbol(),TF_1,dn);
         dn_l=iLow(Symbol(),TF_1,dn);
         dn_c=iClose(Symbol(),TF_1,dn);
         Print(dn);
         в переменную dn приходит несколько индексов свечей, как их перебрать и выбрать ближайший?
        }
     }
   return(0);
  }
 
Александр Вараксин #:

Hello. Question for coding experts, as I can't find an answer to my question anywhere. I am using the for function to search for candles, find the right candle and get the data from it, but in an enumeration of candles there are several, how do I get the closest of them? I can't get it.

If you start the cycle from the last candle, the last "needed candle" will be with the closest index.

for( a=55; a>2; a--)
 
Александр Вараксин #:

Hello. Question for coding experts, as I can't find an answer to my question anywhere. I am using the for function to search for candles, find the right candle and get the data from it, but in an enumeration of candles there are several, how do I get the closest of them? I can't find it.

You can do it like this:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   
Alert("индекс свечи = ",SvechaVniz(0)); 
   
  }
//+------------------------------------------------------------------+

int SvechaVniz( int n=0)
  {  
  int  k=0;
  
   for(int a=0; a<55; a++)
     {
      if(iClose(Symbol(),0,a)<iOpen(Symbol(),0,a))
        {
         k++;
         if (k>n) return(a);
        }
     }
   return(0);
  }

The function returns the index of the candle you need,

0 is the closest, 1 is the next one.

 
Alekseu Fedotov #:

You can do it like this:

The function returns the index of the candle you want,

0 is the closest, 1 the next.

Thank you, I will try it.
Reason: