Experts: Forex Calculators - page 2

 
Update 15 April, 2021

Fixed display of the number of decimal places to show in money calculations to AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS)


 
kzh125:
Hello, I get wrong result for "HongKong50": Hong Kong 50 Spot Index CFD


here is the information of the symbol:


Digits: 2 Point: 0.01 TickValue: 0.01 TickValueProfit: 0.01 TickValueLoss: 0.01 TickSize: 0.01 ContractSize: 1.0 LotsMin: 0.01 LotsMax: 100.0 LotsStep: 0.01 LotsLimit: 0.0 CurrencyBase: HKD CurrencyProfit: HKD CurrencyMargin: HKD Description: Hong Kong 50 Spot Index CFD Path: Spot\Spot Indices\Spot Indx Minor\#HongKong50


The point value is 0.01 for 1 lot. But it's 0.01 HKD.

My account currency is USD, the CurrencyProfit of #HongKong50 is HKD, so 0.01 / 7.75 (USD to HKD) is the real PointValueLots.

This is because the currency of TickValue for #HongKong50 is HKD, not USD.

But the currency of TickValue for USDJPY is USD, not CurrencyProfit(JPY).

So is this a mt5 bug?

(fxpro broker)

Please send a screenshot. I don't have "HongKong50" in my trading account to verify it.

Thanks!

 

I enjoyed reading the codes and learned a lot from them, specifically using the CAppDialog class and the object oriented style of the code. I am grateful for sharing these.

1. One issue that I encountered is that the windows structure seem to be different on screens with different resolutions, and sometime it can even get messy like the picture below. I am wondering if there is a nice way to make this work on any screen of arbitrary resolution.

2. Is there any necessity to make these as expert advisors? I mean we could have them as indicators because these are not executing any trade requests.


 
Hosein Rahnama:

1. One issue that I encountered is that the windows structure seem to be different on screens with different resolutions, and sometime it can even get messy like the picture below. I am wondering if there is a nice way to make this work on any screen of arbitrary resolution.


I think the origin of this problem is the window subsystem of MetaTrader (CAppDialog class).

Hosein Rahnama:

2. Is there any necessity to make these as expert advisors? I mean we could have them as indicators because these are not executing any trade requests.


Yes. You can convert to indicator.

just add 

#property indicator_chart_window

and

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
   return(rates_total);
  }

But, note that the following functions are prohibited in indicators:

OrderCalcMargin();
OrderCalcProfit();

 
amrali:

I think the origin of this problem is the window subsystem of MetaTrader (CAppDialog class).

Yes. You can convert to indicator.

just add 

and

But, note that the following functions are prohibited in indicators:


Thanks for the detailed response amrali. Do you think that the first issue (the window problem) could be solved by any means? I would be more than happy to know if you could come up with any idea for this.

 
Hosein Rahnama:

Thanks for the detailed response amrali. Do you think that the first issue (the window problem) could be solved by any means? I would be more than happy to know if you could come up with any idea for this.

Dear Hosein,

Hope it will fix your issue.

Close your platform, do the setup, then start you platform.

If you have more than one platform installed (MT4/MT5), you must do it for each "terminal.exe".

Have a great day!


 
Mpower:

Dear Hosein,

Hope it will fix your issue.

Close your platform, do the setup, then start you platform.

If you have more than one platform installed (MT4/MT5), you must do it for each "terminal.exe".

Have a great day!


Your solution rocks. It did work perfectly fine. Thanks a ton!

 
Loving these!! Is there any chance you can convert this for MT4?
 

Hello,


How can i change the leverage? I want to write 1:20 in DAX, but i cant

 
Alex23admiral #: How can i change the leverage? I want to write 1:20 in DAX, but i cant

You can't change the leverage. The leverage is set by your broker depending on account type and symbol.

If you want to trade with a different leverage then you will have to discuss it with your broker to ob so.