I am having similar kind of issue with tick value and tick size for XAUUSDx and my broker is ThinkMarkets. The specification is showed below. Please not the Contract Size is 100, Margin Currency is USD, Calculation is CFD Leverage and Tick size is 0.01 and Tick value is 0.01.
In meta trader 5, formula for calculating margin requirement if the value of ENUM_SYMBOL_CALC_MODE is SYMBOL_CALC_MODE_CFDLEVERAGE is as below:
Identifier
Description
Formula
SYMBOL_CALC_MODE_CFDLEVERAGE
CFD Leverage mode - calculation of margin and profit for CFD at leverage trading
When I am using following code to calculate lot size requirement:
#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
void OnStart()
{
Test("XAUUSDx");
}
void Test (string symbol) {
PrintFormat("Base currency is %s", AccountInfoString(ACCOUNT_CURRENCY));
PrintFormat("Testing for symbol %s", symbol);
double pointValue = PointValue(symbol);
PrintFormat("ValuePerPoint for %s is %f", symbol, pointValue);
// Fixed risk amount and stoop loss, how many lots to trade
double riskAmount = 100; //$
double riskPoints = 50; // in point
double riskLots = riskAmount/(pointValue*riskPoints);
PrintFormat("Risk lots for %s amount $ %f and sl at %f points is %f", symbol, riskAmount , riskPoints, riskLots);
}
double PointValue(string symbol) {
double TickSize = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE);
double TickValue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE);
double point = SymbolInfoDouble(symbol, SYMBOL_POINT );
double contractSize=SymbolInfoDouble(symbol,SYMBOL_TRADE_CONTRACT_SIZE);
int tradeCalcMode=(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_CALC_MODE);
string tcm = EnumToString((ENUM_SYMBOL_CALC_MODE)tradeCalcMode);
double TickPerPoint = TickSize/point;
double PointValue = TickValue/TickPerPoint;
PrintFormat("contractSize =%f, tradeCalcMode =%s, TickSize=%f, TickValue=%f, point=%f, TickPerPoint=%f, PointValue=%f", contractSize, tcm, TickSize, TickValue, point, TickPerPoint, PointValue);
return(PointValue);
}
I am getting following output:
LotSizeCalculation (XAUUSD,H1) contractSize =100.000000, tradeCalcMode =SYMBOL_CALC_MODE_CFDLEVERAGE, TickSize=0.010000, TickValue=0.010000, point=0.010000, TickPerPoint=1.000000, PointValue=0.010000
LotSizeCalculation (XAUUSDx,H1) Risk lots for XAUUSD amount $ 100.000000 and sl at 50.000000 points is 200.000000
which is literally position size has to be 200lots for 50 points stop loss and 100$ risk. Which is not correct.
But when I run the same script on ICMarkets, I get the following output:
LotSizeCalculation (XAUUSD,M30) contractSize =100.000000, tradeCalcMode =SYMBOL_CALC_MODE_FOREX, TickSize=0.010000, TickValue=1.000000, point=0.010000, TickPerPoint=1.000000, PointValue=1.0000002023.08.2218:46:56.211 LotSizeCalculation (XAUUSD,M30) Risk lots for XAUUSD amount $ 100.000000 and sl at 50.000000 points is 2.000000
For ICMarkets, spec for XAUUSD is as follows: (Pls note Margin Currency is XAU and Calculation is Forex
Lotsize requirement for the first broker is 200 and for the second broker is 2.
My question is do I have to use contract size and if yes how am I going to use contract size to calculate the lot size required? Do i have to check SYMBOL_TRADE_CALC_MODE and SYMBOL_TRADE_CONTRACT_SIZE for calculating lot size as standard procedure for all symbols all the time?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I think @Doerk Hilger meant his customers.
Yes, the users were meant, sorry :)
Dear all,
I am having similar kind of issue with tick value and tick size for XAUUSDx and my broker is ThinkMarkets. The specification is showed below. Please not the Contract Size is 100, Margin Currency is USD, Calculation is CFD Leverage and Tick size is 0.01 and Tick value is 0.01.
In meta trader 5, formula for calculating margin requirement if the value of ENUM_SYMBOL_CALC_MODE is SYMBOL_CALC_MODE_CFDLEVERAGE is as below:
SYMBOL_CALC_MODE_CFDLEVERAGE
CFD Leverage mode - calculation of margin and profit for CFD at leverage trading
Margin: (Lots * ContractSize * MarketPrice) / Leverage * Margin_Rate
Profit: (close_price-open_price) * Contract_Size * Lots
When I am using following code to calculate lot size requirement:
I am getting following output:
which is literally position size has to be 200lots for 50 points stop loss and 100$ risk. Which is not correct.
But when I run the same script on ICMarkets, I get the following output:
For ICMarkets, spec for XAUUSD is as follows: (Pls note Margin Currency is XAU and Calculation is Forex
Lotsize requirement for the first broker is 200 and for the second broker is 2.
My question is do I have to use contract size and if yes how am I going to use contract size to calculate the lot size required? Do i have to check SYMBOL_TRADE_CALC_MODE and SYMBOL_TRADE_CONTRACT_SIZE for calculating lot size as standard procedure for all symbols all the time?
Any help would be much appreciated!