I hope you are fine. I have a dumb question. I have problems auto-calculating lotsizes for CFDS -only on some brokers-.
On *some* cfds, the tick value defined by the broker is wrong, or at least I think it is.
For example, for the symbol SP500 at GlobalPrime....
But once a trade is taken, each point of the price movement impacts the account by 10$, not 0.1$.
Is the TICK_VALUE wrong? Or I am doing something wrong and CFDs need a more particular code? The following is my lotsize calculation logic:
The GetDecimalPip() function is...
The above logic works fantastic for all forex pairs, including oil, gold and silver. Only cfds seem out of whack.Thanks everyone!
I am having same problem with the E Mini S&P futures contract or ES in MT5. It moves in increments of a quarter point or 0.25 and 4 makes a point. So I had to use 2500 for a tick or 10000 for one whole point. Still trying to figure things out as I am not that good at code.
And in US Bonds one tick is $31.25 and 32 ticks make a full point or $1000. So it goes up to 99,999 to get the 32 ticks in a point. So a 3 tic stop or $93.75 is input not as 3 but 9375. Makes sense? I am still learning too. Wish it was easier in MT5.
On a 4 digit broker a point (0.0001) = pip (0.0001). [JPY 0.01 == 0.01] On a
5 digit broker a point (0.00001) = 1/10 pip (0.00010/10). Just because you quote
an extra digit doesn't change the value of a pip. (0.0001 == 0.00010) EA's must
adjust pips to points (for mq4.) In currencies a tick is a point. Price can
change by least significant digit (1.23456 -> 1.23457)
In metals a Tick is still the smallest change but is larger than a point. If
price can change from 123.25 to 123.50, you have a TickSize of 0.25 and a
point of 0.01. Pip has no meaning.
This is why you don't use TickValue by itself. Only as a ratio with
TickSize. See DeltaValuePerLot()
Arturo Lopez Perez:
Why are you returning 0.1 for 2 Digits?
Tickvalue is supposed to be in the account currency, but with many brokers is is not for non forex symbols. For USA indices it may return USD and ie DAX, Euros.
What is your account currency and how are you determining that each point of the price movement impacts the account by 10$, not 0.1$ ?
As a matter of interest, try this in a script
and see how they compare
Amount which every point change costs you depends from order lots. You did not show this in the codes.
Meanwhile try this:
Wrong. If you trade the EURUSD with a USD account currency, then it is (exactly) $10/pip/lot $1/point/lot (5 digit broker).
1 pip * tickValue / tickSize = 0.0001 * 1 / 0.00001 = $10/lot. Unless you know tick value and tick size you know nothing. If tick value/tick size is wrong, complain to your broker.
Yes, but what would happen if a broker happened to only have 2 Digits for Japanese pairs?
Yes I know that it is probably very rare nowadays.
Did you put my code in a script and check the trade?
There is obviously a wrong tick value. You should report it to GlobalPrime.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.