EarnForex / PositionSizer

Calculate your position size based on the risk and account size and execute your trades with this free MetaTrader expert advisor.
https://www.earnforex.com/metatrader-expert-advisors/Position-Sizer/
Apache License 2.0
416 stars 162 forks source link

lot size calculation issue with a particular broker jpy pairs #37

Closed paymanz closed 2 years ago

paymanz commented 2 years ago

hi dear developer , on this broker M4markets i get wrong calculation for JPY pairs , i know PSC works correct on every other broker i have ever tried and probably something is weird about this broker's servers , i have explained this issue with their support but they don't seem to be even understanding it.

i don't know if that possible or not but can PSC adapt to these type of brokers in next updates please?

EarnForex commented 2 years ago

Hi!

Is it in MT4 or MT5? What type of account do you have with them? What is your account currency?

paymanz commented 2 years ago

Hi!

Is it in MT4 or MT5? What type of account do you have with them? What is your account currency?

it is Demo MT4 and account type "Raw spread" , account currency is USD.

EarnForex commented 2 years ago

Thanks! I will look what can be done.

EarnForex commented 2 years ago

OK. In theory, I could circumvent this by detecting that quote currency != account currency but the reported tick value = 1 account currency unit. Then, the PSC could find the actual conversion pair (USD/JPY in your case) and then calculate the correct tick value.

However, this wouldn't work in M4Markets, because their misconfigured server reports Base Currency as AUD for nearly all currency pairs, even for those that have nothing to do with AUD (e.g., for EUR/CHF). So, searching for a conversion currency pair will fail based on Base/Profit Currencies.

It could be further circumvented by analyzing the symbol name, but I don't really like this way - it is slower and not foolproof due to prefixes/suffixes.

paymanz commented 2 years ago

oh ok , thanks for investigating this issue , appreciate it.

yeah making PSC slower and inefficient in calculation for just one broker doesn't worth it for sure.

paymanz commented 2 years ago

i have just noticed there is same issue in two other broker Turnkeyforex and coinexx , but not in all JPY pairs and only EURJPY!

and the mt5 version works correctly.

and its not only PSC , most other tools/EAs from other developers also have same issue here.

EarnForex commented 2 years ago

On those two other brokers, is there any output in the Experts tab of the Terminal subwindow? Like about the PSC failing to retrieve a reference pair?

paymanz commented 2 years ago

On those two other brokers, is there any output in the Experts tab of the Terminal subwindow? Like about the PSC failing to retrieve a reference pair?

when i reload PSC: 2022.03.02 13:21:27.594 PositionSizeCalculator EURJPY,M5: initialized 2022.03.02 13:21:27.577 PositionSizeCalculator EURJPY,M5: Loaded settings successfully. 2022.03.02 13:21:27.576 PositionSizeCalculator EURJPY,M5: Trying to load settings from file. 2022.03.02 13:21:27.534 PositionSizeCalculator EURJPY,M5: Saved settings successfully. 2022.03.02 13:21:27.532 PositionSizeCalculator EURJPY,M5: Trying to save settings to file: PSC_EURJPY132838627281956975.txt. 2022.03.02 13:21:27.531 PositionSizeCalculator EURJPY,M5: uninit reason 5

but for other pairs is shows same log , so no , nothing.

paymanz commented 2 years ago

on Turnkey when i check EURJPY(has problem) specification it has a tick value/size field. but on same broker USDJPY doesnt have this field and PSC calculates UJ correctly. https://i.imgur.com/n7HbWzN.png https://i.imgur.com/6dN1yqn.png M4markets https://i.imgur.com/WzZIrJM.png https://i.imgur.com/9fRezyD.png

paymanz commented 2 years ago

Runwise EA also had this problem, here is their respond: We’ve had a look at it. The broker isn’t setting the Tick Value correctly. You can see the tick value in CONFIG | Risk / Lots. It’s more wrong on JPY but wrong on other non-USD pairs. When this value is incorrect then can’t work lots from risk pips.

Note, Tick Value is returned by MetaTradre’s MarketInfo() function and it’s the broker’s responsibility to return the correct values: https://book.mql4.com/appendix/marketinfo

You’ll have to either use a different broker or set lots directly in CONFIG | Risk / Lots

paymanz commented 2 years ago

here is M4markets respond after i told them it is probably tick value that causes the issue:

"Please consider that we cant be responsible for the correct functionality of any EA as we are not the developers or sellers and we have no relation with coding of any expert advisor. Each EA user is responsible for that.

However as a gesture of goodwill we have checked internally and we confirmed that our configurations on our FX symbols are correct. No matter what tickmill or anyone is doing on that please consider that if any instrument is on Forex calculation then tick value and tick sizes are automatically being ignored from settings. Oppositely by having your configurations available for your clients when the open the specifications of any instrument it can be considered as an advantage, because tick size on USDJPY is indeed 0.001 and tick value is indeed 100 JPY."

im wondering , can PSC take the tick value into calculation to solve this problem?

EarnForex commented 2 years ago

The thing is, the tick_value reported to MQL4 is wrong :-). That's the problem.

paymanz commented 2 years ago

i explained this Tick size issue with coinexx and turnkey and they corrected their configuration 👍, PSC works normal on their platform now.

EarnForex commented 2 years ago

Wow! That's great!