TLDR - Issue- Current code calculates lot size in USD instead of deposit currency based on risk %.
anyone?
Why do you try yourself what already exists?
Search for lot size: https://www.mql5.com/en/search#!keyword=lot%20size&module=mql5_module_codebase
400 examples only in the code base - pick one and copy it, they are made even for you :)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey all!
I am trying to create a function that returns the appropriate lot size according to a required risk % of the total balance (in deposit currency) available.
So far I managed to code these 2 functions by looking at different sources available online (forums + source base in meta editor) by getting a rough understanding of whats going on. I noticed an issue though. Both of these functions have these issues. I was testing this on GBPUSD currency on strategy tester however my deposit currency is AUD.
Using 3000 AUD as starting balance, my functions are both actually returning the lot size assuming the balance is 3000 USD, not AUD which is the deposit currency. I could verify this by using the myfxbook lot size calculator which is a great website to help me size my trades.
Can anyone help me fix this issue to get the code to actually get the lot size based on risk of deposit currency not USD as it currently does? Thank you!!
PS.
Also if anyone could point me to good resources to understand the below, (I only have rough understanding not complete understanding)
SYMBOL_POINT
SYMBOL_VOLUME_STEP
SYMBOL_TRADE_TICK_VALUE
SYMBOL_TRADE_TICK_SIZE
that would be great. The MetaEditor F1 help reference does not explain it properly / adequately... atleast I felt that way. So it was very difficult for me to understand all that. Also I am sort of new to MQL5 , so if you have any tips to improve the above code in other ways that comes with experience only, really appreciate it.