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
@Miguel Angel Vico Alba :thanks for the snippet. i'll give it a try immidiatly.
@Fernando Carreiro : I apologies for this. I usually try to read a tons of posts searching for a matching of my need with posts and not to burden you in the group with work. i could not immagine of broken config. In any case thank for your patience.
Don't worry, your problem (although already much discussed on the forum) is entirely laudable. I myself have suffered from it for a long time.
For my part, you are welcome!
When and if you get an answer from your broker, please let us know their response here on this thread.
ok ,
i tried to test the code Miguel posted , and these are my results after i changer two lines of code :
for my point of view a corret tickvalue is about : 0.000465729646487196 for a bid price XAU of 1976.88
for my point of view the call to GetCrossRate(prof, acc); is enough to return 0.920691623547609028
I do not undestand the original TickValue *= GetCrossRate(prof, acc); because it give 0.0920691623547609028.
the correct value for my understanding should be 0.000465729646487196 isn't it ??
the second case from Trinh Dat is hard to read for me because :
for a price of 1977.849999999999909051 it return 0.089999999999999997 ....what does it mean ??
could you check what are the correct value 0.000465729646487196 or 0.089999999999999997 ??
also i read this post try to clear my understanding. https://www.mql5.com/en/forum/439319
thanks
This code is only part of a much larger code and only serves as an example.
Here is an example from CodeBase by the same author of the topic you posted and the code I posted.
Check carefully the file Functions.mqh
https://www.mql5.com/en/code/28029
for my point of view the call to GetCrossRate(prof, acc); is enough to return 0.920691623547609028
I do not undestand the original TickValue *= GetCrossRate(prof, acc); because it give 0.0920691623547609028.
the correct value for my understanding should be 0.000465729646487196 isn't it ??
The correct value is 0.920691623547609028 (depending on tick size). It is not 0.000465729646487196!
Tick value does not depend on the price of XAUUSD. The tick value for XAUUSD is a constant $1 USD (depends on tick size) for any and all prices of XUAUSD.
When it is converted to EUR it then varies depending of the price of EURUSD, but it is still totally independent of XAUUSD price.
Ok @Fernando Carreiro : sorry for delay ...I tried to go to the end and I would like to have your opinion , so :
first : applying the formula above
I received the value of 0.0920691623547609028 but i was expecting 0.920691623547609028 -> 0.9 and not 0.09 wich one is correct?.
also , in That function I do not understand -> TickValue *= GetCrossRate(prof, accn); // TickValue *= ... while i was thinking ... TickValue =
second : if I apply this formula for "XAUUSD" :
lot = AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot)
https://www.mql5.com/en/forum/444637
Is 10.71 correct ?? I think no.
then .. would you give me a sight and show me where I'am wrong ?
then .. can I apply the same formula for pair like "EURUSD" and "XAUUSD" ??
thank
I have to tank you very much because trying and trying again i found the solution by my own ( I hope ) but thanks to your suggestions and examples, specifically 2 articles
https://www.mql5.com/en/forum/441959/page7
in this snippet it turns out 2 things , but before we must state that :
lot = maximum amount we are willing to risk / maximum amount we are willing to lose
1. maximum amount we are willing to risk = ( balance * 0.01)....
2. maximum amount we are willing to lose
for calculate this value we have more than one way but substantially you have to refer to the concept of stoploss.
but is important to note that the stoploss value must be expressed in TICKS and multiplied for a value of a single TICK (in account currency ).
so for calculate the stoploss values there are different ways : 1. specify a stoploss in pips and multiply by 10 because one pip is = to 10 points and then divide for ticksize . this example is clear
https://www.mql5.com/en/forum/373815
in this example 0.008 TICKS = has been calculate with 80pips *10 point per tick / 0.00001 ( ticksize for EURUSD)
2. specify a stoploss directly in tick as showed in above first snippet like Stop-loss : 1000 ticks
3. specify a stoploss with 2 prices ( openprice - stoplossprice ) and divide for ticksize ( example for "XAUUSD" (1928.960 -1928.655)/ ticksize
After you have the number of ticks for the stoploss you have to multiply number of ticks for a tickvalue in account currency . With this last step you have to be aware because the tickvalue MUST be the exchange of the profit currency to the account currency.
last thing to be aware is the contracts size of your broker for every Pairs, usefull to check if your lotsize is correct.
example for "XAUUSD" pair with ticksize =0.01 and tickvalue =0.091764166093140628 with EUR value of 1.08825
lotsize = (500000 * 0.01) / (( 1928.960 -1928.655) /ticksize ) * tickvalue )
= 5000 / ( 30.5 * 0.091764166093140628 )
= 5000 / 2.79880707 = 1786.47541 with a broker contract size of 10 for the "XAUUSD".
final lotsize = MathRound( lotsize /LotStep) * LotStep;
if (lotSize < minlot) lotSize = minlot;
if (lotSize > maxlot) lotSize = maxlot;
example for "EURUSD" pair with ticksize =0.00001 and tickvalue =0.091764166093140628 with EUR value of 1.08825
lotsize = (100000 * 0.01) / (1.06520-1.06320)/ ticksize ) * TickValue
= 1000 / ( 200 * 0.091764166093140628 )
= 1000 / 18.3528332 = 54.487501 with a broker contract size of 10000 for the "EURUSD"
I also attack a picture . see in bottom.
I'm probably missing something and some calculations aren't very precise but I wanted to give the sense of the general calculation. could you please check all this work. I hope, if it's correct, it will be of some utility for someone here in forum. thanks Fernando to you and to all group.
I did not go over all your steps, but I have to ask if maybe you are not over complicating things. Yes the following is how you would calculating things ...
However, have you tried using the built-in functions that MQL5 provides, namely OrderCalcProfit, and see if it gives the correct results before attempting to code your own calculations?
SYMBOL_TRADE_TICK_VALUE is a built-in MQL variable that represents the minimum price change of a trading instrument. The value of SYMBOL_TRADE_TICK_VALUE is dependent on the currency pair and the account currency.
If you believe that the value of SYMBOL_TRADE_TICK_VALUE is incorrect, you may want to double-check that you are using the correct symbol and account currency in your code. You can also check the symbol specifications in your trading platform or on the broker's website to confirm the tick value.
If you continue to have issues with SYMBOL_TRADE_TICK_VALUE , you can try contacting the MQL community or the support team of your trading platform or broker for further assistance. They may be able to provide more specific guidance on how to resolve the issue.
It seems that you did not read this thread from start to finish. All of that has already been addressed, analysed, issue identified, the broker contacted and possible solutions have been proposed. Now things have evolved beyond that initial issue onto another related topic of the discussion.