Questions from a "dummy" - page 163

 

Urain described the function above.

Get the bartime of the desired timeframe based on the date.

 

Can you tell me why I get different values when calculating lot sizes in different DCs?

For example: 1DC - available funds: 10000, min.lot 0.01 calculated 100% of available funds get lot size 79.37

2DC - free funds: 10000, min.lot 0.01 calculated 100% of available funds get the lot size 7.96.

What I do not take into account, why the lot size is different?

 
pusheax:

Can you tell me why I get different values when calculating lot sizes in different DCs?

For example: 1DC - available funds: 10000, min.lot 0.01 calculated 100% of available funds get lot size 79.37

2DC - free funds: 10000, min.lot 0.01 calculated 100% of available funds get the lot size 7.96.

What I do not take into account, why the lot size is different?


There are brokerage companies where 1 lot = 10000 units of the base currency (e.g. Insta). Refer to the specification of the contracts.
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте - Документация по MQL5
 
pusheax:

Can you tell me why I get different values when calculating lot sizes in different DCs?

For example: 1DC - available funds: 10000, min.lot 0.01 calculated 100% of available funds get lot size 79.37

2DC - free funds: 10000, min.lot 0.01 calculated 100% of available funds get the lot size 7.96.

What I do not take into account, why the lot size is different?

Number of signs?
 
Silent:
Number of characters?
What does the number of digits have to do with it? It's not even an order of magnitude difference. It's the difference of 0.23 lots. And the pair is exactly the same? And the opening price?
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы - Документация по MQL5
 
sumkin75:
What's the call signs got to do with it. It's not even a question of an order of magnitude difference. It's the difference of 0.23 lots. And the pair is exactly the same? And the opening price?

This is called a mini or microreal.

Some dealers simply give fractional lots, others change the contract size, so a 0.01 lot in a regular account turns into 1 lot in a microreal account.

These are so-called cent accounts.

You can get the value like this:

SymbolInfoDouble(_Symbol,SYMBOL_TRADE_CONTRACT_SIZE);
 
sumkin75:
What's the call signs got to do with it? It's not even a question of an order of magnitude difference. It's just the difference of 0.23 lots. And the pair is exactly the same? And what is the opening price?

Yes, you gave me a good hint!

Do I just keep doing this?

g_d_ContractSize = SymbolInfoDouble(s_Symbol,SYMBOL_TRADE_CONTRACT_SIZE);//Trading contract size 10000-Insta, 100000-other

g_d_ContractSizeDiv = 100000/g_d_ContractSize;//Difference

and then multiply g_d_ContractSizeDiv by the lot size?

 
Can you tell me if there is a ready-to-use function for splitting by thousands, e.g.: from 1000000 to 1 000 000?
 
pusheax:
Do you know if there is a function that splits a number in thousands, like 1000000 to 1 000 000?

So I understand that you need a visual split, then you need to convert the number to string. And then do whatever you need to do with string.

The function you want is missing, but you can easily create it yourself using the StringSubstr() function.

String functions

That's sort of it:

string FormatInteger(ulong val)
  {
   string temp=IntegerToString(val),res="";
   int len=StringLen(temp);
   int i=len-3;   
   while(i>=0)
     {
      res=" "+StringSubstr(temp,i,3)+res;
      i-=3;      
     }
   if(len%3!=0)res=" "+StringSubstr(temp,0,len%3)+res;  
   return(res);  
  }
void OnStart()
  {
   Print(FormatInteger(10000000));   
  }
 
Urain:

So I understand that you need a visual split, then you need to convert the number to string. And then do whatever you need to do with string.

The function you want is missing, but you can easily create it yourself using the StringSubstr() function.

String functions

That's it:

Thanks, I'll try to add it.
Reason: