Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Questions about MultiCharts and user contributed studies.
Zheka
Posts: 223
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Postby Zheka » 27 Sep 2018

https://www.multicharts.com/pm/public/m ... es/MC-2499

1) Load any USD-quoted currency pair, e.g. USD.JPY, USD.CAD
2) apply any signal
3) set strategy currency to USD
4) set "Cash Per Trade" = $10000
5) run the signal and see in the trade list that trade sizes are not equal to 10 000 usd.

Answer:
There is no issue here. Your assumption regarding the exchange rate applied for conversion is correct. The reason you are not seeing the exact 10000 contracts amount is due to the fact that the previous daily bar close is used for the currency conversion, which is most often different from the current trade price. Here is the formula that is used for the calculation: Number of Contracts = Cash per trade / ( Big Point Value for the symbol * currency conversion exchange rate * order execution price) You can check the exchange rate using the convert_currency command.
Please correct me if I am wrong ( and there is indeed a viable scenario when this would be right).

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Postby Henry MultiСharts » 27 Sep 2018

Zheka, which data source do you use for the Currency Conversion feature?
https://www.multicharts.com/trading-sof ... Conversion

Zheka
Posts: 223
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Re: Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Postby Zheka » 27 Sep 2018

Henry,

I am using IB. Why should it matter?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Postby Henry MultiСharts » 28 Sep 2018

Zheka,

Based on the information you have provided you are using IB as the data source and Default (MCFX Private) as the Currency Conversion source. Please find attached calculations for order #5 and order #9 below:

Example 1
Trade #1 (Order #5) on 8/1/2018 from your screenshot in PM entry:
Cash per Trade = $10000
BPV = 1
Exchange Rate – USD/JPY daily Bid bar close for August 1st (the Default session for the Currency Conversion data feed ends at 16:59, whilst the time of the bar is 17:00) = 111,718
Order execution price= 111,63

Then we calculate the cross-price in order to find out how many dollars does 1 JPY cost: 1/111,718=0,0089511
Calculation occurs in the following format:
Number of Contracts = Cash per trade / (Big Point Value for the symbol * currency conversion exchange rate * order execution price)
Number of Contracts = 10000 / ( 1 * 0,0089511 * 111,63) = 10007,883
Rounded trade size: 10007 contracts.

Example 2
Trade #5 (Order #9) on 8/3/2018 from your screenshot in PM entry:
Cash per Trade = $10000
BPV = 1
Exchange Rate – USD/JPY daily Bid bar close for August 2nd = 111,654
Order execution price = 111,232


Then we calculate the cross-price in order to find out how many dollars does 1 JPY cost: 1/111,654=0,00895624
Calculation occurs in the following format:
Number of Contracts = Cash per trade / (Big Point Value for the symbol * currency conversion exchange rate * order execution price)
Number of Contracts = 10000 / (1 * 0,00895624 * 111,232) = 10037,93872
Answer: 10037 contracts.

Zheka
Posts: 223
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Re: Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Postby Zheka » 28 Sep 2018

Henry,

I knew there are probably "some well-reasoned calculations" even as I submitted the PM.

Whatever they are, they just do not make sense. Or are not applicable.
And order for 10K usd is an order for 10Kusd. Not more, not less.

This can be easily programmed around, right? One "if" statement...

On a separate note:
- why is the previous day's close taken for calculations and not the nearest available price?
and what's the real(or technical) difficulty that prevents MC from using the most current rate?

- why should a trade entered 5min before the close of the day be "converted" at the rate valid almost 24 hrs ago?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bug report MC-2499 - MC/PT: wrong trade size with Cash Per Trade setting

Postby Henry MultiСharts » 06 Nov 2018

Henry,
I knew there are probably "some well-reasoned calculations" even as I submitted the PM.
Whatever they are, they just do not make sense. Or are not applicable.
And order for 10K usd is an order for 10Kusd. Not more, not less.
This can be easily programmed around, right? One "if" statement...
An order for 10K USD is an order for 10K USD. Please see the formula above.
On a separate note:
- why is the previous day's close taken for calculations and not the nearest available price?
and what's the real(or technical) difficulty that prevents MC from using the most current rate?
- why should a trade entered 5min before the close of the day be "converted" at the rate valid almost 24 hrs ago?
That is impractical since it will double the load on both the client (all aspects: data processing, strategy calculations, etc) and the currency conversion data feed side, making the difference in the conversion results not worth it.


Return to “MultiCharts”