Hi all,
I am not sure if I am posting this in the correct page. I faced a problem when come to code the risk management module.
My deposit currency is in SGD and the instrument that I traded is in HKD. I like to allocate 2% risk for every trade that I take using MT4. For example, Hang Seng index is HK$50 per pip and it is 1 index point per pip as well. However, if I have SG$100,000 as deposit in my account it means that I can risk SG$2000 per trade. How do I write a code to convert my SGD deposit to HKD by looking at the FX quote before the MT4 initial a trade with the intended contract quantity in Hang Seng Index?
Thanks in advance.
Did a quick search and found this link: https://www.mql5.com/en/forum/218444 - see if it helps you.
- 2017.10.31
- www.mql5.com
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot and verify that
MODE_TICKVALUE is returning a value in your deposit currency, as promised
by the documentation, or whether it is returning a value in the instrument's
base currency.
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers. - You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I am not sure if I am posting this in the correct page. I faced a problem when come to code the risk management module.
My deposit currency is in SGD and the instrument that I traded is in HKD. I like to allocate 2% risk for every trade that I take using MT4. For example, Hang Seng index is HK$50 per pip and it is 1 index point per pip as well. However, if I have SG$100,000 as deposit in my account it means that I can risk SG$2000 per trade. How do I write a code to convert my SGD deposit to HKD by looking at the FX quote before the MT4 initial a trade with the intended contract quantity in Hang Seng Index?
Thanks in advance.