Pips aren't officially defined values (they were dozens of years ago).
For your calculation you have to use Tick_Size and Tick_Value. They are defined by your broker (any broker can and does use different setups for their symbols and the accounts they provide).
E.g look here: https://www.mql5.com/en/forum/425413
- 2022.05.18
- www.mql5.com
Thanks for both replies. I have looked onto other posts.
So, if I understood correctly:
1) investment for a trade: 20 euros
2) leverage: 100
3) => margin: 2000 euros = 2040 dollars
4) 2040 dollars of the AUD/USD pair = (2040/0.69) = 2956 units
5) value of the pip (in euros) for the AUD/USD pair: 2956 * 0.0001 = 0.2898 euros
So, if I take a long position and I gain 40 pips: I would earn (in euros) : 0.2898 x 40 = 11.59 euros
Is it correct ?
Thank you
Aymeric
Thanks, indeed I got mixed up with the terms.
Just one last detail. I saw on the chart that the minimum price change is indeed 5 digits after 0 (0.00001).
But if I take the measure tool of Tradingview, the difference between the two values on the image (0.67395 and 0.68059) is 0.00664. The measure tools shows the value "66.4" which I interpret it as being 66.4 pips (and I would say I am right..), which means that TD considers a pip here as being 0.0001 (and not 0.00001).
So I guess the minimum movement of a price and a "pip" are two different things..
Do yourself a favour and start thinking in ticks. It makes your live a whole lot easier. It is universal for everything and it is the minimal movement in price, also most software just gives you the tick value, you don't even need to calulcate it.
Just ticks, 1 point on ES is 4 ticks for example. So if you want to calculate your risk, would you use points or ticks?
Just ticks, 1 point on ES is 4 ticks for example. So if you want to calculate your risk, would you use points or ticks?
Ok, I have created an indicator based on the indications of @Dominik Christian Egert , here is what it looks like:
Even if I wrote it in Pine, I share the code here, you can also check it as I'm still not completely sure about it (I commented it):
//
// © usefulOatmeal73423
//@version=5
indicator("Invest en pips", overlay=true)
invest = input.float(20, "Invest amount in euros")
leverage = input.int(100, "Leverage", minval=1, maxval=500, step=10)
// for Forex returns 0.0001 (instead of 0.00001)
GetPipSize() =>
syminfo.mintick * (syminfo.type == "forex" ? 10 : 1)
tr(number, decimals) =>
factor = math.pow(10, decimals)
int(number * factor) / factor
print_table(leverage, invest_euros, val_pip) =>
var tab = table.new(position.middle_center, 2, 8)
euros_basecurrency = request.security(syminfo.basecurrency != 'EUR' ? 'EUR' + syminfo.basecurrency : syminfo.basecurrency, '1', close)
euros_quotecurrency = request.security(syminfo.currency != 'EUR' ? 'EUR' + syminfo.currency : syminfo.currency, '1', close)
invest_in_basecurrency = invest_euros*euros_basecurrency
margin_for_a_lot = 100000/leverage
investment_in_lots_percentage = invest_in_basecurrency/margin_for_a_lot // % of the invest compared to the margin (if invest 1 AUD / 1000, then = 0.001)
investment_in_lots_percentage := tr(investment_in_lots_percentage, 2) // normalization (e.g 0.195 -> 0.19), because granularity max is 0.01 (micro lot)
profit_loss_value_in_quote = tr(close * val_pip * 100000 * investment_in_lots_percentage, 2) // profit / loss corresponding to the mouvement of one pip
profit_loss_value_in_eur = tr(profit_loss_value_in_quote / euros_quotecurrency, 2) // profit / loss corresponding to the mouvement of one pip in EURO
// Left column
table.cell(tab, 0, 0, "leverage", bgcolor = color.yellow)
table.cell(tab, 0, 3, "margin for 1 lot", bgcolor = color.yellow)
table.cell(tab, 0, 1, "invest in EUR", bgcolor = color.yellow)
table.cell(tab, 0, 2, "invest in "+str.tostring(syminfo.basecurrency)+"", bgcolor = color.yellow)
table.cell(tab, 0, 4, "investment percentage of the lot", bgcolor = color.yellow)
table.cell(tab, 0, 5, "profit/loss for one pip (in "+str.tostring(syminfo.currency)+")", bgcolor = color.yellow)
table.cell(tab, 0, 6, "profit/loss for one pip (in EUR)", bgcolor = color.yellow)
table.cell(tab, 0, 7, "stop_loss max (in pips)", bgcolor = color.yellow) // the max number of pips that our invest amount allows us to lose
// Right column
table.cell(tab, 1, 0, str.tostring(leverage), bgcolor = color.yellow)
table.cell(tab, 1, 3, str.tostring(margin_for_a_lot), bgcolor = color.yellow)
table.cell(tab, 1, 1, str.tostring(invest_euros), bgcolor = color.yellow)
table.cell(tab, 1, 2, str.tostring(invest_in_basecurrency), bgcolor = color.yellow)
table.cell(tab, 1, 4, str.tostring(investment_in_lots_percentage), bgcolor = color.yellow)
table.cell(tab, 1, 5, str.tostring(profit_loss_value_in_quote), bgcolor = color.yellow)
table.cell(tab, 1, 6, str.tostring(profit_loss_value_in_eur), bgcolor = color.yellow)
table.cell(tab, 1, 7, str.tostring(int(invest_euros / profit_loss_value_in_eur)), bgcolor = color.yellow)
print_table(leverage, invest, GetPipSize())
Thanks a lot!
Aymeric
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I would like to know the formula for computing the value of a pip (more specifically the minimum mouvement of a forex pair) for a leverage of 100.
Here is what I have tried:
Let's try to calculate this value for the AUD/USD pair:
1) 1 pip = 0.0001 of the AUD/USD pair
2) we can say that "1 AUD/USD = 0.69", so 1 pip = 0.0001 USD
3) 1 pip = 0.0001 x (value of a USD in euro) = 0.0001 x USDEUR = 0.000098 euros
4) with a leverage of 100: 1 pip = 0.000098 * 100 = 0.0098 euros
I am almost sure there is something wrong with my calculation...
Any idea ?
Thanks!
Aymeric