How to get Lot size in the DEPOSIT currency??

To add comments, please log in or register
Anok Imchen
59
Anok Imchen  
Well,  MarketInfo(Pair,MODE_LOTSIZE) gives the value in base currency. Is there any way to get the value in deposit currency?
Ubzen
5299
Ubzen  
nokimchen:
Well,  MarketInfo(Pair,MODE_LOTSIZE) gives the value in base currency. Is there any way to get the value in deposit currency?
Trade a Pair where the Deposit Currency is the Base Currency.
phi nuts
2092
phi nuts  
nokimchen:
Well,  MarketInfo(Pair,MODE_LOTSIZE) gives the value in base currency. Is there any way to get the value in deposit currency?

MarketInfo's MODE_LOTSIZE is telling how much unit 1 lot is. If it return 100,000 then the account is using 1 standard lot. If it 10,000, then the account is mini account.

If you're looking for how much it cost you to open 1 lot size in deposit currency then you should use MarketInfo's MODE_MARGINREQUIRED.

See also standard constant for MarketInfo https://docs.mql4.com/constants/marketinfo 

William Roeder
20208
William Roeder  
Risk depends on your initial stop loss, lot size, and the value of the pair.
  • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
  • Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency (EUR, in this case).
              MODE_TICKVALUE is not reliable on non-fx instruments with many brokers.
  • You must normalize lots properly and check against min and max.
  • You must also check FreeMargin to avoid stop out
Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5=0.1 Lots maximum.
nicholi shen
2392
nicholi shen  
I see what you're asking, OP... OP is asking how to get the equivalent units in deposit currency which is an important step in calculating commission costs. Most brokers charge x dollars per 100000 units deposit currency... It is possible but will require custom solution...it's not built into the platform.
Fernando Carreiro
4982
Fernando Carreiro  
whroeder1: Risk depends on your initial stop loss, lot size, and the value of the pair ...
nicholishen: I see what you're asking, OP ...

You guys are aware you a replying to a 5 year old post from a 2012 zombie thread (resurrected by deleted SPAM), do you not?

nicholi shen
2392
nicholi shen  
Fernando Carreiro:

You guys are aware you a replying to a 5 year old post from a 2012 zombie thread (resurrected by deleted SPAM), do you not?

Haha no. But since we're here I am looking for a commission calculator based on x dollars per 100k units deposit currency, you have? 
Fernando Carreiro
4982
Fernando Carreiro  
nicholishen: Haha no. But since we're here I am looking for a commission calculator based on x dollars per 100k units deposit currency, you have? 

Yes, I do, but it is solar powered and it does not work at night!

William Roeder
20208
William Roeder  
nicholishen am looking for a commission calculator based on x dollars per 100k units deposit currency
You're not going to find it. You have to get it from your specific broker. Could be fixed, or $/lot
nicholi shen
2392
nicholi shen  
whroeder1:
You're not going to find it. You have to get it from your specific broker. Could be fixed, or $/lot

You misunderstood... My broker (and other brokers) charge a fixed amount per 100,000 of the deposit currency, which requires conversion of units. For example here is the description of how my broker charges:

How Commissions Are Calculated?

Total commission (Round-Turn) = (No. of Lots * Contract Size * Commission per $100k) * Conversion Price to Base Currency



#include <multi_symbol_timeframe.mqh>

double CommissionCalc(string symbol, double lots, double money_per_100k_units)
{
   double res = (double)UnitsDepositCurrency(symbol)/100000.0*money_per_100k_units*lots;
   return MathCeil(res*100)/100;
}

int UnitsDepositCurrency(const string symbol)
{
   string currency_account = AccountInfoString(ACCOUNT_CURRENCY);
   string currency_base    = StringSubstr(symbol,0,3);
   string currency_counter = StringSubstr(symbol,3,3);
   int    contract_units   = (int)MarketInfo(symbol,MODE_LOTSIZE);
   if(contract_units <= 0)
      return -1;
   if(currency_account==currency_base)
      return contract_units;
   if(currency_account==currency_counter)
   {
      double bid = iBid(symbol);
      if(bid <= 0.)
      {
         Print(__FUNCTION__," ",ErrorDescription(GetLastError()));
         return -1;
      }
      return int((double)contract_units*bid);
   }
      
   int total = SymbolsTotal(false);
   for(int i=0;i<total;i++)
   {
      string mw_symbol  = SymbolName(i,false);
      if(StringFind(mw_symbol,currency_account)>=0 && StringFind(mw_symbol,currency_base)>=0)
      {
         double bid = iBid(mw_symbol);
         if(bid <= 0.)
         {
            Print(__FUNCTION__," ",ErrorDescription(GetLastError()));
            return -1;
         }
         string mw_base    = StringSubstr(mw_symbol,0,3);
         string mw_counter = StringSubstr(mw_symbol,3,3);
         if(mw_base==currency_base)
            return int(double(contract_units)*bid);
         if(mw_counter==currency_base)
         {
            int mw_units      = (int)MarketInfo(mw_symbol,MODE_LOTSIZE);
            int counter_units = int((double)mw_units*bid);
            if(counter_units <= 0)
               return -1;
            return int(((double)contract_units * (double)mw_units) / (double)counter_units);
         }
         break;
      }
   }
   return -1;
}
Fernando Carreiro
4982
Fernando Carreiro  
nicholishen: You misunderstood... My broker (and other brokers) charge a fixed amount per 100,000 of the deposit currency, which requires conversion of units. For example here is the description of how my broker charges:

How Commissions Are Calculated?

Total commission (Round-Turn) = (No. of Lots * Contract Size * Commission per $100k) * Conversion Price to Base Currency

When you asked, I thought it was just a joke and answered accordingly! Sorry about that!

So, what exactly are you asking for then?

12
To add comments, please log in or register